Open martinleopold opened 8 years ago
this is now implemented in a basic way as:
.where(new SPH.Triple('?x', ['foaf:name ?name', 'foaf:mbox ?mbox']));
and
.where(new SPH.Triple('?x foaf:nick', ['"Alice"', '"Alice_"']));
still need to think about the whole string parsing. for now i am inclined to only use the classes in the constructors:
var pattern = new SPH.GraphPattern([
new SPH.Triple('?x foo:bar ?name'),
new SPH.Triple('?x foaf:nick', ['"Alice"', '"Alice_"']),
new SPH.Filter('... some filter clause ...')
]);
query.where(pattern);
the whole string-parsing alternative stuff is nice, but i think an oo-structure that provides basic validation and then converts into a sparql query string is more important. a proper string parser could follow and then be used in the class constructor methods.
The predicate-object list (http://www.w3.org/TR/rdf-sparql-query/#predObjLists)
might be written as
The object list (http://www.w3.org/TR/rdf-sparql-query/#objLists)
might be written as
So basically the syntax for the two cases is the same:
To separate the two cases one might test the first argument (the string) for whitespace.