Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
829 views
in Technique[技术] by (71.8m points)

sparql - 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?

question from:https://stackoverflow.com/questions/65945735/sparqlrule-not-constructing

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...