目前我正在尝试maps:mapstoclass
根据下面的三元组推断一个新属性。data0:object100
这个想法是我可以使用推断的结果(以及包含数据对齐的rdf 文件:类)来data1:
确定maps:hasOverlap
.
maps:relation_obj1 a maps:OverlapRelations ;
maps:hasOverlap [ a data1:classA ;
maps:mainRelativeArea "80.0"^^xsd:float ;
maps:secRelativeArea "100.0"^^xsd:float ;
maps:secfeature data1:object1 ;
] ;
maps:hasOverlap [ a data1:classX ;
maps:mainRelativeArea "40.0"^^xsd:float ;
maps:secRelativeArea "100.0"^^xsd:float ;
maps:secfeature data1:object2 ;
] ;
maps:mainfeature data0:object100 ;
maps:mainclass data0:classB .
首先,我查看了是否maps:hasOverlap
满足我的对象属性qualifiedValueShape
(最后给出了 shacl 形状/规则)。在这种情况下,只有带有 maps:secfeature data1:object1 的 'hasOverlap' 对象满足条件。因此'maps:mapsto'的对象应该是data1:object1。我期望的结果是:
maps:relation_obj1 maps:mapstoclass data1:object1.
但是,我目前得到:
maps:relation_obj1 maps:mapstoclass data1:object1, data1:object2.
我究竟做错了什么?规则的 sh:condition 是否需要在 sh:object 中显式应用?我查看了节点表达式,但没有成功使用它 - 而且我在文档中找不到适用的示例。
使用的形状:
ex:mainAreaShape
rdf:type sh:NodeShape;
sh:property [
sh:path maps:mainRelativeArea ;
sh:minInclusive 80 ;
].
ex:secAreaShape
rdf:type sh:NodeShape;
sh:property [
sh:path maps:secRelativeArea ;
sh:minInclusive 80 ;
].
ex:OverlapRelations
rdf:type rdfs:Class, sh:NodeShape ;
sh:targetClass maps:OverlapRelations;
rdfs:label "whether overlap between features is enough to generate relation" ;
sh:rule [
rdf:type sh:TripleRule ;
sh:subject sh:this ;
sh:predicate maps:mapstoclass;
sh:object [sh:path (maps:hasOverlap
rdf:type) ;
];
sh:condition ex:OverlapRelations;
sh:condition [
sh:property [
sh:path maps:hasOverlap ;
sh:nodeKind sh:BlankNode ;
sh:minCount 1;
sh:qualifiedValueShape [
sh:and (ex:mainAreaShape ex:secAreaShape);
];
sh:qualifiedMinCount 1;
sh:qualifiedMaxCount 1;
];
];
].