antoniogarrote / rdfstore-js

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

Unable to query a local rdf file which contains filter expression #140

Closed lavdim closed 8 years ago

lavdim commented 8 years ago

Hi,

I am trying to query an local rdf file in turtle format with Sparql query which contains also Filter expression, but once I use the FILTER(?s=), an error with the message "[TypeError: Cannot read property 'map' of null] " is appeared.

This error seems to be connected with #133 , but even this fix, still it is not working.

The complete code is:

var rdfstore = require('rdfstore'), fs = require('fs');

rdfstore.create(function(err,store){ var rdf = fs.readFileSync('fileName.ttl').toString();

store.load('text/turtle', rdf, function(s,d){

var query = `SELECT ?s ?p ?o WHERE { 
                    ?s ?p ?o. 
             FILTER (?s=<someResource>) 
             } `;

store.execute(query, function(success, results){
  console.log(success, results);
});

}); console.log(err); });