2010/10/27, Walaa Eldin Moustafa <wa.moust...@gmail.com>:
> 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.
>
you can actually leave out key/value (pass in null) if you pass in
start/end node, or you can index the relationship type as a key/value
pair for each relationship and then do: get( "type", "knows", person1,
person2 );

would that help?
_______________________________________________
> Neo4j mailing list
> User@lists.neo4j.org
> https://lists.neo4j.org/mailman/listinfo/user
>


-- 
Mattias Persson, [matt...@neotechnology.com]
Hacker, Neo Technology
www.neotechnology.com
_______________________________________________
Neo4j mailing list
User@lists.neo4j.org
https://lists.neo4j.org/mailman/listinfo/user

Reply via email to