Exposed Except (alias Difference) operator in Gremlin API.
This commit is contained in:
parent
5d4e22498d
commit
def70ca12e
2 changed files with 14 additions and 8 deletions
|
|
@ -299,14 +299,19 @@ func buildIteratorTreeHelper(obj *otto.Object, ts graph.TripleStore, base graph.
|
||||||
case "in":
|
case "in":
|
||||||
it = buildInOutIterator(obj, ts, subIt, true)
|
it = buildInOutIterator(obj, ts, subIt, true)
|
||||||
case "not":
|
case "not":
|
||||||
// arg, _ := obj.Get("_gremlin_values")
|
arg, _ := obj.Get("_gremlin_values")
|
||||||
// firstArg, _ := arg.Object().Get("0")
|
firstArg, _ := arg.Object().Get("0")
|
||||||
// if !isVertexChain(firstArg.Object()) {
|
if !isVertexChain(firstArg.Object()) {
|
||||||
// return iterator.NewNull()
|
return iterator.NewNull()
|
||||||
// }
|
}
|
||||||
// forbiddenIt := buildIteratorTree(firstArg.Object(), ts)
|
|
||||||
|
|
||||||
it = iterator.NewNot(ts, subIt)
|
toComplementIt := buildIteratorTree(firstArg.Object(), ts)
|
||||||
|
notIt := iterator.NewNot(ts, toComplementIt)
|
||||||
|
|
||||||
|
and := iterator.NewAnd()
|
||||||
|
and.AddSubIterator(subIt)
|
||||||
|
and.AddSubIterator(notIt)
|
||||||
|
it = and
|
||||||
case "loop":
|
case "loop":
|
||||||
arg, _ := obj.Get("_gremlin_values")
|
arg, _ := obj.Get("_gremlin_values")
|
||||||
firstArg, _ := arg.Object().Get("0")
|
firstArg, _ := arg.Object().Get("0")
|
||||||
|
|
|
||||||
|
|
@ -39,7 +39,8 @@ func (wk *worker) embedTraversals(env *otto.Otto, obj *otto.Object) {
|
||||||
obj.Set("Save", wk.gremlinFunc("save", obj, env))
|
obj.Set("Save", wk.gremlinFunc("save", obj, env))
|
||||||
obj.Set("SaveR", wk.gremlinFunc("saver", obj, env))
|
obj.Set("SaveR", wk.gremlinFunc("saver", obj, env))
|
||||||
obj.Set("Loop", wk.gremlinFunc("loop", obj, env))
|
obj.Set("Loop", wk.gremlinFunc("loop", obj, env))
|
||||||
obj.Set("Not", wk.gremlinFunc("not", obj, env))
|
obj.Set("Except", wk.gremlinFunc("not", obj, env))
|
||||||
|
obj.Set("Difference", wk.gremlinFunc("not", obj, env))
|
||||||
}
|
}
|
||||||
|
|
||||||
func (wk *worker) gremlinFunc(kind string, prev *otto.Object, env *otto.Otto) func(otto.FunctionCall) otto.Value {
|
func (wk *worker) gremlinFunc(kind string, prev *otto.Object, env *otto.Otto) func(otto.FunctionCall) otto.Value {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue