我正在使用TopBraidComposer Maestro中的SHACL测试RDF数据的验证(V6.3.2)。在我分析SHACL的过程中,我看到了文档SHACL的破折号再定位支持。该文档的第2章定义了属性dash:reifiableBy,根据该文档,该属性“可用于将SHACL属性形状与一个或多个节点形状链接。任何具体化的语句都必须符合这些节点形状。”
这似乎意味着可以定义针对某些形状的语句的SHACL验证。文档中有一个示例,我尝试在TopBraidComposer中运行它--不过,为了获得验证结果(在本例中,语句无效),稍微做了一些修改。守则是:
# baseURI: http://example.org/shacl/shapes/dash/reifiableBy
# imports: http://datashapes.org/dash
# prefix: exshacl
@prefix ex: <http://example.org/shacl/data/dash/reifiableBy#> .
@prefix exschema: <http://example.org/shacl/schema/dash/reifiableBy/> .
@prefix exshacl: <http://example.org/shacl/shapes/dash/reifiableBy#> .
@prefix dash: <http://datashapes.org/dash#> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix sh: <http://www.w3.org/ns/shacl#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
<http://example.org/shacl/shapes/dash/reifiableBy>
a owl:Ontology ;
owl:imports <http://datashapes.org/dash> ;
.
###########################
# Shape(s)
###########################
exshacl:ProvenanceShape
a sh:NodeShape ;
sh:property [
a sh:PropertyShape ;
sh:path exschema:date ;
sh:datatype xsd:date ;
sh:minCount 1 ;
] ;
sh:property [
a sh:PropertyShape ;
sh:path exschema:author ;
sh:nodeKind sh:IRI ;
sh:minCount 1 ;
] ;
.
exshacl:PersonShape
a sh:NodeShape ;
sh:targetClass exschema:Person ;
sh:property [
a sh:PropertyShape ;
sh:path exschema:age ;
sh:datatype xsd:integer ;
sh:minCount 1 ;
dash:reifiableBy exshacl:ProvenanceShape ;
] ;
.
###########################
# Data
###########################
ex:Bob
a exschema:Person ;
exschema:age "23"^^xsd:integer ;
.
ex:BobAge23Reification
a rdf:Statement ;
rdf:subject ex:Bob ;
rdf:predicate exschema:age ;
rdf:object "23"^^xsd:integer ;
ex:author ex:Claire .exshacl:PersonShape可以工作,只要属性形状确保exschema:age存在于exschema:Person并具有数据类型xsd:integer。
但是,三重ex:BobAge23Reification上的rdf语句ex:Bob exschema:age "23"^^xsd:integer没有根据exshacl:ProvenanceShape进行验证。在语句中存在属性exschema:author时,属性exschema:date不存在。
dash:reifiableBy 是否没有定义实际验证的SHACL约束组件(只用于定义GUIs中的编辑表单)??
发布于 2020-06-25 01:51:06
(这些问题可以在topbraid用户邮件列表上更好地提出)
该形状看起来很好,但是TopBraid目前并不验证rdf:语句,而是使用使用http://datashapes.org/reification.html#uriReification的具体化三元组。
在未来的版本中,这可能会发生变化,这取决于Jena对RDF*支持可能采取的方向。
当前版本的TBC不适合编辑这样的具体化值,但是TopBraid EDG是。
https://stackoverflow.com/questions/62551189
复制相似问题