Skip to content

Instantly share code, notes, and snippets.

@okram
Last active October 14, 2020 14:08
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 okram/7c3ba7d4a7bf7c073a4b4c0c32d5c397 to your computer and use it in GitHub Desktop.
Save okram/7c3ba7d4a7bf7c073a4b4c0c32d5c397 to your computer and use it in GitHub Desktop.
Given [model,tp3], a graph traversal can be expressed as:
vertex[get,outE][is,[get,label][eq,'knows']][get,inV]
or w/ corresponding mmlang sugar syntax:
vertex.outE[is.label=='knows'].inV
or using auto-coercion over the following type definition:
[define, vertex{*}<=(vertex->str)<x>.key.outE[is.label==x.value].inV]
////////////////////////////////// Expressions
"Who does Marko know, what do they like, and what are those things related to?"
// using mmlang sugar syntax
marko.outE[is.label=='knows'].inV.outE[is.label=='likes'].inV.outE[is.label=='relatedTo'].inV
// using auto-coercion
marko->'knows'->'likes'->'relatedTo'
// How does the above work?
(marko->'knows') // rec
((marko->'knows')->'likes) // rec
(((marko->'knows')->'likes')->'relatedTo') // rec
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment