ConceptioArchiveW3C TR
W3C TRopen access

sparql11 results json

W3C · w3c_tr
W3C TR · Standards · License: Open Access
Open Source ↗
w3c, standard

SPARQL 1.1 Query Results JSON Format @import url("local.css");

code { font-family: monospace; }

div.constraint, div.issue, div.note, div.notice { margin-left: 2em; }

ol.enumar { list-style-type: decimal; } ol.enumla { list-style-type: lower-alpha; } ol.enumlr { list-style-type: lower-roman; } ol.enumua { list-style-type: upper-alpha; } ol.enumur { list-style-type: upper-roman; }

div.exampleInner pre { margin-left: 1em; margin-top: 0em; margin-bottom: 0em} div.exampleOuter {border: 4px double gray; margin: 0em; padding: 0em} div.exampleInner { background-color: #d5dee3; border-top-width: 4px; border-top-style: double; border-top-color: #d3d3d3; border-bottom-width: 4px; border-bottom-style: double; border-bottom-color: #d3d3d3; padding: 4px; margin: 0em } div.exampleWrapper { margin: 4px } div.exampleHeader { font-weight: bold; margin: 4px}

em.rfc2119 { text-transform: lowercase; font-variant: small-caps; font-style: normal; } This version: http://www.w3.org/TR/2013/REC-sparql11-results-json-20130321/ Latest version: http://www.w3.org/TR/sparql11-results-json/ Previous version: http://www.w3.org/TR/2012/PR-sparql11-results-json-20121108/ Editor: Andy Seaborne, The Apache Software Foundation Previous Editors: Kendall Grant Clark, UMD Mindswap Lee Feigenbaum, IBM Elias Torres, IBM Please refer to the errata See also translations Copyright W3C ® MIT ERCIM Keio Beihang liability trademark document use SPARQL JSON May Be Superseded This section describes the status of this document at the time of its publication. Other documents may supersede this document. A list of current W3C publications and the latest revision of this technical report can be found in the W3C technical reports index Set of Documents This document is one of eleven SPARQL 1.1 Recommendations produced by the SPARQL Working Group SPARQL 1.1 Overview SPARQL 1.1 Query Language SPARQL 1.1 Update SPARQL1.1 Service Description SPARQL 1.1 Federated Query SPARQL 1.1 Query Results JSON Format SPARQL 1.1 Query Results CSV and TSV Formats SPARQL Query Results XML Format (Second Edition) SPARQL 1.1 Entailment Regimes SPARQL 1.1 Protocol SPARQL 1.1 Graph Store HTTP Protocol No Substantive Changes There have been no substantive changes to this document since the previous version change log color-coded diff Please Send Comments Please send any comments to [email protected] public archive SPARQL Working Group errata [email protected] public archive Endorsed By W3C This document has been reviewed by W3C Members, by software developers, and by other W3C groups and interested parties, and is endorsed by the Director as a W3C Recommendation. It is a stable document and may be used as reference material or cited from another document. W3C's role in making the Recommendation is to draw attention to the specification and to promote its widespread deployment. This enhances the functionality and interoperability of the Web. Patents This document was produced by a group operating under the 5 February 2004 W3C Patent Policy public list of any patent disclosures Essential Claim(s) section 6 of the W3C Patent Policy 1 Introduction JSON Results Object Variable Binding Results "head" "vars" "link" "results" "bindings" Encoding RDF terms Boolean Results "head" "link" "boolean" Example Internet Media Type, File Extension and Macintosh File Type A References Normative References Other References This document describes how to serialize SPARQL results (SELECT and ASK query forms) in a JSON An Internet Media Type is provied for application/sparql-results+json There is also a SPARQL Query Results XML Format SRX Unless otherwise noted in the section heading, all sections and appendices in this document are normative. The results of a SPARQL Query are serialized in JSON as a single top-level JSON object. This object has a "head" "results" "boolean" This example shows the results of a SELECT "bindings" "results" { "head": { "vars": [ "book" , "title" ] } , "results": { "bindings": [ { "book": { "type": "uri" , "value": "http://example.org/book/book6" } , "title": { "type": "literal" , "value": "Harry Potter and the Half-Blood Prince" } } , { "book": { "type": "uri" , "value": "http://example.org/book/book7" } , "title": { "type": "literal" , "value": "Harry Potter and the Deathly Hallows" } } , { "book": { "type": "uri" , "value": "http://example.org/book/book5" } , "title": { "type": "literal" , "value": "Harry Potter and the Order of the Phoenix" } } , { "book": { "type": "uri" , "value": "http://example.org/book/book4" } , "title": { "type": "literal" , "value": "Harry Potter and the Goblet of Fire" } } , { "book": { "type": "uri" , "value": "http://example.org/book/book2" } , "title": { "type": "literal" , "value": "Harry Potter and the Chamber of Secrets" } } , { "book": { "type": "uri" , "value": "http://example.org/book/book3" } , "title": { "type": "literal" , "value": "Harry Potter and the Prisoner Of Azkaban" } } , { "book": { "type": "uri" , "value": "http://example.org/book/book1" } , "title": { "type": "literal" , "value": "Harry Potter and the Philosopher's Stone" } } ] } } This example shows the result from an ASK { "head" : { } , "boolean" : true } Other keys, with different names, may be present in the JSON Results Object but are not defined by this specification. The results of a SPARQL SELECT "head" SELECT The "head" "link" { "head" { "vars" : [ ... ] , "link" : [ ... ] } The "vars" "vars" : [ "book" , "title" ] The order of variable names should correspond to the variables in the SELECT clause of the query, unless the query is of the form SELECT * The optional "link" "link" : [ "http://example/dataset/metadata.ttl" ] The value of the "results" "bindings" The value of the "bindings" encodes the variable's bound value, an RDF term. "bindings" "vars" A variable does not appear in an array element if it is not bound in that particular query solution. The order of elements in the bindings array reflects the order, if any, of the query solution sequence. "bindings" : [ { "a" : { ... } , "b" : { ... } } , { "a" : { ... } , "b" : { ... } } ] If the query returns no solutions, an empty array is used. "bindings" : [] An RDF term (IRI, literal or blank node) is encoded as a JSON object. All aspects of the RDF term are represented. The JSON object has a "type" RDF Term JSON form IRI I {"type": "uri", "value": " I Literal S {"type": "literal","value": " S Literal S L { "type": "literal", "value": " S L Literal S D { "type": "literal", "value": " S D Blank node, label B {"type": "bnode", "value": " B The blank node label is scoped to the results object. That is, two blank nodes with the same label in a single SPARQL Results JSON object are the same blank node. This is not an indication of any internal system identifier the SPARQL processor may use. Use of the same label in another SPARQL Results JSON object does not imply it is the same blank node. The results of a SPARQL ASK The "link" SELECT "link" The result of an ASK "boolean" true false "boolean" : true This section is not normative. The following JSON is a serialization of the XML document output.srx { "head": { "link": [ "http://www.w3.org/TR/rdf-sparql-XMLres/example.rq" ], "vars": [ "x", "hpage", "name", "mbox", "age", "blurb", "friend" ] }, "results": { "bindings": [ { "x" : { "type": "bnode", "value": "r1" },

"hpage" : { "type": "uri", "value": "http://work.example.org/alice/" },

"name" : { "type": "literal", "value": "Alice" } , "mbox" : { "type": "literal", "value": "" } ,

"blurb" : { "datatype": "http://www.w3.org/1999/02/22-rdf-syntax-ns#XMLLiteral", "type": "literal", "value": "<p xmlns=\"http://www.w3.org/1999/xhtml\">My name is <b>alice</b></p>" },

"friend" : { "type": "bnode", "value": "r2" } }, { "x" : { "type": "bnode", "value": "r2" }, "hpage" : { "type": "uri", "value": "http://work.example.org/bob/" }, "name" : { "type": "literal", "value": "Bob", "xml:lang": "en" },

"mbox" : { "type": "uri", "value": "mailto:[email protected]" },

"friend" : { "type": "bnode", "value": "r1" } } ] } } The Internet Media Type / MIME Type for the SPARQL Query Results JSON Format is "application/sparql-results+json". It is recommended that SPARQL Query Results JSON Format files have the extension ".srj" (all lowercase) on all platforms. It is recommended that SPARQL Query Results JSON Format files stored on Macintosh HFS file systems be given a file type of "TEXT". This information that follows is intended to be submitted to the IESG for review, approval, and registration with IANA. Type name: application Subtype name: sparql-results+json Required parameters: None Optional parameters: None Encoding considerations: The encoding considerations of the SPARQL Query Results JSON Format is identical to those of the "application/json" as specified in [ JSON-RFC Security considerations: SPARQL query results uses URIs. See Section 7 of [ RFC3986 RFC3987 JSON-RFC Interoperability considerations: There are no known interoperability issues. Published specification: http://www.w3.org/TR/sparql11-results-json/ Applications which use this media type: No known applications currently use this media type. Additional information: Magic number(s): n/a File extension(s): ".srj" Macintosh file type code(s): "TEXT" Person & email address to contact for further information: Andy Seaborne <[email protected]> Intended usage: COMMON Restrictions on usage: None Author/Change controller: The SPARQL specification is a work product of the World Wide Web Consortium's SPARQL Working Group. The W3C has change control over these specifications. [JSON-RFC] RFC 4627 http://www.ietf.org/rfc/rfc4627.txt [RFC3986] RFC 3986 http://www.ietf.org/rfc/rfc3986.txt [RFC3987] RFC 3987 http://www.ietf.org/rfc/rfc3987.txt [SRX] SPARQL Query Results XML Format (Second Edition) Latest version Change Log Changes since Proposed Recommendation None Changes since Last Call Fix typo in example. Update references

Related documents

Record · ID 19477 · SHA-256 837e8b89f61e70be
Conceptio Open Knowledge Archive — every document is proof-bundled with source, license, and retrieval metadata.