问题描述
我有一个带有 sh:SPARQLTarget
和 sh:SPARQLRule
的 Nodeshape。我尝试将 Target 和 Rule 作为查询运行并且都提供结果,但是当我使用 Apache Jena SHACL 处理器执行形状时,它不会构造任何三元组。我做错什么了吗?我没有想法了。
这是我的节点形状:
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 .
}
""" ;
] .
正如我所提到的,当我将目标或规则作为单个查询执行时,我确实得到了结果,并且来自目标的焦点节点确实在规则中显示为 $this
。 IRI iep:isExternal
和 iep:isLoadbearing
在之前的步骤中被推断出来。我错过了什么吗?
解决方法
不看细节,sh:Target 需要是小写的 t 的 sh:target。所有属性名称通常都是小写的。