Hi Rick,

AFAIK the current hasRelationship methods don't let you check for the
second node.
We notice this same issue when we first start coding with Neo, seems
natural to have that kind of API where you check wether a node has a
certain relationship to a another node.
Not sure how expensive would be to keep track of though.

2010/2/2 Rick Bullotta <[email protected]>:
> Hi, Maria.
>
> You should be using the hasRelationship(...) method of the Node object.
>
> http://api.neo4j.org/current/org/neo4j/graphdb/Node.html
>
> Best regards,
>
> Rick
>
> -----Original Message-----
> From: [email protected] [mailto:[email protected]] On
> Behalf Of Maria Giatsoglou
> Sent: Tuesday, February 02, 2010 5:45 PM
> To: [email protected]
> Subject: [Neo] Checking whether a relationship exists between two nodes...
>
> Hello all
>
> I am creating a project that performs a number of benchmark tasks on Neo.
> One of the tests measures the required time for creating a relationship
> between two neo nodes A and B.
> However, before creating the relationship, it should firs be checked
> whether a relationship of the same type already exists
> between these two nodes. My current implementation calls the
> getRelationships() function
> for the A node and then iterates over the returned Iterable object
> checking whether a relationship's end node is equal to node B.  If  such
> a relationship does not exist, then the required relationship is created
> between nodes A and B.
>
> However, this technique seems to be very slow, with the creation of a
> relationship (including the check operation)  taking around 57msec to
> complete. Is there a faster way to implement this operation? I
> considered trying to modify the LuceneIndexService implementation in
> order to enable indexing
> relationships apart from nodes. Do you recommend such an approach for
> this problem?
>
> Many thanks in advance,
>
> Best regards,
>
> Maria Giatsoglou
> _______________________________________________
> Neo mailing list
> [email protected]
> https://lists.neo4j.org/mailman/listinfo/user
>
> _______________________________________________
> Neo mailing list
> [email protected]
> https://lists.neo4j.org/mailman/listinfo/user
>



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

Reply via email to