首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >pySHACL:未能报告验证错误

pySHACL:未能报告验证错误
EN

Stack Overflow用户
提问于 2020-04-01 12:10:22
回答 1查看 117关注 0票数 1

我有一个包含所有相关文件的要点:https://gist.github.com/James-Hudson3010/2588d9b17dd33e15922122b8b5cf1bd7

如果我执行:

代码语言:javascript
复制
$ pyshacl -a -f human employees.ttl

我得到以下正确的验证报告..。

代码语言:javascript
复制
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分成三个包含模式、形状和实例数据的文件,然后运行:

代码语言:javascript
复制
pyshacl -s shape.ttl -e schema.ttl -a -f human instance.ttl

结果是:

代码语言:javascript
复制
Validation Report
Conforms: True

我想我的名字是对的。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2020-04-01 12:59:04

当您使用单个文件时,pySHACL无法知道将您的形状文件的hr:Employee NodeShape与什么相关联。它似乎知道它什么时候在那个文件中(也许它运行在文件中的所有类上??)。

所以:

将雇员形状重命名为不重载hr:EmployeeShape

  • add类名:
  1. ,返回sh:targetClass指令:

代码语言:javascript
复制
hr:EmployeeShape
   a sh:NodeShape ;
   sh:targetClass hr:Employee ;
   sh:property hr:nameShape ;
   sh:property hr:jobGradeShape .

然后,多文件调用提供与单个文件调用相同的结果。

你打给pySHACL的电话是正确的!

票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/60970583

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档