Search code examples
sparqljenashacl

SPARQLRule not constructing


I have a Nodeshape with a sh:SPARQLTarget and a sh:SPARQLRule. I tried to run both Target and Rule as Queries and both deliver results, but when I'm executing the Shapes with the Apache Jena SHACL Processor, it won't construct any triples. Did I do something wrong? I'm out of ideas. Here is my Nodeshape:

iep:hasKG331
a rdf:Property, sh:NodeShape ;
sh:Target [
    a sh:SPARQLTarget ;
          sh:select """
            PREFIX express: <https://w3id.org/express#>
            PREFIX ifcowl: <http://standards.buildingsmart.org/IFC/DEV/IFC4/ADD1/OWL#>
            PREFIX rdf:  <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
            PREFIX iep: <https://www.inf.bi.rub.de/semweb/ns/ifc-enrichment-procedure/iep#>

            SELECT ?this
            WHERE {
                ?this rdf:type ifcowl:IfcWallStandardCase .
                ?relDefinesByProperties ifcowl:relatedObjects_IfcRelDefines ?this .
                ?relDefinesByProperties ifcowl:relatingPropertyDefinition_IfcRelDefinesByProperties ?pset .
                }
          """ ;

    ] ;
sh:rule [
    a sh:SPARQLRule ;
        sh:construct """
        PREFIX express: <https://w3id.org/express#>
        PREFIX ifcowl: <http://standards.buildingsmart.org/IFC/DEV/IFC4/ADD1/OWL#>
        PREFIX iep: <xxx/ifc-enrichment-procedure/iep#>

        CONSTRUCT {
            $this iep:hasKG iep:hasKG331 .
        }
        WHERE {
            ?relDBP ifcowl:relatedObjects_IfcRelDefines $this .
            ?relDBP ifcowl:relatingPropertyDefinition_IfcRelDefinesByProperties ?propSet .
            ?propSet ifcowl:hasProperties_IfcPropertySet ?psv1 .
            ?propSet ifcowl:hasProperties_IfcPropertySet ?psv2 .
            ?psv1 iep:isExternal true .
            ?psv2 iep:isLoadBearing true .
        }
    """ ;
] .

As I mentioned, when I execute the Target or the Rule as single queries, I do get results and the Focus Nodes from the Target do come up as $this in the Rule. The IRIs iep:isExternal and iep:isLoadBearing got inferenced in a step before. Am I missing something?


Solution

  • Without looking at details, the sh:Target needs to be sh:target with lower-case t. All property names are typically lower-case.