Hello Pieter, > Have you started working on this?
Sorta. In my mind. > I was wondering if this does not actually warrant a project of its own. > Perhaps outside Apache as Apache (as far as I know) is not really in the > business of publishing specs. If it has a space of its own somewhere it > could be a more collaborative effort. > … SNIP Lately, in my daydreams, I've been leaning towards "a specification" inspired by the way Kuppitz built sparql-gremlin [https://github.com/dkuppitz/sparql-gremlin] and Wilmes built sql-gremlin [https://github.com/twilmes/sql-gremlin]. At first, I was all hell-bent on being all "virtual machine"-style with an instruction set (opcodes, parameters, and the like). However, after seeing how Kuppitz and Wilmes implemented their respective compilers, I thought it prudent to step out of the 80's and acknowledge that GraphTraversal is THE specification! What do I mean by this? I don't think we should ever publish individual steps as being important. If we do, we will spend all our time trying to make the step library tiny ("only 15 instructions needed man!"). Also, we shouldn't do that cause it leads to optimization issues. For instance, you can implement GroupCountStep using GroupStep, but its not as fast. So, instead of focusing on individual steps, I think we should focus on GraphTraversal as the "machine" the generates your Gremlin traversals. Wilmes and Kuppitz never talk steps in their compilers, they simply create an empty GraphTraversal and then start appending steps (via GraphTraversal.method()) accordingly as defined by the respective high-level language parse. So much easier! Similarly, this is how I believe DSLs should be created: public class MyTraversal<S,E> implements Traversal.Admin<S,E> { GraphTraversal rawTraversal = new DefaultGraphTraversal(); public MyTraversal people() { rawTraversal.hasLabel("person"); } public MyTraversal knows(String personName) { rawTraversal.out("knows").has("name",personName); } public E next() { return rawTraversal.next(); } ... } If DSL designers are thinking of steps and their parameterization, it will really freeze our ability to optimize at the step level. Moreover, we don't want to encourage people to create their own steps as we want our TraversalStrategies to be generally useful regardless of the human-level language. Thus, the mantra should be "all traversals via GraphTraversal." To your questions about a "language specification." If someone wants to create Gremlin in C++, well, I think they basically copy the GraphTraversal API and implement the respective functionality in various C++ step implementations. Thus, in a way, the GraphTraversal JavaDoc defines the language -- it is the specification (though, we need more semantics defined). I think this is the way to go instead of saying "here are all the instructions/steps in Gremlin with their respective parameterizations." Thoughts?, Marko. http://markorodriguez.com
