neo4j

Neo4j 2.0.1 graphstyle.grass for multiple labels

耗尽温柔 提交于 2019-12-22 08:40:42
问题 I'm having a hard time setting properties for nodes with multiple labels. My graphstyle.grass file looks like this: node { diameter: 40px; color: #aaaaaa; border-color: #888888; border-width: 1.5px; text-color-internal: #000000; caption: '{name}'; font-size: 12px; } node.foo { color: #aaaaff; } node.bar { color: #aaffaa; } node.bar.a { border-color: #ff0000; } node.bar.b { border-color: #0000ff; } So the intention here is that if you have a label of 'bar' the node is colored a certain way, if

Cypher SORT performance

偶尔善良 提交于 2019-12-22 08:32:14
问题 I'm trying to accomplish a pretty common task. I have a substantial dataset in a Neo4J database and, from a RESTful web service, i want to return the data in chunks of 25 nodes. My model is quite simple: (:Tenant {Hash:''})-[:owns]->(:Asset {Hash:'', Name:''}) I have unique constraints on the Hash properties on both labels. If i wanted to obtain the 101th data page, my cypher query would look like this: MATCH (:Tenant {Hash:'foo'})-[:owns]->(a:Asset) RETURN a ORDER BY a.Hash SKIP 2500 LIMIT

How to get last node created in neo4j?

左心房为你撑大大i 提交于 2019-12-22 08:16:22
问题 So I know when you created nodes neo4j has a UUID for each node. I know you can access a particular node by that UUID by accessing the ID. For example: START n=node(144) RETURN n; How would I get the last node that was created? I know I could show all nodes and then run the same command in anotehr query with the corresponding ID, but is there a way to do this quickly? Can I order nodes by id and limit by 1? Is there a simpler way? Either way I have not figured out how to do so through a

How can I get all the hops in a path of unknown length with neo4j-python?

旧街凉风 提交于 2019-12-22 08:01:57
问题 MATCH (u:User {name:{user}}), (target:Group {name: {group}}), p=shortestPath((u)-[*]->(target)) RETURN p When I run the above query in the Neo4j web UI, a fell graph of the resulting paths is displayed. However, when I run the same query with the neo4j-python driver, only a Path objects with limited information are returned <Path start=479557 end=404582 size=1> How can I use Cypher and python to get complete path details, including all nodes and the relationships that connect them? 回答1:

How to model a relational database into a neo4j graph database?

南楼画角 提交于 2019-12-22 07:10:09
问题 I have a relational database (about 30 tables) and I would like to transpose it in a neo4j graph database, and I don't know where to start... Is there a general way to transpose tables and/or tuples into a graph model ? (relations properties, one or more graphs ?) What are the best sources of documentation ? Thanks for any help, Best regards 回答1: First, if at all possible, I'd suggest NOT using your relational DB as your "reference" for transposing to a graph model. All too often, mistakes

How to use relationship index in Cypher

我只是一个虾纸丫 提交于 2019-12-22 06:57:07
问题 I'm using neo4j 2.1.4. I have nodes - POINT and relationships - ROAD I have index on ROAD property - OBJ_COD :schema ls -l :ROAD Indexes ON :ROAD(OBJ_COD) ONLINE ON :ROAD(ID) ONLINE No constraints I want to search ROAD by OBJ_COD value, but cypher don'use index to lookup relationship. neo4j-sh (?)$ profile MATCH (a)-[r:`ROAD` {ID:333275}]-(b:`POINT`) RETURN r LIMIT 1; ColumnFilter | +TraversalMatcher +------------------+------+---------+-------------+----------------+ | Operator | Rows |

DynamicProperties in Spring Data Neo4j 4

落花浮王杯 提交于 2019-12-22 06:46:57
问题 I'm using DynamicProperties of Spring Data Neo4j 3.x. I'm missing this class in Spring Data Neo4j 4.0.0.M1 (SDN4). I there a new concept in SDN4 to store dynamic property values? A DynamicProperties property on a @NodeEntity stores all its properties dynamically on the underlying node itself. The key/value pairs of the DynamicProperties member are stored on the node with the keys prefixed with the property name that is returned by DelegatingFieldAccessorFactory#getNeo4jPropertyName(Field) .

How to optimize Neo4j Cypher queries with multiple node matches (Cartesian Product)

我们两清 提交于 2019-12-22 06:35:45
问题 I am currently trying to merge three datasets for analysis purposes. I am using certain common fields to establish the connections between the datasets. In order to create the connections I have tried using the following type of query: MATCH (p1:Person),(p2:Person) WHERE p1.email = p2.email AND p1.name = p2.name AND p1 <> p2 CREATE UNIQUE (p1)-[IS]-(p2); Which can be similarly written as: MATCH (p1:Person),(p2:Person {name:p1.name, email:p1.email}) WHERE p1 <> p2 CREATE UNIQUE (p1)-[IS]-(p2);

Bad performance with OR operator

半腔热情 提交于 2019-12-22 05:21:46
问题 I'm trying to run a query over 582479 genes using the OR operator, after creating index on the properties: symbol, primaryidentifier, secondaryidentifier and name. This the query: PROFILE MATCH(g:Gene) WHERE g.symbol="CG11566" OR g.primaryidentifier="CG11566" OR g.secondaryidentifier="CG11566" OR g.name="CG11566" RETURN g.id, g.primaryidentifier, g.secondaryidentifier, g.symbol, g.name ORDER BY g.id; The performance is very poor, the indexes created are not used but only the label scan->

Neo4j Multi-tenancy

左心房为你撑大大i 提交于 2019-12-22 05:03:15
问题 What is the best way to achieve multi-tenancy in neo4j? I have seen Tinkerpop and Spring Data. I'm have multiple clients and I would like to store client info in its own database to ensure security. I do not want to use labels or indexes to solve this problem. 回答1: You mention that you've "seen TinkerPop" but I couldn't tell if that meant you've seen it, considered it and dismissed it as a solution here, so apologies if that is the case and I'm not answering your question. I've successfully