Package org.neo4j.graphdb

Examples of org.neo4j.graphdb.GraphDatabaseService.createNode()


    @Test
    public void testSuppressedExceptionTopLevel() throws Exception {
        try {
            GraphDatabaseService db = new TestGraphDatabaseFactory().newImpermanentDatabase();
            try (Transaction tx = db.beginTx()) {
                Node n = db.createNode();
                n.setProperty("foo", "bar");
                if (true) throw new Exception(MESSAGE);
                tx.success();
            }
        } catch (Exception e) {
View Full Code Here


          rel.delete();
        }
        node.delete();
      }
      for (PropertyMapper mapper : toSave) {
        Node node = db.createNode();
        mapper.save(node);
        layer.getLayerNode().createRelationshipTo(node, SpatialRelationshipTypes.PROPERTY_MAPPING);
      }
      tx.success();
    } finally {
View Full Code Here

    SimplePointLayer layer = sdb.createSimplePointLayer("my-points", "x", "y");

    Coordinate[] coords = makeCoordinateDataFromTextFile("NEO4J-SPATIAL.txt", testOrigin);
    try (Transaction tx = db.beginTx()) {
      for (Coordinate coordinate : coords) {
        Node n = db.createNode();
        n.setProperty("x", coordinate.x);
        n.setProperty("y", coordinate.y);
        layer.add(n);
      }
      tx.success();
View Full Code Here

    SimplePointLayer layerB = sdb.createSimplePointLayer("my-points-B", "xb", "yb", "bbox_b");

    Coordinate[] coords = makeCoordinateDataFromTextFile("NEO4J-SPATIAL.txt", testOrigin);
    try (Transaction tx = db.beginTx()) {
      for (Coordinate coordinate : coords) {
        Node n = db.createNode();
        n.setProperty("xa", coordinate.x);
        n.setProperty("ya", coordinate.y);
        n.setProperty("xb", coordinate.x + x_offset);
        n.setProperty("yb", coordinate.y + y_offset);
View Full Code Here

    @Test
    public void shouldIncludeCorrectRelationships() {
        GraphDatabaseService database = new TestGraphDatabaseFactory().newImpermanentDatabase();

        try (Transaction tx = database.beginTx()) {
            Node n1 = database.createNode();
            Node n2 = database.createNode();
            Relationship r = n1.createRelationshipTo(n2, withName("TEST"));
            r.setProperty("test", "test");

            assertTrue(IncludeRelationships.all().include(r));
View Full Code Here

    public void shouldIncludeCorrectRelationships() {
        GraphDatabaseService database = new TestGraphDatabaseFactory().newImpermanentDatabase();

        try (Transaction tx = database.beginTx()) {
            Node n1 = database.createNode();
            Node n2 = database.createNode();
            Relationship r = n1.createRelationshipTo(n2, withName("TEST"));
            r.setProperty("test", "test");

            assertTrue(IncludeRelationships.all().include(r));
            assertTrue(IncludeRelationships.all().with(OUTGOING).include(r, n1));
View Full Code Here

    @Test
    public void shouldIncludeCorrectRelationships() {
        GraphDatabaseService database = new TestGraphDatabaseFactory().newImpermanentDatabase();

        try (Transaction tx = database.beginTx()) {
            Node n = database.createNode(label("Test"));
            n.setProperty("test", "test");

            assertTrue(IncludeNodes.all().include(n));
            assertTrue(IncludeNodes.all().with("Test").include(n));
            assertFalse(IncludeNodes.all().with(label("Test2")).include(n));
View Full Code Here

    @Test
    public void testRandom() {
        GraphDatabaseService database = new TestGraphDatabaseFactory().newImpermanentDatabase();

        try (Transaction tx = database.beginTx()) {
            database.createNode();
            tx.success();
        }

        try (Transaction tx = database.beginTx()) {
            assertTrue(asList(0L, 1L).contains(random(at(database).getAllNodes()).getId()));
View Full Code Here

    @Test
    public void shouldIncludeCorrectRelationships() {
        GraphDatabaseService database = new TestGraphDatabaseFactory().newImpermanentDatabase();

        try (Transaction tx = database.beginTx()) {
            Node n = database.createNode(label("Test"));
            n.setProperty("test", "test");
            Node internal = database.createNode(label(GA_PREFIX + "test"));

            assertTrue(of(IncludeAllBusinessNodes.getInstance(), IncludeNodes.all()).include(n));
            assertFalse(of(IncludeAllBusinessNodes.getInstance(), IncludeNodes.all()).include(internal));
View Full Code Here

        GraphDatabaseService database = new TestGraphDatabaseFactory().newImpermanentDatabase();

        try (Transaction tx = database.beginTx()) {
            Node n = database.createNode(label("Test"));
            n.setProperty("test", "test");
            Node internal = database.createNode(label(GA_PREFIX + "test"));

            assertTrue(of(IncludeAllBusinessNodes.getInstance(), IncludeNodes.all()).include(n));
            assertFalse(of(IncludeAllBusinessNodes.getInstance(), IncludeNodes.all()).include(internal));
            assertTrue(of(IncludeAllBusinessNodes.getInstance(), IncludeNodes.all().with(label("Test"))).include(n));
            assertFalse(of(IncludeAllBusinessNodes.getInstance(), IncludeNodes.all().with("Test")).include(internal));
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.