Hi,
I would like to display variables form SHACL SPARQL query in sh:message
.
With other environments, I could do so by putting SHACL SPARQL variables in {}-brackets. Why is it not working within Stardog? How can I display variables in SHACL messages in Stardog?
Thank you for the support.
Example SHACL code:
<http://www.semanticweb.org/florianschmid/ontologies/2022/0/untitled-ontology-60#CostsRuleShapeIII> a sh:NodeShape ;
sh:severity sh:Info ;
sh:targetClass <http://www.semanticweb.org/florianschmid/ontologies/2022/0/untitled-ontology-60#Teacher> ;
sh:sparql [
a sh:SPARQLConstraint ;
sh:message "{?student} is a student that gets teached." ;
sh:prefixes [
sh:declare [
sh:namespace "http://www.semanticweb.org/florianschmid/ontologies/2022/0/untitled-ontology-60#"^^xsd:anyURI ;
sh:prefix "maic"
]
] ;
sh:select """
SELECT $this ?student
WHERE {
$this maic:teaches ?student
}"""
] .
<http://www.semanticweb.org/florianschmid/ontologies/2022/0/untitled-ontology-60#Teacher> a owl:Class ;
rdfs:subClassOf <http://www.semanticweb.org/florianschmid/ontologies/2022/0/untitled-ontology-60#Person> .
Example validation result:
_:bnode_3a94ee23_fce8_4cd6_817d_d02f2ed6c433_162 a sh:ValidationReport ;
sh:conforms false .
_:bnode_3a94ee23_fce8_4cd6_817d_d02f2ed6c433_163 a sh:ValidationResult ;
sh:resultSeverity sh:Info ;
sh:sourceShape <http://www.semanticweb.org/florianschmid/ontologies/2022/0/untitled-ontology-60#CostsRuleShapeIII> ;
sh:sourceConstraint _:bnode_3a94ee23_fce8_4cd6_817d_d02f2ed6c433_159 ;
sh:sourceConstraintComponent sh:SPARQLConstraintComponent ;
sh:focusNode <http://www.semanticweb.org/florianschmid/ontologies/2022/0/untitled-ontology-60#Elia> ;
sh:value <http://www.semanticweb.org/florianschmid/ontologies/2022/0/untitled-ontology-60#Elia> ;
sh:resultMessage "{?student} is a student that gets teached." .
_:bnode_3a94ee23_fce8_4cd6_817d_d02f2ed6c433_162 sh:result _:bnode_3a94ee23_fce8_4cd6_817d_d02f2ed6c433_163 .
Expected validation result:
sh:resultMessage "Flo is a student that gets teached." .