The example ontology has two classes (:MyClass and :Value) and two properties (:MyObjProp and :MyDataProp).
:MyClassSome instances were added.
:MyClass_1A NodeShape :NodeShapeRule with a sh:rule (:SPARQLRule_1) was created. This rule creates new triples. With the sh:condition the rule should be restricted to a subset of targets.
:NodeShapeRuleFor the restriction two equivalent NodeShapes were defined. The first constraint works with sh:property, the other uses sh:sparql.
:NodeShapeConditionPropertyWhile doing inferencing with Topbraid Composer I received different results for both solutions. Only the solution with sh:property provides the expected response. Please, can anyone explain me this behavior?
:MyClass_1 :MyDataProp "New input"Thanks for sending the details in a minimal executable format. Made it much easier to play around.
The issue is that the sh:condition must apply to the focus node(s), which means that before a rule is applied, the focus node must not violate any constraints from the node shape that is the sh:condition. In your example, the sh:sparql constraint will be violated, because
--
You received this message because you are subscribed to the Google Groups "TopBraid Suite Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to topbraid-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/topbraid-users/09c459dd-d5e5-4e58-9a5a-a16b53c24605n%40googlegroups.com.
Thanks for you quick reply. The result of my SPARQL query describes the violation. So, with your proposal the not existing part of the triples is declared as violation.
What makes me wonder is that in opposite the expressions in sh:property doesn’t describe the violation. What’s the reason for this different understanding?
Many thanks for your help!
Oliver
Thanks for you quick reply. The result of my SPARQL query describes the violation. So, with your proposal the not existing part of the triples is declared as violation.
What makes me wonder is that in opposite the expressions in sh:property doesn’t describe the violation. What’s the reason for this different understanding?
In all cases, the sh:condition shape describes the constraints that the target nodes must fulfill. In the case of property constraints this is quite intuitive, so if you say sh:hasValue :Value_1 then it will only apply to nodes where that property has the given value. With SHACL-SPARQL constraints, you formulate the constraints in a way that may be confusing at first, because you have to state the patterns that are *not* supposed to exist. So if the SPARQL query returns no result (rows) then all is fine and the rule will fire. The reason for this design is that this enables SPARQL queries to return more information about the violation, e.g. the focus node (?this) and the value node (?value).
Is this clearer now?
Holger
To view this discussion on the web visit https://groups.google.com/d/msgid/topbraid-users/9240a044-bfd4-4459-bc8d-6b3f83172480n%40googlegroups.com.