[英]Why this SHACL validation does not work as expected?
Here is my shacl.ttl:这是我的 shacl.ttl:
@prefix ex: <http://datashapes.org/sh/tests/core/path/path-sequence-003.test#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix sh: <http://www.w3.org/ns/shacl#> .
ex:paintNodeShape
rdf:type sh:NodeShape ;
sh:property ex:ColorProperty ;
sh:targetNode ex:John .
ex:ColorProperty
rdf:type sh:PropertyShape ;
sh:qualifiedValueShape [
sh:path (ex:paint ex:ballColor ) ;
sh:hasValue "Red" ;
] ;
sh:qualifiedMinCount 2 .
and here is data.ttl:这是 data.ttl:
@prefix ex: <http://datashapes.org/sh/tests/core/path/path-sequence-003.test#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix sh: <http://www.w3.org/ns/shacl#> .
ex:John
ex:paint [ ex:ballColor "Red"] ;
ex:paint [ ex:ballColor "Red"] ;
ex:paint [ ex:ballColor "Blue"] .
I want to verify that John painted at least two balls red, and the data given should meet the requirements.我想验证约翰至少把两个球涂成红色,给出的数据应该符合要求。 But I got an error message: "Less than 2 values have shape _:22728aa9248d56603d8c20009b9d6742" .
但我收到一条错误消息:“小于 2 个值的形状为 _:22728aa9248d56603d8c20009b9d6742”。 Is there something wrong with my sequence path?
我的序列路径有问题吗? Thanks a lot for your help!
非常感谢你的帮助!
Your shape definition is a bit different from how the SHACL examples for sh:qualifiedValueShape
go.您的形状定义与
sh:qualifiedValueShape
的 SHACL 示例的方式略有不同。 I believe the property shape might need sh:path ex:paint
to really match the property, like this:我相信属性形状可能需要
sh:path ex:paint
才能真正匹配属性,如下所示:
ex:ColorProperty
rdf:type sh:PropertyShape ;
sh:path ex:paint ;
sh:qualifiedValueShape [
sh:path ex:ballColor ;
sh:hasValue "Red" ;
] ;
sh:qualifiedMinCount 2 .
This should represent a shape for the values of the ex:paint
property.这应该代表
ex:paint
属性值的形状。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.