3

我正在使用 TopBraidComposer Maestro Edition (v 6.3.2) 中的 SHACL 测试 RDF 数据的验证。在分析 SHACL 期间,我遇到了文档DASH Reification Support for 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存在 aexschema:Person并且具有 datatype xsd:integer

ex:BobAge23Reification但是,三元组上的 rdf 语句ex:Bob exschema:age "23"^^xsd:integer未针对exshacl:ProvenanceShape. 虽然exschema:author声明中存在财产,但财产exschema:date不存在。

示例代码是否错误或缺少关键位,或者dash:reifiableBy没有定义实际验证的 SHACL 约束组件(并且仅用于定义 GUI 中的编辑表单)?

4

1 回答 1

2

(此类问题最好在 topbraid-users 邮件列表中提出)

形状看起来不错,但 TopBraid 目前不验证 rdf:Statements,而是使用http://datashapes.org/reification.html#uriReification使用 reified 三元组

这可能会在未来的版本中发生变化,具体取决于 Jena 可能采取的 RDF* 支持方向。

当前版本的 TBC 不适合编辑这种具体化的值,但 TopBraid EDG 是。

于 2020-06-25T01:51:06.193 回答