外部资源的 SHACL 验证错误

SHACL Validation Error for External Resources

我有一个用于验证研究变量的 SHACL 模式。

{
  "@id": "m:VariableShape",
  "@type": "sh:NodeShape",
  "targetClass": "pplan:Variable",
  "property": [ 
    {
      "path": "m:dataType",
      "class" : "rdfs:Datatype",
      "minCount":"1"
    }, 
    {
      "path": "m:varName",
      "datatype": "xsd:string",
      "minCount":"1"
    }
  ]
},    
{
  "@id" : "m:dataType",
  "@type" : "owl:ObjectProperty"
},    
{
  "@id": "m:varName",
  "@type": "owl:DatatypeProperty"
}

我正在尝试验证以下数据:

{
    "@id" : "ex:bp_var",
    "@type" : "pplan:Variable",
    "m:dataType" : "xsd:decimal",
    "m:varName" : "blood_pressure"
}

根据模式验证此数据returns 违规报告类似于:

a sh:ValidationResult ;
sh:resultSeverity sh:Violation ;
…
sh:value xsd:decimal ;
sh:resultPath <http://.../m#dataType> ;
sh:resultMessage "Value does not have class rdfs:Datatype" ;

我是否应该明确指定 'xsd:decimal is of type rdfs:Datatype' 才能成功验证我的数据?

来自1.5 Relationship between SHACL and RDFS inferencing

SHACL uses the RDF and RDFS vocabularies, but full RDFS inferencing is not required. However, SHACL processors MAY operate on RDF graphs that include entailments [sparql11-entailment] – either pre-computed before being submitted to a SHACL processor or performed on the fly as part of SHACL processing (without modifying either data graph or shapes graph). To support processing of entailments, SHACL includes the property sh:entailment to indicate what inferencing is required by a given shapes graph.

The values of the property sh:entailment are IRIs. Common values for this property are covered by [sparql11-entailment].

因此,只需添加以下三元组(在 Turtle 语法中):

m:VariableShape  sh:entailment  <http://www.w3.org/ns/entailment/RDFS>

Indeed,

When using RDFS semantics, the referents of all recognized datatype IRIs can be considered to be in the class rdfs:Datatype.

这在 TopBraid Composer 中对我有用。