Hi,
If you use Groovy, then your Gremlin/Groovy/Java code seamlessly interact:
https://github.com/tinkerpop/gremlin/wiki/Using-Gremlin-through-Groovy
If you don't want to use Groovy, then with Java you can talk to Gremlin via JSR
223:
https://github.com/tinkerpop/gremlin/wiki/Using-Gremlin-through-Java
If you are just playing around and want to test out algorithms, then you use
the Gremlin REPL:
saikat$ ./gremlin.sh
I recommend the first way for larger projects. See slide #22 here:
http://www.slideshare.net/slidarko/the-gremlin-in-the-graph
Hope that helps,
Marko.
http://markorodriguez.com
On Feb 16, 2011, at 2:32 PM, Saikat Kanjilal wrote:
>
> Hi Marko,Thanks for the response, since I am using neo4j in embedded mode is
> there a Java API to execute the Gremlin statement below in the current neo4j
> release, my actual expression is a lot more complicated but feeds off the one
> I showed below. It would be a pain to have to do this from outside of the
> java code.
>
> Thanks in advance
>
>> From: [email protected]
>> Date: Wed, 16 Feb 2011 14:27:54 -0700
>> To: [email protected]
>> Subject: Re: [Neo4j] Extracting paths from a subgraph
>>
>> Hi,
>>
>> You might want to try Gremlin for that. See http://gremlin.tinkerpop.com ...
>>
>> Off the cuff, this is the Gremlin expression to accomplish your goal:
>>
>>
>> g.V[[nodeType:'A']].outE.inV[[nodeType:'B']].outE.inV[[nodeType:'C']].paths
>>
>> Thats the depth-first version. You can do breadth-first as well. If you are
>> interested, bring it up on the Gremlin-users mailing list and we can help
>> you there.
>> http://groups.google.com/group/gremlin-users
>>
>> Hope that helps,
>> Marko.
>>
>> http://markorodriguez.com
>>
>> On Feb 16, 2011, at 2:09 PM, Saikat Kanjilal wrote:
>>
>>>
>>> Hi Folks,I've spent the last few days reading documentation around several
>>> aspects of neo4j surrounding extracting a subgraph. However I still dont
>>> see any articles or code examples pertaining to the extraction of a set of
>>> paths from the complete list of paths based on some prearranged criteria.
>>> I read the documentation on the Traverser API as well as graph matching API
>>> but it seems to be that this is related to node traversal (as opposed to
>>> path extraction) based on pattern matching. What I would like to
>>> know/understand is whether there is an API to extract a set of paths based
>>> on some criteria surrounding ordering of a subset of nodes in those paths,
>>> example is shown below:
>>> Data Set: million nodes:Query: Give me all the paths where the firstNode
>>> is of property with nodetype A and the secondNode is of property with
>>> nodetype B and the third node is of property with ndoetype CResult: I am
>>> looking to get back a subset of all the paths
>>>
>>> 2 questions:1) Can I even do the above with the current neo4j API or do I
>>> need to resort to using the graph matching API and stick to traversing
>>> nodes with pattern matching a subset of those nodes?2) If I cant do this
>>> are there any ramifications in performance when performing a DFS or a BFS
>>> with the Traverser API with a million nodes where I have a query like the
>>> one above
>>>
>>> I would love some insight and or pointers to links or resources to help
>>> with this.
>>> Best Regards
>>> _______________________________________________
>>> Neo4j mailing list
>>> [email protected]
>>> https://lists.neo4j.org/mailman/listinfo/user
>>
>> _______________________________________________
>> Neo4j mailing list
>> [email protected]
>> https://lists.neo4j.org/mailman/listinfo/user
>
> _______________________________________________
> Neo4j mailing list
> [email protected]
> https://lists.neo4j.org/mailman/listinfo/user
_______________________________________________
Neo4j mailing list
[email protected]
https://lists.neo4j.org/mailman/listinfo/user