Examples of GraphDatabaseService


Examples of org.neo4j.graphdb.GraphDatabaseService

    @Path(UrlReverseLookerUpper.PATH_RELATIONSHIP)
    @SerializeWith(RelationshipSerializationStrategy.class)
    public void getRelationship(Invocation invocation, Output result)
            throws Exception
    {
        GraphDatabaseService db = invocation.getDB();
        result.ok(db.getRelationshipById(getRelationshipId(invocation)));
    }
View Full Code Here

Examples of org.neo4j.graphdb.GraphDatabaseService

    }
  }

    private JtaTransactionManager createJtaTransactionManager() {
        JtaTransactionManager jtaTm = new JtaTransactionManager();
        final GraphDatabaseService gds = getGraphDatabaseService();
        if (gds instanceof AbstractGraphDatabase) {
            jtaTm.setTransactionManager(new SpringTransactionManager(gds));
            jtaTm.setUserTransaction(new UserTransactionImpl(gds));
        } else {
            final NullTransactionManager tm = new NullTransactionManager();
View Full Code Here

Examples of org.neo4j.graphdb.GraphDatabaseService

    @Ignore
    @Test
    public void testCypherJsonResult() throws Exception {

        GraphDatabaseService db;
        db = setUpDb();

        Map<String, Object> params = new HashMap<>();

        params.put("name", "Information theory");
View Full Code Here

Examples of org.neo4j.graphdb.GraphDatabaseService

        GraphManager.patternCache.invalidateAll();
        DataRelationshipManager.relationshipCache.invalidateAll();
        ClassRelationshipCache.relationshipCache.invalidateAll();
        PatternRelationshipCache.relationshipCache.invalidateAll();

        GraphDatabaseService db = setUpDb();
        GraphManager graphManager = new GraphManager("Pattern");
        Node rootNode = getRootPatternNode(db, graphManager);

        Map<String, String> text = new HashMap<>();
        text.put("The first word in a sentence is interesting", "sentence");
        text.put("The second word in a sentence is interesting", "sentence");
        text.put("The third word in a sentence is interesting", "sentence");
        text.put("The fourth word in a paragraph is interesting", "paragraph");
        text.put("The fifth word in a sentence is interesting", "sentence");
        text.put("The sixth word in a paragraph is interesting", "paragraph");
        text.put("The seventh word in a sentence is interesting", "sentence");
        text.put("The eighth word in a document is interesting", "document");
        text.put("The ninth word in a sentence is interesting", "sentence");
        text.put("The tenth word in a paragraph is interesting", "paragraph");
        text.put("The eleventh word in a sentence is interesting", "sentence");
        text.put("The twelfth word in a paragraph is interesting", "paragraph");
        text.put("The thirteenth word in a sentence is interesting", "sentence");
        text.put("The fourteenth word in a document is interesting", "document");
        text.put("The fifteenth word in a sentence is interesting", "sentence");
        text.put("The sixteenth word in a paragraph is interesting", "paragraph");
        text.put("The seventeenth word in a sentence is interesting", "sentence");
        text.put("The nineteenth word in a document is interesting", "document");
        text.put("The twentieth word in a sentence is interesting", "sentence");
        text.put("The twenty-first word in a paragraph is interesting", "paragraph");
        text.put("The twenty-second word in a sentence is interesting", "sentence");
        text.put("The twenty-third word in a document is interesting", "document");
        text.put("The twenty-fourth word in a document is interesting", "document");
        text.put("The twenty-fifth word in a document is interesting", "document");
        text.put("The twenty-sixth word in a document is interesting", "document");
        text.put("The first word in a sentence is interesting", "sentence");
        text.put("The second word in a sentence is interesting", "sentence");
        text.put("The third word in a sentence is interesting", "sentence");
        text.put("The fourth word in a paragraph is interesting", "paragraph");
        text.put("The fifth word in a sentence is interesting", "sentence");
        text.put("The sixth word in a paragraph is interesting", "paragraph");
        text.put("The seventh word in a sentence is interesting", "sentence");
        text.put("The eighth word in a document is interesting", "document");
        text.put("The ninth word in a sentence is interesting", "sentence");
        text.put("The tenth word in a paragraph is interesting", "paragraph");
        text.put("The eleventh word in a sentence is interesting", "sentence");
        text.put("The twelfth word in a paragraph is interesting", "paragraph");
        text.put("The thirteenth word in a sentence is interesting", "sentence");
        text.put("The fourteenth word in a document is interesting", "document");
        text.put("The fifteenth word in a sentence is interesting", "sentence");
        text.put("The sixteenth word in a paragraph is interesting", "paragraph");
        text.put("The seventeenth word in a sentence is interesting", "sentence");
        text.put("The nineteenth word in a document is interesting", "document");
        text.put("The twentieth word in a sentence is interesting", "sentence");
        text.put("The twenty-first word in a paragraph is interesting", "paragraph");
        text.put("The twenty-second word in a sentence is interesting", "sentence");
        text.put("The twenty-third word in a document is interesting", "document");
        text.put("The twenty-fourth word in a document is interesting", "document");
        text.put("The twenty-fifth word in a document is interesting", "document");
        text.put("The twenty-sixth word in a document is interesting", "document");
        text.put("The first word in a sentence is interesting", "sentence");
        text.put("The second word in a sentence is interesting", "sentence");
        text.put("The third word in a sentence is interesting", "sentence");
        text.put("The fourth word in a paragraph is interesting", "paragraph");
        text.put("The fifth word in a sentence is interesting", "sentence");
        text.put("The sixth word in a paragraph is interesting", "paragraph");
        text.put("The seventh word in a sentence is interesting", "sentence");
        text.put("The eighth word in a document is interesting", "document");
        text.put("The ninth word in a sentence is interesting", "sentence");
        text.put("The tenth word in a paragraph is interesting", "paragraph");
        text.put("The eleventh word in a sentence is interesting", "sentence");
        text.put("The twelfth word in a paragraph is interesting", "paragraph");
        text.put("The thirteenth word in a sentence is interesting", "sentence");
        text.put("The fourteenth word in a document is interesting", "document");
        text.put("The fifteenth word in a sentence is interesting", "sentence");
        text.put("The sixteenth word in a paragraph is interesting", "paragraph");
        text.put("The seventeenth word in a sentence is interesting", "sentence");
        text.put("The nineteenth word in a document is interesting", "document");
        text.put("The twentieth word in a sentence is interesting", "sentence");
        text.put("The twenty-first word in a paragraph is interesting", "paragraph");
        text.put("The twenty-second word in a sentence is interesting", "sentence");
        text.put("The twenty-third word in a document is interesting", "document");
        text.put("The twenty-fourth word in a document is interesting", "document");
        text.put("The twenty-fifth word in a document is interesting", "document");
        text.put("The twenty-sixth word in a document is interesting", "document");
        text.put("The first word in a sentence is interesting", "sentence");
        text.put("The second word in a sentence is interesting", "sentence");
        text.put("The third word in a sentence is interesting", "sentence");
        text.put("The fourth word in a paragraph is interesting", "paragraph");
        text.put("The fifth word in a sentence is interesting", "sentence");
        text.put("The sixth word in a paragraph is interesting", "paragraph");
        text.put("The seventh word in a sentence is interesting", "sentence");
        text.put("The eighth word in a document is interesting", "document");
        text.put("The ninth word in a sentence is interesting", "sentence");
        text.put("The tenth word in a paragraph is interesting", "paragraph");
        text.put("The eleventh word in a sentence is interesting", "sentence");
        text.put("The twelfth word in a paragraph is interesting", "paragraph");
        text.put("The thirteenth word in a sentence is interesting", "sentence");
        text.put("The fourteenth word in a document is interesting", "document");
        text.put("The fifteenth word in a sentence is interesting", "sentence");
        text.put("The sixteenth word in a paragraph is interesting", "paragraph");
        text.put("The seventeenth word in a sentence is interesting", "sentence");
        text.put("The nineteenth word in a document is interesting", "document");
        text.put("The twentieth word in a sentence is interesting", "sentence");
        text.put("The twenty-first word in a paragraph is interesting", "paragraph");
        text.put("The twenty-second word in a sentence is interesting", "sentence");
        text.put("The twenty-third word in a document is interesting", "document");
        text.put("The twenty-fourth word in a document is interesting", "document");
        text.put("The twenty-fifth word in a document is interesting", "document");
        text.put("The twenty-sixth word in a document is interesting", "document");
        text.put("The twenty-third note in a ensemble is musical", "ensemble");
        text.put("The twenty-fourth note in a ensemble is musical", "ensemble");
        text.put("The twenty-fifth note in a ensemble is musical", "ensemble");
        text.put("The twenty-sixth note in a ensemble is musical", "ensemble");
        text.put("The first note in a ensemble is musical", "ensemble");
        text.put("The second note in a ensemble is musical", "ensemble");
        text.put("The third note in a ensemble is musical", "ensemble");
        text.put("The fourth note in a ensemble is musical", "ensemble");
        text.put("The fifth note in a ensemble is musical", "ensemble");
        text.put("The sixth note in a ensemble is musical", "ensemble");
        text.put("The seventh note in a ensemble is musical", "ensemble");
        text.put("The ninth note in a ensemble is musical", "ensemble");

        for (String str : text.keySet())
        {
            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

Examples of org.neo4j.graphdb.GraphDatabaseService

        GraphManager.patternCache.invalidateAll();
        DataRelationshipManager.relationshipCache.invalidateAll();
        ClassRelationshipCache.relationshipCache.invalidateAll();
        PatternRelationshipCache.relationshipCache.invalidateAll();

        GraphDatabaseService db = setUpDb();
        GraphManager graphManager = new GraphManager("Pattern");
        Node rootNode = getRootPatternNode(db, graphManager);

        Map<String, String> text = new HashMap<>();
        text.put("The first word in a sentence is interesting", "sentence");
        text.put("The second word in a sentence is interesting", "sentence");
        text.put("The third word in a sentence is interesting", "sentence");
        text.put("The fourth word in a paragraph is interesting", "paragraph");
        text.put("The fifth word in a sentence is interesting", "sentence");
        text.put("The sixth word in a paragraph is interesting", "paragraph");
        text.put("The seventh word in a sentence is interesting", "sentence");
        text.put("The eighth word in a document is interesting", "document");
        text.put("The ninth word in a sentence is interesting", "sentence");
        text.put("The tenth word in a paragraph is interesting", "paragraph");
        text.put("The eleventh word in a sentence is interesting", "sentence");
        text.put("The twelfth word in a paragraph is interesting", "paragraph");
        text.put("The thirteenth word in a sentence is interesting", "sentence");
        text.put("The fourteenth word in a document is interesting", "document");
        text.put("The fifteenth word in a sentence is interesting", "sentence");
        text.put("The sixteenth word in a paragraph is interesting", "paragraph");
        text.put("The seventeenth word in a sentence is interesting", "sentence");
        text.put("The nineteenth word in a document is interesting", "document");
        text.put("The twentieth word in a sentence is interesting", "sentence");
        text.put("The twenty-first word in a paragraph is interesting", "paragraph");
        text.put("The twenty-second word in a sentence is interesting", "sentence");
        text.put("The twenty-third word in a document is interesting", "document");
        text.put("The twenty-fourth word in a document is interesting", "document");
        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

Examples of org.neo4j.graphdb.GraphDatabaseService

    final public static String positiveSentimentDirectory = "../examples/graphify-examples-sentiment-analysis/src/main/resources/txt_sentoken/pos";


    @Test
    public void sentimentAnalysisTest() throws IOException {
        GraphDatabaseService db = setUpDb();
        GraphManager graphManager = new GraphManager("Pattern");

        // Invalidate all caches
        NodeManager.globalNodeCache.invalidateAll();
        DataNodeManager.dataCache.invalidateAll();
View Full Code Here

Examples of org.neo4j.graphdb.GraphDatabaseService

public class NodeManagerTest {

    @Test
    public void testGetOrCreateNode() throws Exception {
        GraphDatabaseService db = setUpDb();
        NodeManager nodeManager = new NodeManager();
        NodeManager.globalNodeCache.invalidateAll();
        DataNodeManager.dataCache.invalidateAll();
        DataNodeManager dataNodeManager = new DataNodeManager();

        // Write some nodes to the database
        Node a = nodeManager.getOrCreateNode(dataNodeManager, "a", db);
        Node b = nodeManager.getOrCreateNode(dataNodeManager, "b", db);
        Node c = nodeManager.getOrCreateNode(dataNodeManager, "c", db);
        Node d = nodeManager.getOrCreateNode(dataNodeManager, "d", db);
        Node e = nodeManager.getOrCreateNode(dataNodeManager, "e", db);
        Node f = nodeManager.getOrCreateNode(dataNodeManager, "f", db);
        Node g = nodeManager.getOrCreateNode(dataNodeManager, "g", db);

        Assert.assertNotNull(a);
        Assert.assertNotNull(b);
        Assert.assertNotNull(c);
        Assert.assertNotNull(d);
        Assert.assertNotNull(e);
        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

Examples of org.neo4j.graphdb.GraphDatabaseService

        return new TestGraphDatabaseFactory().newImpermanentDatabaseBuilder().newGraphDatabase();
    }

    @Test
    public void testSetNodeProperty() throws Exception {
        GraphDatabaseService db = setUpDb();
        NodeManager nodeManager = new NodeManager();
        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";
        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

Examples of org.neo4j.graphdb.GraphDatabaseService

        if (store == null) {
            AppShellServer server = getServer();
            if (!(server instanceof GraphDatabaseShellServer)) {
                throw new IllegalStateException("Unexpected server type " + server);
            }
            GraphDatabaseService db = ((GraphDatabaseShellServer) server).getDb();
            store = new GraphDbStore(db);
        }
        return store;
    }
View Full Code Here

Examples of org.neo4j.graphdb.GraphDatabaseService

    }

    @Override
    public void init(Collection<TypeMetadata<NodeMetadata>> registeredMetadata) {
        EmbeddedNeo4jDatastoreSession session = createSession();
        GraphDatabaseService graphDatabaseService = session.getGraphDatabaseService();
        try (Transaction transaction = graphDatabaseService.beginTx()) {
            for (TypeMetadata<NodeMetadata> typeMetadata : registeredMetadata) {
                IndexedPropertyMethodMetadata<IndexedPropertyMetadata> indexedPropertyMethodMetadata = typeMetadata.getIndexedProperty();
                if (indexedPropertyMethodMetadata != null && indexedPropertyMethodMetadata.getDatastoreMetadata().isCreate()) {
                    Label label = typeMetadata.getDatastoreMetadata().getDiscriminator();
                    PrimitivePropertyMethodMetadata propertyMethodMetadata = indexedPropertyMethodMetadata.getPropertyMethodMetadata();
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.