Hi!

> I'm using neo4j for a student project and have run into the problem that I'd
> like to traverse the whole graph without specifying the RelationshipType
> (since I use a lot of different types)

I think you have two options here.

If you don't need/want to use a traverser, you could simply call 
getRelationships() and follow them "manually".

With a traverser you'll have to collect all the relationship types from 
Neo, using:

http://api.neo4j.org/current/org/neo4j/api/core/EmbeddedNeo.html#getRelationshipTypes()

(so if you're using a NeoService variablle, you have to cast it to EmbeddedNeo 
first)

Don't worry about the deprecation, it will survive in one or another form.

>From what you get as result there, you will have to contruct an array of 
>Object, where first item is a relationship type, the second is a direction, 
>repeated for all relationship types.

Then you use that array as input to the Node.traverse() method:
http://api.neo4j.org/current/org/neo4j/api/core/Node.html#traverse(org.neo4j.api.core.Traverser.Order,%20org.neo4j.api.core.StopEvaluator,%20org.neo4j.api.core.ReturnableEvaluator,%20java.lang.Object...)

Where the API says
 Object 
<http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Object.html?is-external=true>...
 relationshipTypesAndDirections
you can as well put an  array in the format I mentioned.

Ah, found some code using this approach:
https://trac.neo4j.org/browser/components/neoclipse/trunk/org.neo4j.neoclipse/src/main/java/org/neo4j/neoclipse/view/NeoGraphContentProvider.java?rev=2556#L76


If you need more help, just tell us!

/anders

-- 
Anders Nawroth [[email protected]]
GTalk, Skype: anders.nawroth
Phone: +46 737 894 163
http://twitter.com/nawroth
http://blog.nawroth.com/

_______________________________________________
Neo mailing list
[email protected]
https://lists.neo4j.org/mailman/listinfo/user

Reply via email to