在Turtle-RDF中,省略字符串文字的數據類型擴展^^xsd:string
是方便的。但是當我嘗試做StarDog,http://www.stardog.com/推理,只有個別:YYY
擴展名爲"green"^^xsd:string
被發現是一個:GreenButton
文字的推理和數據類型
@prefix : <http://stackoverflow.com/q/29075078/1281433#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
:color a owl:DatatypeProperty ;
rdfs:range xsd:string ;
rdfs:domain :Button .
:XXX :color "green" .
:YYY :color "green"^^xsd:string .
:Button a rdfs:Class .
:GreenButton a rdfs:Class ;
owl:equivalentClass [ a owl:Restriction;
owl:onProperty :color ;
owl:hasValue "green"
] .
:TestButton a :GreenButton .
推理結果:
+-------------+----------+----------------------------------------------------+
| s | p | o |
+-------------+----------+----------------------------------------------------+
| :XXX | rdf:type | :Button |
| :YYY | rdf:type | :Button |
| :YYY | rdf:type | :GreenButton |
| :TestButton | rdf:type | :GreenButton |
| :TestButton | :color | "green"^^<http://www.w3.org/2001/XMLSchema#string> |
...
什麼是應對的最佳方式用它?
**「在Turtle-RDF中,省略字符串文字的數據類型擴展^^ xsd:string是很方便的。」**請注意,在原始的RDF中,有普通文字(沒有數據類型或語言標籤)以及數據類型文字。純文字「綠色」不同於數據類型文字「綠色」^^ xsd:string。然而,在RDF 1.1中,所有文字都有一個數據類型,「綠色」只是「綠色」^^ xsd:string的簡寫。我不確定這是否是這個問題,但它可能是相關的。 「綠色」不一定是「綠色」^^ xsd:字符串。 –
@Jushua:是的,我注意到了。但是,另一方面,類的定義中的簡單文字「綠色」:GreenButton實際上被推理者翻譯爲「綠色」^^或數據導入或任何..? –
rmv