Re: VALUES equivalent to SPARQL results format?

good evening;

to just go ahead and use the values syntax is a viable option.

    https://github.com/dydra/http-api-tests/blob/master/extensions/sparql-protocol/values/inline-query.sh
    https://github.com/dydra/http-api-tests/blob/master/extensions/sparql-protocol/values/inline-query-multiple.sh

these examples use application/x-www-form-urlencoded, but the arguments could be inline in the url.

> On 3. Oct 2024, at 22:14, Martynas Jusevičius <martynas@atomgraph.com> wrote:
> 
> 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
> 

---
james anderson | james@dydra.com | https://dydra.com

Received on Thursday, 3 October 2024 20:28:23 UTC