public void generate(String dbPath) { EmbeddedGraphDatabase graphDb = new EmbeddedGraphDatabase(dbPath); Index<Node> nodeIndex = graphDb.index().forNodes("nodes"); Index<Relationship> relationshipIndex = graphDb.index().forRelationships("relationships"); graphDb.beginTx(); Node n = graphDb.createNode(); Relationship rel = graphDb.getReferenceNode().createRelationshipTo(n, REL_TYPE); nodeIndex.add(n, "name", "a"); relationshipIndex.add(rel, "name", "a"); }
@Override public void run(EmbeddedGraphDatabase graphdb) { Node node = graphdb.index().forNodes("nodes").get("value", "indexed").getSingle(); if (!acceptNull) assertNotNull("node not in index", node); if (node != null) assertEquals("indexed", node.getProperty("value", null)); resumeThread(); }
@Override public void run(EmbeddedGraphDatabase graphdb) { Node node = graphdb.getReferenceNode(); Transaction tx = graphdb.beginTx(); try { // First do the index operations, to add that data source first graphdb.index().forNodes("nodes").add(node, "value", "indexed"); // Then update the graph node.setProperty("value", "indexed"); enableBreakPoint(); tx.success(); } finally { tx.finish(); } done(); }
public IndexManager index() { return inner.index(); }