antoniogarrote / rdfstore-js

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

internal error in parser for IRI function args #131

Closed cie closed 8 years ago

cie commented 8 years ago

Hi! There occurs a TypeError: Cannot read property 'value' of null in the parser when I parse the following query:

const rdfstore = require("rdfstore")
rdfstore.create(function(err, store) {
    store.execute("SELECT * {FILTER ab:cd(x:y)}")
})

However, this works correctly (it gives a normal syntax error):

const rdfstore = require("rdfstore")
rdfstore.create(function(err, store) {
    store.execute("SELECT * {FILTER ab:cd(3)}")
})

It also works for "asdf", x:y(10) as the argument but not for <asdf>.

I noticed that if I change a line in parser.js, it fixes the problem:

      { type: "other", description: "[117] IRIrefOrFunction" },
      function(i, args) {
          var fcall = {};
      fcall.token = "expression";
      fcall.expressionType = 'irireforfunction';
      fcall.iriref = i;
      fcall.args = args.value;

      return fcall;
      },

I changed args.value to args && args.value.