Skip to content

Instantly share code, notes, and snippets.

@okram
Last active Oct 14, 2020
Embed
What would you like to do?
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