我有一个包含所有相关文件的要点:https://gist.github.com/James-Hudson3010/2588d9b17dd33e15922122b8b5cf1bd7
如果我执行:
$ pyshacl -a -f human employees.ttl我得到以下正确的验证报告..。
Validation Report
Conforms: False
Results (3):
Constraint Violation in MaxInclusiveConstraintComponent (http://www.w3.org/ns/shacl#MaxInclusiveConstraintComponent):
Severity: sh:Violation
Source Shape: hr:jobGradeShape
Focus Node: d:e4
Value Node: Literal("8", datatype=xsd:integer)
Result Path: hr:jobGrade
Constraint Violation in DatatypeConstraintComponent (http://www.w3.org/ns/shacl#DatatypeConstraintComponent):
Severity: sh:Violation
Source Shape: hr:jobGradeShape
Focus Node: d:e3
Value Node: Literal("3.14", datatype=xsd:decimal)
Result Path: hr:jobGrade
Constraint Violation in MinCountConstraintComponent (http://www.w3.org/ns/shacl#MinCountConstraintComponent):
Severity: sh:Violation
Source Shape: hr:jobGradeShape
Focus Node: d:e2
Result Path: hr:jobGrade但是,如果我将employees.ttl分成三个包含模式、形状和实例数据的文件,然后运行:
pyshacl -s shape.ttl -e schema.ttl -a -f human instance.ttl结果是:
Validation Report
Conforms: True我想我的名字是对的。
发布于 2020-04-01 12:59:04
当您使用单个文件时,pySHACL无法知道将您的形状文件的hr:Employee NodeShape与什么相关联。它似乎知道它什么时候在那个文件中(也许它运行在文件中的所有类上??)。
所以:
将雇员形状重命名为不重载hr:EmployeeShape
sh:targetClass指令:hr:EmployeeShape
a sh:NodeShape ;
sh:targetClass hr:Employee ;
sh:property hr:nameShape ;
sh:property hr:jobGradeShape .然后,多文件调用提供与单个文件调用相同的结果。
你打给pySHACL的电话是正确的!
https://stackoverflow.com/questions/60970583
复制相似问题