开发者

Sparql Query Format

开发者 https://www.devze.com 2023-02-25 13:48 出处:网络
i am getting the 开发者_开发知识库 results of a query as sodium^^http://www.w3.org/2001/xmlschema/string

i am getting the 开发者_开发知识库 results of a query as

sodium^^http://www.w3.org/2001/xmlschema/string

What format is it ?


It looks to me like you've called toString() on a literal (maybe just by printing it). RDF nodes in your results might be resources (either unlabelled or with a URI), or a literal. Literals are structured things in general, consisting of a lexical form and (optionally) a datatype or language. There's a convention from summarising these complex objects in strings, which you've found here.

For example:

// a plain literal, no datatype, no language
"Sodium"

// typed literal, lexical form "Sodium", datatype xsd:string
"Sodium"^^<http://www.w3.org/2001/xmlschema/string>

// lexical form "Sodium", language "en"
"Sodium"@en 

If you're using jena try getLexicalForm() on the literal. xsd:string is a pretty annoying type.


In Rdf this is the way to indicate the data type of a literal. For instance cardinality will be represented as

rdf:datatype="http://www.w3.org/2001/XMLSchema#int

The result says literal "Sodium" of type string.

0

精彩评论

暂无评论...
验证码 换一张
取 消