json-ld.org icon indicating copy to clipboard operation
json-ld.org copied to clipboard

JSON-LD Query

Open gsvarovsky opened this issue 9 years ago • 0 comments

It would be possible to provide a query capability using a syntax related to JSON-LD. This has been discussed on the mailing list recently and in the past (with other allusions here and here).

Such a capability could relate to SPARQL in an analogous way to the relationship between JSON-LD and N-Triples. A direct transform has been prototyped (incompletely). As an example:

{
  "@context": {"dbpedia-owl": "http://dbpedia.org/ontology/"},
  "@select": ["?p", "?c"],
  "@where": {
    "@id": "?p",
    "@type": "dbpedia-owl:Artist",
    "dbpedia-owl:birthPlace": {
      "@id": "?c",
      "http://xmlns.com/foaf/0.1/name": {"@language": "en", "@value": "York"}
    }
  }
}

Translates to/from:

PREFIX dbpedia-owl: <http://dbpedia.org/ontology/>
SELECT ?p ?c WHERE {
    ?p a dbpedia-owl:Artist.
    ?p dbpedia-owl:birthPlace ?c.
    ?c <http://xmlns.com/foaf/0.1/name> "York"@en.
}

Alternatively the capability could be based on other query languages such as GraphQL.

The relationship between this concept and Framing would need to be clarified, but at present the consensus is that they should be separate.

This concept is also mentioned in #433, in particular in https://github.com/json-ld/json-ld.org/issues/433#issuecomment-255308381.

gsvarovsky avatar Nov 05 '16 10:11 gsvarovsky