Add Gremlin "Except" and "Retain" filtering methods


#1

Along with requisite “Aggregate” method as described here:

This’ll allow much better query support and output.


These sound pretty straightforward – it’d be interesting to try to build the tree, however.

A “Not” iterator seems reasonable here to make Except happen. It’s a little like optional in that it shouldn’t be nexted (or, if it is, it’s expensive) and is defined as an (All minus (whatever subiterator))

The more we can delay evaluation, the better we could (potentially) optimize things. Worth keeping in mind at least – it doesn’t have to do that today.


Yeah my initial thinking is that “aggregate” basically populates a FixedIterator, and then that can be used for the checks. I’d also want to create a special-case FixedIterator which uses a map[Value] to make sure Check()s are fast vs the current slice-backed implementation.

Although that means Values might need a consistent hash representation…


Or at least that they have a reasonable Hash function, ie, changing graph.TSVal from an interface{} to, well, an actual interface.


An alternative to enforcing a Hash implementation is to conditionally type assert and use the Hash method if it exists or fall back to hashing the value otherwise. On the downside, this would be somewhat slower and is a little magical (would need to be documented).

Or at least that they have a reasonable Hash function, ie, changing graph.TSVal from an interface{} to, well, an actual interface.


From: https://github.com/cayleygraph/cayley/issues/74


#2

So we are actively looking at this for a security pattern. Our users will not have access to certain quads based on a label we put with it. Without a filter like mentioned above we have t do post processing when we render our D3. Not sure if that is the ideal method to post process or filter in the actual query.

Is there any traction on this?


#3

We love contributions! Sadly when it moved from a ticket to this area, that is because it was de-prioritized. This is a super-nice-to-have feature, just not high priority right now.