antoniogarrote / rdfstore-js

JS RDF store with SPARQL support
MIT License
563 stars 109 forks source link

Support SPARQL inline literals / blank nodes #141

Open kiritsuku opened 8 years ago

kiritsuku commented 8 years ago
Bundle.rdfstore.create(function(err, store) {
  store.load("text/n3", "<#s> <#p> <#o> . <#o> <#a> <#p1> . <#o> <#b> <#p2> .", function(err, loadedTriples) {
    store.execute("select * where { ?s ?p ?o . ?o <#a> ?a ; <#b> ?b . }", function(err, graph) {
      console.log(err);
      console.log(graph);
    })
  })
})

However, the following SPARQL query, where ?o is inlined, produces an error:

Bundle.rdfstore.create(function(err, store) {
  store.load("text/n3", "<#s> <#p> <#o> . <#o> <#a> <#p1> . <#o> <#b> <#p2> .", function(err, loadedTriples) {
    store.execute("select * where { ?s ?p [<#a> ?a ; <#b> ?b] . }", function(err, graph) {
      console.log(err);
      console.log(graph);
    })
  })
})

The error is super ugly:

TypeError: callback is not a function

If this syntax is not supported, it should at least show a better error message.