antoniogarrote / rdfstore-js

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

SPARQL parser cannot handle escaped backslashes #55

Open bollwyvl opened 11 years ago

bollwyvl commented 11 years ago

After figuring out my workaround for #54, I encountered new problems with string escaping.

Consider this triple, stored in a text file:

<http://foo> <http://bar> "b\\a\\z" .

loaded like this:

var triple;
$.get("sample.n3", function(txt){ triple = txt });

then added to a store like this:

store.load('text/turtle', triple, function(){})

and can be retrieved like this:.

store.execute(
  'SELECT * WHERE {<http://foo> <http://bar> ?o}',
  function(e, rows){console.log(rows[0].o.value)}
)
">> b\a\z"

There is no way whatsoever to delete this data with SPAR*L:

store.execute('DELETE DATA {' + triple + '}', function(){})
// SyntaxError: Expected [2] Query or [30] Update but "D" found."

I currently have no workaround for this, other than replacing all of the users' \ with /, which is not really acceptable, but good enough to to go forward with.

l00mi commented 11 years ago

Experiencing the same, even if using store.delete(graph) only with rdfstore-js generated SPARQL queries.