我假設沒有任何資料型別與作為資料型別隱含相同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
uj5u.com熱心網友回復:
在您的示例中,資料包含一個 rdf:langString 文字,它與 xsd:string 的資料型別不同 - 您會看到 @en 語言標記。您可能指的是以下內容等價的事實:“Hello World”和“Hello World”^^xsd:string。所以上面的 pyshacl 結果對我來說是正確的。
轉載請註明出處,本文鏈接:https://www.uj5u.com/qianduan/410765.html
標籤:
下一篇:多次呼叫子字串
