Greetings - I have started my first project using neo4j, and am having some trouble with unit tests. I must be missing something, but when I retrieve a node using an incoming direction, I am unable to get properties from that node. The first test works fine, the second one fails with a NotFoundException on the property "asn". (although it does find the end-node with no trouble) Can anyone point out what I am doing wrong?
Thanks, Jon /** * $Id$ */ package com.mcafee.tsw.webgraph; import org.junit.After; import org.junit.Before; import org.junit.Test; import org.neo4j.graphdb.Direction; import org.neo4j.graphdb.GraphDatabaseService; import org.neo4j.graphdb.Node; import org.neo4j.graphdb.RelationshipType; import org.neo4j.graphdb.Transaction; import org.neo4j.test.ImpermanentGraphDatabase; /** */ public class TestMe { private GraphDatabaseService svc; private Transaction tx; /** * @throws java.lang.Exception */ @Before public void initDB() throws Exception { svc = new ImpermanentGraphDatabase(); tx = svc.beginTx(); } /** * @throws java.lang.Exception */ @After public void closeDB() throws Exception { tx.failure(); tx.finish(); svc.shutdown(); svc = null; } // This one works. @Test public void testOutgoing() { Node network = svc.createNode(); Node as = svc.createNode(); as.setProperty("asn", "123"); network.createRelationshipTo(as, IPAddressRelationshipType.AS); System.out.println(network.getSingleRelationship(IPAddressRelationshipType.AS, Direction.OUTGOING) .getEndNode().getProperty("asn")); } // This one results in a not found exception on the 'asn' property. @Test public void testIncoming() { Node network = svc.createNode(); Node as = svc.createNode(); as.setProperty("asn", "123"); as.createRelationshipTo(network, IPAddressRelationshipType.AS); System.out.println(network.getSingleRelationship(IPAddressRelationshipType.AS, Direction.INCOMING) .getEndNode().getProperty("asn")); } } _______________________________________________ Neo4j mailing list User@lists.neo4j.org https://lists.neo4j.org/mailman/listinfo/user