Documentation for JSON / binary query result format extensions for edge properties

Hi there,

In the Stardog documentation it is mentioned that Stardog supports SELECT query results involving edge properties:

SPARQL SELECT query results with edge properties can be sent over in the XML, binary, and JSON format (content types application/sparql-results+xml , application/x-binary-rdf-results-table , and application/sparql-results+json , respectively).

Is there any documentation available or do you have any examples of how you extended these syntax formats to deal with edge property bindings?

Hi Jeen,

We don't have documentation about these details but let me briefly describe them here with some examples.

For XML and JSON, we introduced an additional statement value type with required s, p, o fields and an optional g field. Binding a variable x to a statement would look like this in JSON:

{
        "p": {
          "type": "uri",
          "value": "http://api.stardog.com/date"
        },
        "s": {
          "type": "statement",
          "s": {
            "type": "uri",
            "value": "http://api.stardog.com/Alice"
          },
          "p": {
            "type": "uri",
            "value": "http://api.stardog.com/knows"
          },
          "o": {
            "type": "uri",
            "value": "http://api.stardog.com/Bob"
          }
        },

and like this in XML:

<binding name='x'>
    <statement>
        <s>
            <uri>http://api.stardog.com/Alice</uri>
        </s>
        <p>
            <uri>http://api.stardog.com/knows</uri>
        </p>
        <o>
            <uri>http://api.stardog.com/Bob</uri>
        </o>
    </statement>
</binding>

For the binary results, there is an additional STATEMENT_RECORD_MARKER = 10 to indicate the RDF value is a statement. SPO components are serialized without any markers between them followed by either a DEFAULT_GRAPH_RECORD_MARKER = 1 or NAMED_GRAPH_RECORD_MARKER = 2(latter is followed by an RDF resource).

Best,
Evren

Thanks so much Evren, exactly what I needed!

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.