You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tinkerpop.apache.org by Marko Rodriguez <ok...@gmail.com> on 2016/10/19 14:04:57 UTC

A 2D Gremlin Language Variant

Hello,

Last night I was cruisin’ around Wikipedia and was checking out various programming languages. One in particular caught my eye — APL.

	https://en.wikipedia.org/wiki/APL_(programming_language)#Game_of_Life <https://en.wikipedia.org/wiki/APL_(programming_language)#Game_of_Life>

I thought it would be neat to have different type of syntax to express Gremlin traversals and came up with the following "2D pipes” language.

	https://gist.github.com/okram/cfb526bf01c36c1e4001de6b3dc0f60c <https://gist.github.com/okram/cfb526bf01c36c1e4001de6b3dc0f60c>

Basically, there are “piping” symbols that dictate traverser flow:
	- ^ / \ 
These pipes link the steps, where commonly used steps have a short-hand syntax.

The translator to go from this to Gremlin bytecode seems pretty simple. The internal data structure for the language is:

	List<List<String>>

This give you the 2D matrix. You then can go “up and down” the lists and “left and right” along the tokens, where the - ^ \ / pipes tell you how to move about the List<List<String>> structure.

Does anyone think this is cool?

Marko.

http://markorodriguez.com




Re: [TinkerPop] A 2D Gremlin Language Variant

Posted by Marko Rodriguez <ok...@gmail.com>.
Hi,

I was thinking about your tensor notation desire.

[created]x[knows]^ 

is equivalent to:

V().out(‘created’).in(‘knows’)

In general, we could do stuff like in this article:

	https://arxiv.org/abs/0806.2274 <https://arxiv.org/abs/0806.2274>

We just map all the presented algebraic operations over to a syntax that can then be compiled to Gremlin bytecode.

Marko.

http://markorodriguez.com



> On Nov 9, 2016, at 6:52 PM, Marko Rodriguez <ok...@gmail.com> wrote:
> 
> Hi,
> 
> Check it out:
> 
> 	https://gist.github.com/okram/c9e7dc6e51fcf067b9d77c6c4ea094da <https://gist.github.com/okram/c9e7dc6e51fcf067b9d77c6c4ea094da>
> 
> The code is pretty dead simple:
> 
> 	https://github.com/apache/tinkerpop/blob/9b15e90a651383bc7ab0c014f1492bbf70bc3848/tinkergraph-gremlin/src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/g2/g2Parser.java <https://github.com/apache/tinkerpop/blob/9b15e90a651383bc7ab0c014f1492bbf70bc3848/tinkergraph-gremlin/src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/g2/g2Parser.java>
> 
> Right now I’m manually testing using text files on my Desktop. However, you can see how easy it is to interact with the parser.
> 
> 	https://github.com/apache/tinkerpop/blob/9b15e90a651383bc7ab0c014f1492bbf70bc3848/tinkergraph-gremlin/src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/g2/g2ParserTest.java <https://github.com/apache/tinkerpop/blob/9b15e90a651383bc7ab0c014f1492bbf70bc3848/tinkergraph-gremlin/src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/g2/g2ParserTest.java>
> 
> Marko.
> 
> http://markorodriguez.com <http://markorodriguez.com/>
> 
> 
> 
>> On Oct 20, 2016, at 8:19 AM, HadoopMarc <marc.de.lignie@gmail.com <ma...@gmail.com>> wrote:
>> 
>> Hi Marko,
>> 
>> APL was especially cool for punchcards or VT100 terminals ...
>> 
>> I'm always in for more efficient notations for graph analytics. Maybe tensor notation can also provide some inspiration for 2D operations:
>> 
>> https://en.wikipedia.org/wiki/Tensor <https://en.wikipedia.org/wiki/Tensor>
>> 
>> Cheers,     Marc
>> 
>> Op donderdag 20 oktober 2016 01:08:18 UTC+2 schreef Robert Dale:
>> Reminds me of brainfuck.
>> 
>> On Wed, Oct 19, 2016 at 10:04 AM, Marko Rodriguez <okram...@gmail.com <javascript:>> wrote:
>> Hello,
>> 
>> Last night I was cruisin’ around Wikipedia and was checking out various programming languages. One in particular caught my eye — APL.
>> 
>> 	https://en.wikipedia.org/wiki/APL_(programming_language)#Game_of_Life <https://en.wikipedia.org/wiki/APL_(programming_language)#Game_of_Life>
>> 
>> I thought it would be neat to have different type of syntax to express Gremlin traversals and came up with the following "2D pipes” language.
>> 
>> 	https://gist.github.com/okram/cfb526bf01c36c1e4001de6b3dc0f60c <https://gist.github.com/okram/cfb526bf01c36c1e4001de6b3dc0f60c>
>> 
>> Basically, there are “piping” symbols that dictate traverser flow:
>> 	- ^ / \ 
>> These pipes link the steps, where commonly used steps have a short-hand syntax.
>> 
>> The translator to go from this to Gremlin bytecode seems pretty simple. The internal data structure for the language is:
>> 
>> 	List<List<String>>
>> 
>> This give you the 2D matrix. You then can go “up and down” the lists and “left and right” along the tokens, where the - ^ \ / pipes tell you how to move about the List<List<String>> structure.
>> 
>> Does anyone think this is cool?
>> 
>> Marko.
>> 
>> http://markorodriguez.com <http://markorodriguez.com/>
>> 
>> 
>> 
>> 
>> -- 
>> You received this message because you are subscribed to the Google Groups "Gremlin-users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an email to gremlin-user...@googlegroups.com <javascript:>.
>> To view this discussion on the web visit https://groups.google.com/d/msgid/gremlin-users/B347B223-FD64-4F5C-9E65-7F50CF72BF38%40gmail.com <https://groups.google.com/d/msgid/gremlin-users/B347B223-FD64-4F5C-9E65-7F50CF72BF38%40gmail.com?utm_medium=email&utm_source=footer>.
>> For more options, visit https://groups.google.com/d/optout <https://groups.google.com/d/optout>.
>> 
>> 
>> 
>> -- 
>> Robert Dale
>> 
>> -- 
>> You received this message because you are subscribed to the Google Groups "Gremlin-users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an email to gremlin-users+unsubscribe@googlegroups.com <ma...@googlegroups.com>.
>> To view this discussion on the web visit https://groups.google.com/d/msgid/gremlin-users/c1ce8a2b-b219-4eba-a8f6-ee62cdd12296%40googlegroups.com <https://groups.google.com/d/msgid/gremlin-users/c1ce8a2b-b219-4eba-a8f6-ee62cdd12296%40googlegroups.com?utm_medium=email&utm_source=footer>.
>> For more options, visit https://groups.google.com/d/optout <https://groups.google.com/d/optout>.
> 


Re: [TinkerPop] A 2D Gremlin Language Variant

Posted by Marko Rodriguez <ok...@gmail.com>.
Hi,

Check it out:

	https://gist.github.com/okram/c9e7dc6e51fcf067b9d77c6c4ea094da <https://gist.github.com/okram/c9e7dc6e51fcf067b9d77c6c4ea094da>

The code is pretty dead simple:

	https://github.com/apache/tinkerpop/blob/9b15e90a651383bc7ab0c014f1492bbf70bc3848/tinkergraph-gremlin/src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/g2/g2Parser.java <https://github.com/apache/tinkerpop/blob/9b15e90a651383bc7ab0c014f1492bbf70bc3848/tinkergraph-gremlin/src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/g2/g2Parser.java>

Right now I’m manually testing using text files on my Desktop. However, you can see how easy it is to interact with the parser.

	https://github.com/apache/tinkerpop/blob/9b15e90a651383bc7ab0c014f1492bbf70bc3848/tinkergraph-gremlin/src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/g2/g2ParserTest.java <https://github.com/apache/tinkerpop/blob/9b15e90a651383bc7ab0c014f1492bbf70bc3848/tinkergraph-gremlin/src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/g2/g2ParserTest.java>

Marko.

http://markorodriguez.com



> On Oct 20, 2016, at 8:19 AM, HadoopMarc <ma...@gmail.com> wrote:
> 
> Hi Marko,
> 
> APL was especially cool for punchcards or VT100 terminals ...
> 
> I'm always in for more efficient notations for graph analytics. Maybe tensor notation can also provide some inspiration for 2D operations:
> 
> https://en.wikipedia.org/wiki/Tensor <https://en.wikipedia.org/wiki/Tensor>
> 
> Cheers,     Marc
> 
> Op donderdag 20 oktober 2016 01:08:18 UTC+2 schreef Robert Dale:
> Reminds me of brainfuck.
> 
> On Wed, Oct 19, 2016 at 10:04 AM, Marko Rodriguez <okram...@gmail.com <javascript:>> wrote:
> Hello,
> 
> Last night I was cruisin’ around Wikipedia and was checking out various programming languages. One in particular caught my eye — APL.
> 
> 	https://en.wikipedia.org/wiki/APL_(programming_language)#Game_of_Life <https://en.wikipedia.org/wiki/APL_(programming_language)#Game_of_Life>
> 
> I thought it would be neat to have different type of syntax to express Gremlin traversals and came up with the following "2D pipes” language.
> 
> 	https://gist.github.com/okram/cfb526bf01c36c1e4001de6b3dc0f60c <https://gist.github.com/okram/cfb526bf01c36c1e4001de6b3dc0f60c>
> 
> Basically, there are “piping” symbols that dictate traverser flow:
> 	- ^ / \ 
> These pipes link the steps, where commonly used steps have a short-hand syntax.
> 
> The translator to go from this to Gremlin bytecode seems pretty simple. The internal data structure for the language is:
> 
> 	List<List<String>>
> 
> This give you the 2D matrix. You then can go “up and down” the lists and “left and right” along the tokens, where the - ^ \ / pipes tell you how to move about the List<List<String>> structure.
> 
> Does anyone think this is cool?
> 
> Marko.
> 
> http://markorodriguez.com <http://markorodriguez.com/>
> 
> 
> 
> 
> -- 
> You received this message because you are subscribed to the Google Groups "Gremlin-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to gremlin-user...@googlegroups.com <javascript:>.
> To view this discussion on the web visit https://groups.google.com/d/msgid/gremlin-users/B347B223-FD64-4F5C-9E65-7F50CF72BF38%40gmail.com <https://groups.google.com/d/msgid/gremlin-users/B347B223-FD64-4F5C-9E65-7F50CF72BF38%40gmail.com?utm_medium=email&utm_source=footer>.
> For more options, visit https://groups.google.com/d/optout <https://groups.google.com/d/optout>.
> 
> 
> 
> -- 
> Robert Dale
> 
> -- 
> You received this message because you are subscribed to the Google Groups "Gremlin-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to gremlin-users+unsubscribe@googlegroups.com <ma...@googlegroups.com>.
> To view this discussion on the web visit https://groups.google.com/d/msgid/gremlin-users/c1ce8a2b-b219-4eba-a8f6-ee62cdd12296%40googlegroups.com <https://groups.google.com/d/msgid/gremlin-users/c1ce8a2b-b219-4eba-a8f6-ee62cdd12296%40googlegroups.com?utm_medium=email&utm_source=footer>.
> For more options, visit https://groups.google.com/d/optout <https://groups.google.com/d/optout>.


Re: [TinkerPop] A 2D Gremlin Language Variant

Posted by HadoopMarc <ma...@gmail.com>.
Hi Marko,

APL was especially cool for punchcards or VT100 terminals ...

I'm always in for more efficient notations for graph analytics. Maybe 
tensor notation can also provide some inspiration for 2D operations:

https://en.wikipedia.org/wiki/Tensor

Cheers,     Marc

Op donderdag 20 oktober 2016 01:08:18 UTC+2 schreef Robert Dale:
>
> Reminds me of brainfuck.
>
> On Wed, Oct 19, 2016 at 10:04 AM, Marko Rodriguez <okram...@gmail.com 
> <javascript:>> wrote:
>
>> Hello,
>>
>> Last night I was cruisin’ around Wikipedia and was checking out various 
>> programming languages. One in particular caught my eye — APL.
>>
>> https://en.wikipedia.org/wiki/APL_(programming_language)#Game_of_Life
>>
>> I thought it would be neat to have different type of syntax to express 
>> Gremlin traversals and came up with the following "2D pipes” language.
>>
>> https://gist.github.com/okram/cfb526bf01c36c1e4001de6b3dc0f60c
>>
>> Basically, there are “piping” symbols that dictate traverser flow:
>> - ^ / \ 
>> These pipes link the steps, where commonly used steps have a short-hand 
>> syntax.
>>
>> The translator to go from this to Gremlin bytecode seems pretty simple. 
>> The internal data structure for the language is:
>>
>> List<List<String>>
>>
>> This give you the 2D matrix. You then can go “up and down” the lists and 
>> “left and right” along the tokens, where the - ^ \ / pipes tell you how to 
>> move about the List<List<String>> structure.
>>
>> Does anyone think this is cool?
>>
>> Marko.
>>
>> http://markorodriguez.com
>>
>>
>>
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "Gremlin-users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to gremlin-user...@googlegroups.com <javascript:>.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/gremlin-users/B347B223-FD64-4F5C-9E65-7F50CF72BF38%40gmail.com 
>> <https://groups.google.com/d/msgid/gremlin-users/B347B223-FD64-4F5C-9E65-7F50CF72BF38%40gmail.com?utm_medium=email&utm_source=footer>
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
>
> -- 
> Robert Dale
>

Re: [TinkerPop] A 2D Gremlin Language Variant

Posted by Robert Dale <ro...@gmail.com>.
Reminds me of brainfuck.

On Wed, Oct 19, 2016 at 10:04 AM, Marko Rodriguez <ok...@gmail.com>
wrote:

> Hello,
>
> Last night I was cruisin’ around Wikipedia and was checking out various
> programming languages. One in particular caught my eye — APL.
>
> https://en.wikipedia.org/wiki/APL_(programming_language)#Game_of_Life
>
> I thought it would be neat to have different type of syntax to express
> Gremlin traversals and came up with the following "2D pipes” language.
>
> https://gist.github.com/okram/cfb526bf01c36c1e4001de6b3dc0f60c
>
> Basically, there are “piping” symbols that dictate traverser flow:
> - ^ / \
> These pipes link the steps, where commonly used steps have a short-hand
> syntax.
>
> The translator to go from this to Gremlin bytecode seems pretty simple.
> The internal data structure for the language is:
>
> List<List<String>>
>
> This give you the 2D matrix. You then can go “up and down” the lists and
> “left and right” along the tokens, where the - ^ \ / pipes tell you how to
> move about the List<List<String>> structure.
>
> Does anyone think this is cool?
>
> Marko.
>
> http://markorodriguez.com
>
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Gremlin-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to gremlin-users+unsubscribe@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/gremlin-users/B347B223-FD64-4F5C-9E65-7F50CF72BF38%40gmail.com
> <https://groups.google.com/d/msgid/gremlin-users/B347B223-FD64-4F5C-9E65-7F50CF72BF38%40gmail.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Robert Dale