我假设没有任何数据类型与作为数据类型隐含相同xsd:string
,但是 SHACL 给了我一个验证错误。我的假设是错误的还是 SHACL 没有涵盖?在后一种情况下,我如何验证数据类型是空的还是 xsd:string?
字符串.ttl
@prefix xsd: <http://www.w3.org/2001/XMLSchema#>.
<message> <title> "Hello World"@en.
shacl.ttl
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#>.
@prefix sh:<http://www.w3.org/ns/shacl#> .
:TitleShape rdf:type sh:NodeShape;
sh:targetObjectsOf <title>;
sh:datatype xsd:string;
sh:closed true.
错误
$ pyshacl string.ttl -s shacl.ttl
Validation Report
Conforms: False
Results (1):
Constraint Violation in DatatypeConstraintComponent (http://www.w3.org/ns/shacl#DatatypeConstraintComponent):
Severity: sh:Violation
Source Shape: :TitleShape
Focus Node: Literal("Hello World", lang=en)
Value Node: Literal("Hello World", lang=en)
Message: Value is not Literal with datatype xsd:string