Hi,
You could try Gremlin -- http://gremlin.tinkerpop.com ...
g:count($n1/ou...@label='t']/i...@id=$n2_id) > 0
It will iterate over all out edges of n1, but, you will find more flexibility
in determining if particular paths exist. That is, if you plan more complicated
expressions.
If you are doing this from within Java, see:
http://github.com/tinkerpop/gremlin/wiki/Using-Gremlin-through-Java
Good luck,
Marko.
http://markorodriguez.com
On Oct 27, 2010, at 2:09 PM, Walaa Eldin Moustafa wrote:
> I am looking for a method that is if given a node n1, can answer the
> query if n1 has a relationship of type t with node n2, something along
> the lines of:
>
> boolean b = n1.hasRelatioship(n2,t);
>
> I know we can answer this question by iterating over n1's
> getRelationships() and testing them. However, I was looking for
> something more efficient that does not have to iterate over the node's
> relationships, especially that I noticed that the RelationshipIndex
> interface has a get() method that does something like that; however we
> have to supply it with a key and a value for an attribute for the edge
> between the two nodes. So I was looking for something like this
> method, but without having to pass a key/value pair.
> _______________________________________________
> Neo4j mailing list
> [email protected]
> https://lists.neo4j.org/mailman/listinfo/user
_______________________________________________
Neo4j mailing list
[email protected]
https://lists.neo4j.org/mailman/listinfo/user