From 6cbe0ae43846021d056d8d0e4151d817b37d80b7 Mon Sep 17 00:00:00 2001
From: mikemikimike <13286568797@163.com>
Date: Sun, 23 Aug 2026 00:13:12 +0800
Subject: [PATCH] test(shacl): cover conforming validation result
---
tests/ontology/test_ontology_advanced.py | 24 ++++++++++++++++++++++++
1 file changed, 24 insertions(+)
diff --git a/tests/ontology/test_ontology_advanced.py b/tests/ontology/test_ontology_advanced.py
index 149a8789..7b47f3a3 100644
--- a/tests/ontology/test_ontology_advanced.py
+++ b/tests/ontology/test_ontology_advanced.py
@@ -549,6 +549,30 @@ class TestSHACLHierarchicalAndValidation(unittest.TestCase):
self.assertEqual(legacy_report.to_dict(), public_report.to_dict())
# 34
+ def test_public_run_shacl_validation_conforming_graph(self):
+ """The public API reports a valid graph without violations."""
+ try:
+ import pyshacl # noqa: F401
+ import rdflib # noqa: F401
+ except ImportError:
+ self.skipTest("pyshacl/rdflib not installed")
+ from semantica.ontology import run_shacl_validation
+
+ data = """
+ @prefix ex: .
+ ex:alice a ex:Person ; ex:name "Alice" .
+ """
+ shacl = """
+ @prefix ex: .
+ @prefix sh: .
+ ex:PersonShape a sh:NodeShape ; sh:targetClass ex:Person ;
+ sh:property [ sh:path ex:name ; sh:minCount 1 ] .
+ """
+
+ report = run_shacl_validation(data, shacl)
+
+ self.assertTrue(report.conforms)
+ self.assertEqual(report.violation_count, 0)
def test_shacl_violation_to_dict(self):
from semantica.ontology.ontology_validator import SHACLViolation
v = SHACLViolation(