Extract subgraph in neo4j

As for graph matching, that has been superseded by http://docs.neo4j.org/chunked/snapshot/cypher-query-lang.html which would fit nicely, and supports fuzzy matchin with optional relationships. For subgraph representation, I would use the Cypher output to maybe construct new Cypher statements for recreating the graph, much like a SQL export, something like start n=node:node_auto_index(name=”Neo”) match n-[r:KNOWS*]-m return “create ({name:'”+m.name+”‘});” http://console.neo4j.org/r/pqf1rp … Read more

Gremlin remove all Vertex

In more recent terms as of Gremlin 2.3.0, removal of all vertices would be best accomplished with: g.V.remove() UPDATE: For version Gremlin 3.x you would use drop(): gremlin> graph = TinkerFactory.createModern() ==>tinkergraph[vertices:6 edges:6] gremlin> g = graph.traversal() ==>graphtraversalsource[tinkergraph[vertices:6 edges:6], standard] gremlin> g.V().drop().iterate() gremlin> graph ==>tinkergraph[vertices:0 edges:0] Note that drop() does not automatically iterate the Traversal … Read more

Node identifiers in neo4j

Think of the node-id as an implementation detail (like the rowid of relational databases, can be used to identify nodes but should not be relied on to be never reused). You would add your natural keys as properties to the node and then index your nodes with the natural key (or enable auto-indexing for them). … Read more

Casting nodes of an unknown type

You could (depending on how you feel about it) try using dynamic, for example, you can set it up like so: var dog = new Dog {Name = “Woofer”, Breed = “Afghan Hound”}; var owner = new Person {Name = “Jeff”, PhoneNumber = “01234567890”}; //CREATE gc.Cypher. Create(“(owner:Person {ownerParams})”) .WithParam(“ownerParams”, owner) .With(“owner”) .Create(“(owner)-[:HAS_PET]->(dog:Dog {dogParams})”) .WithParam(“dogParams”, dog) … Read more

Search list with mutual count (2nd try)

As I said in my comment, trying to query for connected and disconnected nodes at the same time doesn’t seem to be a good idea. If you want only connected nodes, try the following query : START me=node:node_auto_index(UserName=”manish”) MATCH me-[:friends]-mf-[:friends]-other, me-[r?]-other WHERE other.UserName! =~ ‘(?i)dh.*’ RETURN DISTINCT ID(other), r.ApprovalStatus AS status, count(mf) AS mutual, ID(me) … Read more

Is there a way to show cypher execution plan?

You can still find the neo4j shell, where you can run the profile command. Either by connecting to the running server by starting bin/neo4j-shell Or by switching to the old web-ui in the “(i)” Info-menu on the left side and selecting the bottommost link “webadmin” -> http://localhost:7474/webadmin Profiling information will be added to browser later … Read more

Does Karate supports Neo4j Database?

Karate supports any Java code so that way indirectly you should be able to do anything you want. Please look at this JDBC example which will get you started: dogs.feature. You will need to write a little bit of Java code (one time only) so if you don’t have that skill, please ask someone to … Read more