Open martinleopold opened 8 years ago
optional and union were already in the code. currently they work as follows:
let pattern1 = new GraphPattern(triple1),
pattern2 = new GraphPattern([triple1, triple2], false, true), // second option sets UNION flag
group = new GroupGraphPattern([pattern1, pattern2]);
and
let pattern1 = new GraphPattern(triple1),
pattern2 = new GraphPattern([triple1, triple2], true, false), // first option sets OPTIONAL flag
group = new GroupGraphPattern([pattern1, pattern2]);
not sure if this is the best way to represent it and i don't like the options in the constructor that much. i might update it to work like this:
let group = new GroupGraphPattern({
$union: [pattern1, pattern2]
});
but first the subqueries... do you know if multiple subqueries are allowed? i couldn't really tell from the spec or i overlooked something.
subqueries are now also included. you can just add a query as an element to a graph pattern. the endpoint can be null for this subquery (it is ignored so set it to whatever you want). prefixes and base are skipped when converting the subquery to string.
var pattern = new GraphPattern([triple1, triple2, query]);
Here's some more features from the SQARQL spec that might be implemented: