cypher

Neo4j: Listing node labels

天涯浪子 提交于 2019-12-13 06:39:39
问题 I have 2 hierarchies in my database. Hierarchy 1: Company{name:'ABC', CompanyId:1,} <-- Category <-- SubCategory <-- Service <-- Asset <-- Anomaly Hierarchy 2: Company{name:'XYZ', CompanyId:21,} <-- Category <-- Service <-- Asset <-- Anomaly What is the best way to query node labels in my hierarchy for a CompanyId? I am looking for an output in the following format: CompanyId:1 Company Category SubCategory Service Anomaly CompanyId:2 Company Category Service Anomaly Thanks. 回答1: Assuming that

Cypher Query not finding Node

↘锁芯ラ 提交于 2019-12-13 06:19:48
问题 I have created an embedded Neo4J in a Java project like this: graphDb = new GraphDatabaseFactory() .newEmbeddedDatabaseBuilder("db") .setConfig(GraphDatabaseSettings.node_keys_indexable, "movieId, userId, rating, genre") .setConfig(GraphDatabaseSettings.node_auto_indexing, "true") .newGraphDatabase(); I have verified that the index is created, and it has the name that I expect: Index<Node> index = graphDb.index().forNodes("movieId"); System.out.println("::: Verify Index Name :::"); System.out

Returning property and count columns together in Neo4jClient Cypher Query

元气小坏坏 提交于 2019-12-13 06:13:19
问题 I have a Cypher query likes this: START n=node:permit_idx(PmtID= "111") Match n-[:Assinged]->m<-[:Assinged]-p RETURN p.PmtID, count(m); I got error when I try to do it using Neo4jClient Cypher Query var results = graphClient .Cypher .Start(new { n = Node.ByIndexLookup("permit_idx", "PmtID", "111") }) .Match("Match n-[:Assigned]->m<-[:Assigned]-p") .Return((m, p) => new { PDPmtID = "p.PmtID", MCount = "count(m)" }) .Results; If only need to return one property or one count, we can use .Return

How to import data into neo4j (neo4j-community-2.0.0) in windows 7?

China☆狼群 提交于 2019-12-13 05:59:02
问题 I got the below link to do this but the problem is that it's for linux users !!! http://blog.neo4j.org/2013/03/importing-data-into-neo4j-spreadsheet.html Please help me to get this done on windows ? Thanks in advance. I am new to neo4j and got only a little hands on experience on java. I added neo4jtools to my neo4j server from the below link https://github.com/jexp/neo4j-shell-tools then I follow this command to import few data to a graph database neo4jshell -path C:\Program Files\neo4j

Cypher (using bolt) multiple unrelated queries at once - match and modify (set property) of multiple nodes in single query

血红的双手。 提交于 2019-12-13 05:55:41
问题 I have nodes of 5 different labels, say, A, B, C, D, E . I need to match a node of each type based on some property and update some other property of the matched node. The query works perfectly fine if i execute 5 different match and set queries, one for each label type. However, when I try to do everything in one single query, the property seems to get updated multiple times. The property I am updating is an array (the same value gets added to the array multiple times). The following is the

Issues loading data patterns from CSV

≡放荡痞女 提交于 2019-12-13 05:50:21
问题 I try to load data patterns into neo4j from cvs files using cypher command lines. I have two data files, one containing objects, the other containing object parts. Object file: ID ABC-DE DEF Part file: ID ParentID Level Size ABC ABC-DE 1 3 DE ABC-DE 1 2 AB ABC 2 2 BC ABC 2 2 DE DEF 1 2 F DEF 2 1 A AB 3 1 B AB 3 1 B BC 3 1 C BC 3 1 D DE 3 1 E DE 3 1 Cypher command lines used to load data: LOAD CSV WITH HEADERS FROM 'file:///path_to_file/object.csv' as csvLine FIELDTERMINATOR '\t' CREATE (

query for name not like other name in neo4j cypher

六眼飞鱼酱① 提交于 2019-12-13 05:47:40
问题 I'm trying to find nodes where node1's name is NOT contained in node2's name and vice versa. I've tried this and variants of it. getting regex errors, not sure how to include the other node's literal name, and also how to do NOT includes. START node1=node(*) MATCH node1-[r]-node2 WHERE node1.name !~ '.*{node2.name}.*' and node2.name !~ '.*{node1.name}.*' RETURN node1.name, node2.name limit 10; 回答1: I'll try to answer how to get your query to work, but this type of query looks a bit irregular

Neo4j - Calculate similarity and Insert a new relationship between nodes if not exists

谁说胖子不能爱 提交于 2019-12-13 05:19:41
问题 Edited: I need to check whether the relationship exists or not. If not exists then calculate similarity between nodes, which is bit time taking. And then, i need to insert the relation ship between them. I need to do the repeat this for all the pair of nodes in the graph. Programmatic paradigm for this scenario is like: If relationship exits then calculate similarity and insert relationship else do nothing (or) return value There is also problem with this query is, it may also cause memory

Neo4J Query with multiple filter does not return the expected result

时光总嘲笑我的痴心妄想 提交于 2019-12-13 05:19:07
问题 I am using the following Neo4JClient code to query for all the shipment count that is due within a wee, one week to 21 days and greater than 21 days. var query = GraphClient.Cypher .Merge("(user:Person{InternalId:{userId}})") .WithParam("userId", userId) .With("user") .Match("(veh:Vehicle)<-[:HAS_VEHICLE_TYPE]-(load:ActiveShipment)-[:SHIPPED_BY]->(shipper:Shipper), (user)-[:WORKS_FOR_COMPANY]->(transporter:Transporter)") .Where("((load.RestrictedBidding = false) OR (user)-[:WORKS_FOR_COMPANY]

Neo4jClient Create Unique results in multiple duplicate nodes

╄→гoц情女王★ 提交于 2019-12-13 05:11:12
问题 I was wondering if some one can help me understand how Create Unique actually works in Neo4J. I am trying to register multiple addresses to a shipper node, where I expect the City, State and country to be same across the addresses so that they all point to the same node. However the issue is that the Create Unique is resulting in multiple instance of same node in the database. Here is the function I have to register an address with the shipper which I call multiple times with same Shipper