Skip to content

Instantly share code, notes, and snippets.

@digal
Created June 26, 2014 11:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save digal/4770f1a0783c8022e331 to your computer and use it in GitHub Desktop.
Save digal/4770f1a0783c8022e331 to your computer and use it in GitHub Desktop.
Cayley tagging
//src
var filmToActor = g.Morphism().Out("/film/film/starring").Out("/film/performance/actor")
g.V().Has("name", "Casablanca").Save("name", "source").Follow(filmToActor).Tag("target").All()
//Output (note the different "source" values in first and remaining records):
{
"result": [
{
"id": ":/en/humphrey_bogart",
"source": "Casablanca",
"target": ":/en/humphrey_bogart"
},
{
"id": ":/en/ingrid_bergman",
"source": "/film/film",
"target": ":/en/ingrid_bergman"
},
{
"id": ":/en/paul_henreid",
"source": "/film/film",
"target": ":/en/paul_henreid"
},
{
"id": ":/en/claude_rains",
"source": "/film/film",
"target": ":/en/claude_rains"
},
{
"id": ":/en/conrad_veidt",
"source": "/film/film",
"target": ":/en/conrad_veidt"
},
{
"id": ":/en/sydney_greenstreet",
"source": "/film/film",
"target": ":/en/sydney_greenstreet"
},
{
"id": ":/en/peter_lorre",
"source": "/film/film",
"target": ":/en/peter_lorre"
},
{
"id": ":/en/s_z_sakall",
"source": "/film/film",
"target": ":/en/s_z_sakall"
},
{
"id": ":/en/madeleine_lebeau",
"source": "/film/film",
"target": ":/en/madeleine_lebeau"
},
{
"id": ":/en/dooley_wilson",
"source": "/film/film",
"target": ":/en/dooley_wilson"
},
{
"id": ":/en/joy_page",
"source": "/film/film",
"target": ":/en/joy_page"
},
{
"id": ":/en/john_qualen",
"source": "/film/film",
"target": ":/en/john_qualen"
},
{
"id": ":/en/leonid_kinskey",
"source": "/film/film",
"target": ":/en/leonid_kinskey"
},
{
"id": ":/en/helmut_dantine",
"source": "/film/film",
"target": ":/en/helmut_dantine"
},
{
"id": ":/en/lou_marcelle",
"source": "/film/film",
"target": ":/en/lou_marcelle"
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment