简体   繁体   中英

Sparql Query Format

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM