ColinMaudry / sparql-router

Application to turn SPARQL queries into APIs and use them in a simple Web app (Express + Vue)
http://queery.link
MIT License
9 stars 4 forks source link

With Stardog, query details can't be read #101

Open ColinMaudry opened 7 years ago

ColinMaudry commented 7 years ago

Stardog returns the query metadata in a @graph JSON-LD object:

[ {
  "@graph" : [ {
    "@id" : "uri:sparql-router:test:tables:test2",
    "@type" : [ "https://github.com/ColinMaudry/sparql-router#TestQuery", "https://github.com/ColinMaudry/sparql-router#TablesQuery" ],
    "http://purl.org/dc/terms/author" : [ {
      "@value" : "Colin Maudry"
    } ],
    "http://purl.org/dc/terms/identifier" : [ {
      "@value" : "test2"
    } ],
    "http://www.w3.org/2000/01/rdf-schema#label" : [ {
      "@value" : "Test2"
    } ],
    "https://github.com/ColinMaudry/sparql-router#endpoint" : [ {
      "@id" : "http://queery.link:3030/test/sparql"
    } ]
  } ],
  "@id" : "uri:graph:sparql-router:queries"
} ]

while Fuseki, the triplestore used for development, returns the query metadata directly in the root object:

{
  "@id" : "uri:sparql-router:test:tables:test2",
  "@type" : [ "router:TestQuery", "router:TablesQuery" ],
  "author" : "Colin Maudry",
  "identifier" : "test2",
  "label" : "Test2",
  "endpoint" : "http://queery.link:3030/test/sparql",
  "@context" : {
    "endpoint" : {
      "@id" : "https://github.com/ColinMaudry/sparql-router#endpoint",
      "@type" : "@id"
    },
    "label" : {
      "@id" : "http://www.w3.org/2000/01/rdf-schema#label"
    },
    "author" : {
      "@id" : "http://purl.org/dc/terms/author"
    },
    "identifier" : {
      "@id" : "http://purl.org/dc/terms/identifier"
    },
    "router" : "https://github.com/ColinMaudry/sparql-router#",
    "dct" : "http://purl.org/dc/terms/",
    "rdfs" : "http://www.w3.org/2000/01/rdf-schema#"
  }
}

Solution: detect possible @graph object and adapt paths.

ColinMaudry commented 7 years ago

Actually, the two structures are semantically identical, but JSONly completely different.... I need a JSON-LD parser or something like that.