2010/10/28 Walaa Eldin Moustafa <[email protected]>
> Hi Mattias,
>
> Even if I pass nulls, I will still have to build an index on some key
> (property). I do not want to do that because it adds the property
> index overhead for something that I am not actually using.
>
I think it's definately worth that tiny extra overhead since lookups are
very fast (no looping at all, but instead direct index lookups).
>
> By the way, does the underlying code for index.get(kay, value, start,
> end) iterate over all the relationships of start and checks if one is
> connected to end, or it does perform a direct look up to get the edges
> between (start, end)?
>
No looping, just a direct lookup. Maybe RelationshipIndex should have a
method:
add( Relationship relationship );
which indexes that relationship (with its start/end node as usual) but w/o
any additional property. Would that be a good idea?
>
> Thanks.
>
>
> On Wed, Oct 27, 2010 at 4:50 PM, Mattias Persson
> <[email protected]> wrote:
> > 2010/10/27, Walaa Eldin Moustafa <[email protected]>:
> >> 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
> >> [email protected]
> >> https://lists.neo4j.org/mailman/listinfo/user
> >>
> >
> >
> > --
> > Mattias Persson, [[email protected]]
> > Hacker, Neo Technology
> > www.neotechnology.com
> > _______________________________________________
> > Neo4j mailing list
> > [email protected]
> > https://lists.neo4j.org/mailman/listinfo/user
> >
> _______________________________________________
> Neo4j mailing list
> [email protected]
> https://lists.neo4j.org/mailman/listinfo/user
>
--
Mattias Persson, [[email protected]]
Hacker, Neo Technology
www.neotechnology.com
_______________________________________________
Neo4j mailing list
[email protected]
https://lists.neo4j.org/mailman/listinfo/user