Package org.neo4j.graphdb

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


        checkImportedNode(NAME, VALUE);
    }

    private void checkImportedNode(String prop, String value) {
        GraphDatabaseService gdb = service.getGraphDatabase();
        try (Transaction tx = gdb.beginTx()) {
            Node imported = IteratorUtil.single(GlobalGraphOperations.at(gdb).getAllNodes());
            assertEquals(value, imported.getProperty(prop));
            tx.success();
        }
    }
View Full Code Here


            if (this.edgeIndexKeys.size() > 0)
                builder.setConfig(GraphDatabaseSettings.relationship_keys_indexable, edgeIndexKeys.toString().replace("[", "").replace("]", "")).setConfig(GraphDatabaseSettings.relationship_auto_indexing, "true");

            rawGraphDB = builder.newGraphDatabase();

            Transaction tx = rawGraphDB.beginTx();
            try {
                GlobalGraphOperations graphOperations = GlobalGraphOperations.at(rawGraphDB);
                if (this.vertexIndexKeys.size() > 0)
                    populateKeyIndices(rawGraphDB, rawGraphDB.index().getNodeAutoIndexer(), graphOperations.getAllNodes(), Vertex.class);
                if (this.edgeIndexKeys.size() > 0)
View Full Code Here

                builder.setConfig(GraphDatabaseSettings.node_keys_indexable, vertexIndexKeys.toString().replace("[", "").replace("]", "")).setConfig(GraphDatabaseSettings.node_auto_indexing, GraphDatabaseSetting.TRUE);
            if (this.edgeIndexKeys.size() > 0)
                builder.setConfig(GraphDatabaseSettings.relationship_keys_indexable, edgeIndexKeys.toString().replace("[", "").replace("]", "")).setConfig(GraphDatabaseSettings.relationship_auto_indexing, GraphDatabaseSetting.TRUE);

            rawGraphDB = builder.newGraphDatabase();
            Transaction tx = rawGraphDB.beginTx();

            try {
                rawGraphDB.getReferenceNode().delete();
                tx.success();
            } catch (Exception e) {
View Full Code Here

    public void testDatabase()
    {
        GraphDatabaseService database = module.findService( EmbeddedDatabaseService.class ).get().database();

        {
            Transaction tx = database.beginTx();

            try
            {
                Node rickard = database.createNode();
                rickard.setProperty( "name", "Rickard" );
View Full Code Here

    displayRelationship(r05);

    /* Perform selections on the graph database */
    System.out.println("\n*** MEMBERS RELATIONSHIPS SELECTION ***");
    // Use a transaction for selections because it's required by Neo4J...
    Transaction transaction = graphDatabase.beginTx();

    // Find a node according to a property value (search for Tony member)
    System.out.println("** Find a node according to a property value (search for Tony member)");
    Iterable<Node> members = graphDatabase.getAllNodes();
    long tonyId = -1;
View Full Code Here

            LearningManager.trainInput(Lists.asList(str, new String[0]), Lists.asList(text.get(str), new String[0]), graphManager, db);
        }

        String rootPattern;

        try (Transaction tx = db.beginTx()) {
            rootPattern = (String) rootNode.getProperty("pattern");
            tx.success();
        }

        String input = "The fiftieth word in a document is interesting";
View Full Code Here

        text.put("The twenty-fifth word in a document is interesting", "document");
        text.put("The twenty-sixth word in a document is interesting", "document");

        String rootPattern;

        try (Transaction tx = db.beginTx()) {
            rootPattern = (String) rootNode.getProperty("pattern");
            tx.success();
        }

        String input = "The last word in a document is interesting";
View Full Code Here

        Assert.assertNotNull(f);
        Assert.assertNotNull(g);

        String expected = "a";

        Transaction tx = db.beginTx();
        String actual = (String)a.getProperty("value");
        tx.success();
        Assert.assertEquals(expected, actual);
    }
View Full Code Here

        NodeManager.globalNodeCache.invalidateAll();
        DataNodeManager.dataCache.invalidateAll();
        DataNodeManager dataNodeManager = new DataNodeManager();

        // Write some nodes to the database
        Transaction tx1 = db.beginTx();
        Node a = nodeManager.getOrCreateNode(dataNodeManager, "a", db);
        tx1.success();
        Assert.assertNotNull(a);

        String expected = "success";
View Full Code Here

        tx1.success();
        Assert.assertNotNull(a);

        String expected = "success";
        nodeManager.setNodeProperty(a.getId(), "test", expected, db);
        Transaction tx = db.beginTx();
        String actual = (String)NodeManager.getNodeFromGlobalCache(a.getId()).get("test");
        tx.success();

        Assert.assertEquals(expected, actual);
    }
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.