VALUES equivalent to SPARQL results format?

Hi,

I was thinking whether the VALUES syntax can be considered equivalent
to SPARQL results?
Which would mean that the SPARQL result media types can be used to
provide data to be injected into a query as VALUES?

My use case is implementing named parameterized SPARQL queries as
described here:
https://patterns.dataincubator.org/book/parameterised-query.html
Such a query gets deployed as an HTTP endpoint, for example
http://example.org/sparql/concepts_by_scheme

Multi-column value data is inconvenient to pass using URL parameters
in a GET request.
So another option would be to POST that data to the endpoint, but in
what format?
It's tabular data with RDF terms, and as far as I can see it can be
round-tripped to SPARQL results formats.
Can someone confirm this makes sense? Or maybe this is commonly used already :)

Example:

POST http://example.org/sparql/concepts_by_scheme
Content-Type: application/sparql-results+json

{
  "head": { "vars": [ "concept_scheme", "graph_uri" ]
  } ,
  "results": {
    "bindings": [
      {
        "concept_scheme": { "type": "uri" , "value":
"http://example.org/schemes/42" } ,
        "graph_uri": { "type": "uri" , "value": "http://example.org/graphs/42" }
      } ,
      {
        "concept_scheme": { "type": "uri" , "value":
"http://example.org/schemes/66" } ,
        "graph_uri": { "type": "uri" , "value": "http://example.org/graphs/66" }
      }
    ]
  }
}

becomes

VALUES (?concept_scheme ?graph_uri) {
  (<http://example.org/schemes/42> <http://example.org/graphs/42>)
  (<http://example.org/schemes/66> <http://example.org/graphs/66>)
}


Martynas

Received on Thursday, 3 October 2024 20:14:33 UTC