Hi Nuria,

Does the node have a property? Poor man's self-reference check:

Traverser peopleTraverser = ...

for (Node  otherPerson : peopleTraverser)
{
    if(!otherPerson.getProperty("name").equals(person.getProperty("name")))
    ...


-Todd




On Wed, Dec 30, 2009 at 6:34 AM, Núria Trench <[email protected]> wrote:
> Ok, thank you for your response. Is there any way to run the traverser
> omitting this kind of nodes?
> As you have said, there are some algorithms which need to have edges with
> the same tail and head node.
>
> 2009/12/30 Tobias Ivarsson <[email protected]>
>
>> By the way. Having a mathematical background I think that Neo4j should add
>> support for relationships where the start node and end node are the same.
>> Just wanted to throw this out there to force my colleagues to respond to
>> why
>> it isn't supported (I'm sure there is a better reason than "we didn't have
>> any use cases for it when we originally designed Neo4j", which was the
>> response I got when asking about this around the time I got hired).
>>
>> sneaking-questions-out-into-the-public-ly yours,
>> Tobias
>>
>> On Wed, Dec 30, 2009 at 12:21 PM, Tobias Ivarsson <
>> [email protected]> wrote:
>>
>> > Neo4j does not allow relationships where the start node and end node are
>> > the same.
>> >
>> > It looks like the batch inserter does not verify this constraint which is
>> > why you run into trouble when traversing the graph instead.
>> >
>> > Cheers,
>> > Tobias
>> >
>> >
>> > On Wed, Dec 30, 2009 at 11:17 AM, Núria Trench <[email protected]
>> >wrote:
>> >
>> >> Hi,
>> >>
>> >> I have created a network with the Batch Inserter component which has
>> >> relationships from a node to itself. So, I am unable to traverse this
>> >> network because it throws an exception when the traverser finds a
>> >> relationship that its tail and head node are equals. The exception is
>> the
>> >> following one:
>> >>
>> >> Exception in thread "main" java.lang.IllegalArgumentException: Start
>> node
>> >> equals end node
>> >>        at
>> >> org.neo4j.impl.core.RelationshipImpl.<init>(RelationshipImpl.java:58)
>> >>        at
>> >>
>> org.neo4j.impl.core.NodeManager.getMoreRelationships(NodeManager.java:604)
>> >>        at
>> >> org.neo4j.impl.core.NodeImpl.getMoreRelationships(NodeImpl.java:332)
>> >>        at
>> >> org.neo4j.impl.core.NodeImpl.ensureFullRelationships(NodeImpl.java:320)
>> >>        at
>> >>
>> org.neo4j.impl.core.NodeImpl.getAllRelationshipsOfType(NodeImpl.java:129)
>> >>        at
>> org.neo4j.impl.core.NodeImpl.getRelationships(NodeImpl.java:199)
>> >>        at
>> >> org.neo4j.impl.core.NodeProxy.getRelationships(NodeProxy.java:87)
>> >>        at
>> >>
>> >>
>> org.neo4j.impl.traversal.AbstractTraverser.addEndNodesToList(AbstractTraverser.java:256)
>> >>        at
>> >>
>> >>
>> org.neo4j.impl.traversal.AbstractTraverser.traverseToNextNode(AbstractTraverser.java:201)
>> >>        at
>> >>
>> >>
>> org.neo4j.impl.traversal.AbstractTraverser.hasNext(AbstractTraverser.java:134)
>> >>
>> >> How can I traverse this network without getting an exception? I can't
>> >> change
>> >> the schema.
>> >> Thank your very much in advance,
>> >>
>> >> Núria.
>> >> _______________________________________________
>> >> Neo mailing list
>> >> [email protected]
>> >> https://lists.neo4j.org/mailman/listinfo/user
>> >>
>> >
>> >
>> >
>> > --
>> > Tobias Ivarsson <[email protected]>
>> > Hacker, Neo Technology
>> > www.neotechnology.com
>> > Cellphone: +46 706 534857
>> >
>>
>>
>>
>> --
>> Tobias Ivarsson <[email protected]>
>> Hacker, Neo Technology
>> www.neotechnology.com
>> Cellphone: +46 706 534857
>> _______________________________________________
>> Neo mailing list
>> [email protected]
>> https://lists.neo4j.org/mailman/listinfo/user
>>
> _______________________________________________
> Neo mailing list
> [email protected]
> https://lists.neo4j.org/mailman/listinfo/user
>
_______________________________________________
Neo mailing list
[email protected]
https://lists.neo4j.org/mailman/listinfo/user

Reply via email to