Expose LabelContext in gremlin
This commit is contained in:
parent
36d0f48d15
commit
283aca83c2
5 changed files with 28 additions and 4 deletions
|
|
@ -163,6 +163,12 @@ func buildPathFromObject(obj *otto.Object) *path.Path {
|
|||
return p.InPredicates()
|
||||
case "OutPredicates":
|
||||
return p.OutPredicates()
|
||||
case "LabelContext":
|
||||
labels, tags, ok := getViaData(obj)
|
||||
if !ok {
|
||||
return nil
|
||||
}
|
||||
return p.LabelContextWithTags(tags, labels...)
|
||||
default:
|
||||
panic(fmt.Sprint("Unimplemented Gremlin function", gremlinType))
|
||||
}
|
||||
|
|
|
|||
|
|
@ -278,6 +278,13 @@ var testQueries = []struct {
|
|||
`,
|
||||
expect: []string{"are", "follows", "status"},
|
||||
},
|
||||
{
|
||||
message: "traverse using LabelContext",
|
||||
query: `
|
||||
g.V("greg").LabelContext("smart_graph").Out("status").All()
|
||||
`,
|
||||
expect: []string{"smart_person"},
|
||||
},
|
||||
}
|
||||
|
||||
func runQueryGetTag(g []quad.Quad, query string, tag string) []string {
|
||||
|
|
|
|||
|
|
@ -42,6 +42,7 @@ var traversals = []string{
|
|||
"Difference",
|
||||
"InPredicates",
|
||||
"OutPredicates",
|
||||
"LabelContext",
|
||||
}
|
||||
|
||||
func (wk *worker) embedTraversals(env *otto.Otto, obj *otto.Object) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue