neo4j

Neo4j : Retrieving All Nodes and Relationship connected to a Node in Neo4j Rest OR through Cypher

北城以北 提交于 2019-12-10 16:39:54
问题 I want to Retrieve all nodes and relationship connected to a node. I Tried to do this in two ways: 1st Through Neo4j REST API i Tried this URI traverserUri = new URI( startNode.toString() + "/traverse/node" ); WebResource resource = Client.create() .resource( traverserUri ); String jsonTraverserPayload = t.toJson(); ClientResponse response = resource.accept( MediaType.APPLICATION_JSON ) .type( MediaType.APPLICATION_JSON ) .entity( jsonTraverserPayload ) .post( ClientResponse.class ); System

How to store a map or json object as a property in neo4j?

别等时光非礼了梦想. 提交于 2019-12-10 16:38:28
问题 I'm trying store a map or json object as a property in Neo4j, but it doesn't work. 回答1: That's a limitation of node properties right now. You have a few workarounds to choose from. You can turn your json object into a string and save it as a property. You can use APOC Procedures to convert JSON strings to and from Cypher map objects. You can instead save the map properties as properties on the node, though that loses the grouping you would get from the object itself. If #2 isn't enough, you

Store and its lock file has been locked by another process: /var/lib/neo4j/data/databases/graph.db/store_lock

青春壹個敷衍的年華 提交于 2019-12-10 16:02:05
问题 what I did neo4j console (work fine) ctrl - C upon restarting I have message above. I delete /var/lib/neo4j/data/databases/graph.db/store_lock then I have Externally locked: /var/lib/neo4j/data/databases/graph.db/neostore Is there any way of cleaning lock ? (short of reinstalling) 回答1: You can kill the java process and delete the store_lock file. It doesn't seem to harm the database integrity. 回答2: Killing the Java process and deleting the store_lock worked for me: Found the lingering process

cyhper combine two columns into a single

南楼画角 提交于 2019-12-10 15:59:41
问题 I couldn't find a similar post, so if you already know one or if my question is not the proper one, please let me know. I have this query MATCH (t:Taxi {name:'Taxi1813'})<-[:ASSIGNED]-(u2:User)-[rd2:DROP_OFF]-> (g2:Grid)-[r:TO*1..2]-(g:Grid)<-[rd:DROP_OFF]-(u:User)-[:ASSIGNED]->(t) WHERE ID(u2) < ID(u) AND rd2.time >= '04:38' AND rd2.time <= '04:42' WITH DISTINCT u2, g2, u, g, rd2, rd MATCH p=shortestPath((g2)-[r:TO*1..2]-(g)) WITH rd2, rd,u2, g2, u, g, p, REDUCE(totalTime = 0, x IN

What are the Cypher commands to delete index and index entry

ⅰ亾dé卋堺 提交于 2019-12-10 15:47:04
问题 If I use the default Lucene index engine, what is the Cypher command to delete an index? and what is the Cypher command to delete an index entry within a specific index? 回答1: I do not know if your question is out of date because you know use a newer version of Neo4j but in version 2.2.1 there is the possibility to drop an index using Cypher via DROP INDEX ON :Label(property) 回答2: Well, I'm not sure if there's a way to delete an Index using Cypher .. But you can do it using Neo4j API as

Neo4j Cypher query: order collection, take first n elements

陌路散爱 提交于 2019-12-10 15:45:33
问题 I'm having trouble writing a Cypher query for this social networking type of application. It involves users that add posts (essentially an image with a description), which users can review. In Cypher the graph model is this: (user)-[:WROTE_REVIEW]->(review)-[:EVALUATES]->(post) The query I'm trying to write should return all the posts that a particular user has reviewed, along with some general information about the reviews of a post. This includes: (the post's ID) the post's image the post's

Range queries in Neo4j using Lucene query syntax

我怕爱的太早我们不能终老 提交于 2019-12-10 15:28:10
问题 I'm using Lucene to index nodes in a Neo4j database and I'm using Lucene query strings to perform queries. Everything behaves as expected when I perform range queries that are either exclusive or inclusive on both ends: Index.query("value:[1 TO 10]"); // Inclusive range query Index.query("value:{1 TO 10}"); // Exclusive range query However, it doesn't seem to work if I specify one end of the range query to be exclusive and the other to be inclusive, for example: Index.query("value:[1 TO 10}")

How to return a composite object in Neo4j/Cypher

余生颓废 提交于 2019-12-10 15:26:12
问题 I'd like to return a composite object from Neo4j using cypher to tidy up my queries. To give an example, I have a user account object that has permissions stored as relationships. The permissions are complex objects so can't be nested, they are now linked by the relationship [:HAS_PERMISSION]. What i'd like to do is return the full complex object with the permissions already nested, like in the example JSON object below e.g. permissions: { action:'delete', resource:'blog posts' } { action:

Neo4j “Can't wait on resource” lock error

倾然丶 夕夏残阳落幕 提交于 2019-12-10 15:18:17
问题 I am using Node.js to connect to a hosted GrapheneDB Neo4j database and when attempting to add about 1,500 records I get the following error: LockClient[19] can't wait on resource RWLock[NODE(248), hash=1917331445] since => LockClient[19] <-[:HELD_BY]- RWLock[INDEX_ENTRY(153122458561043471), hash=1171319680] <-[:WAITING_FOR]- LockClient[15] <-[:HELD_BY]- RWLock[NODE(248), hash=1917331445] The code that generates this comes from a route that takes a list of JSON objects and then stores them in

How to find the shortest path with the minimum number of hops in Neo4j?

*爱你&永不变心* 提交于 2019-12-10 15:16:57
问题 Im modeling a graph where nodes are places and edges indicate that you can go from one place to another. This is to have all routes that you can take from a place to another, and you can go from a place to another by different routes, so I want a query that returns me the shortest path with the minimum route changes. For example, I want to go from A to D, I have two possible paths: (place {name: "A"})-[:FOLLOWS{route:""R1}]->(place{name: "B" })-[:FOLLOWS{route:""R4}]->(place{name:"C"})-[