Package org.neo4j.graphdb

Examples of org.neo4j.graphdb.Transaction.success()


        if (!relList.contains(end)) {
            Transaction tx = db.beginTx();
            try {
                Node endNode = db.getNodeById(end);
                startNode.createRelationshipTo(endNode, withName(relationshipType));
                tx.success();
            } catch (final Exception e) {
                tx.failure();
            } finally {
                tx.close();
                relList.add(end);
View Full Code Here


        // Add first matcher
        for (int i = 0; i < labeledText.getFocus(); i++) {
            Transaction tx = db.beginTx();
            getRootPatternNode(db);
            LearningManager.trainInput(Arrays.asList(labeledText.getText()), Arrays.asList(labeledText.getLabel()), GRAPH_MANAGER, db);
            tx.success();
            tx.close();
        }

        return Response.ok()
                .entity("{\"success\":\"true\"}")
View Full Code Here

        }

        // TODO: Remove this in favor of a distributed messaging bus architecture
        Transaction tx = graphDb.beginTx();
        graphDb.getNodeById(id).setProperty(key, value);
        tx.success();
        tx.close();

        return success;
    }
View Full Code Here

            Long dataNodeId = nodeManager.getOrCreateNode(dataNodeManager, input, db).getId();
            nodeManager.setNodeProperty(dataNodeId, "label", labels.toArray(new String[labels.size()]), db);

            Map<Long, Integer> patternMatchers = PatternMatcher.match(GraphManager.ROOT_TEMPLATE, input, db, graphManager);

            tx.success();
            tx.close();

            tx = db.beginTx();

            for (Long nodeId : patternMatchers.keySet()) {
View Full Code Here

                    generateChildPatterns(db, nodeManager.getNodeAsMap(nodeId, db), matchDictionary, graphManager);
                }

            }

            tx.success();
            tx.close();
        }
    }

    /**
 
View Full Code Here

        String expected = "a";

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

    private GraphDatabaseService setUpDb() {
        return new TestGraphDatabaseFactory().newImpermanentDatabaseBuilder().newGraphDatabase();
View Full Code Here

        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";
        nodeManager.setNodeProperty(a.getId(), "test", expected, db);
        Transaction tx = db.beginTx();
View Full Code Here

        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

    private static void trainOnText(String[] text, String[] label, GraphDatabaseService db, GraphManager graphManager) {
        Transaction tx = db.beginTx();
        getRootPatternNode(db, graphManager);
        LearningManager.trainInput(Arrays.asList(text), Arrays.asList(label), graphManager, db);
        tx.success();
        tx.close();
    }

    private static Node getRootPatternNode(GraphDatabaseService db, GraphManager graphManager) {
        Node patternNode;
View Full Code Here

    try {
      tx = neo4jDb.beginTx();
      for ( IdentifierGenerator identifierGenerator : identifierGenerators ) {
        addUniqueConstraint( identifierGenerator );
      }
      tx.success();
    }
    finally {
      tx.close();
    }
  }
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.