graph-databases

Fetching all the paths between two nodes using gremlin in java

↘锁芯ラ 提交于 2019-12-11 13:17:48
问题 Hi I am kinda new to gremlin and trying to achieve some solve by finding all the paths between two nodes. In simple query on gremlin console I was able to do that using this query : (Name of the first Node).loop(1){it.loops<100}{true}.has('name', (Name of the second node)).path{it.name} But while I was trying to fetch that from java methods I am into sea of problems, like: -- no clue on where to put the query exactly ? -- what data structure will be right to receive the array of rows. -- how

Using Neo4j to build a Master Data Management

佐手、 提交于 2019-12-11 12:36:59
问题 I am trying to use Neo4j to build an MDM. I am just trying to model our customer database with some properties, like email, documentNumber, address, phone, mobilephone and so on. The problem is that our database is too dirty. For example, I have users with same documentNumber (it is like a ssn.). And when I look to these registries I can see that they are actually the same person. For discover pattern through relationship I need to dedup/clean records. But I am afraid of loosing information

How to import relationships between nodes of the same label from a csv file in neo4j?

眉间皱痕 提交于 2019-12-11 12:17:05
问题 I have two separate csv files that I need to import into my neo4j database. The first file contains all the nodes that I wish to import. The information is classified as follows: id, Name 1, Earth science To import it, I successfully used the following code: LOAD CSV WITH HEADERS FROM 'file:///Node_test.csv' AS line CREATE (:Discipline { id: toInt(line.id), name: line.Name}) Now, I want to import my relationship file and create all the relationship between the nodes I just imported. The

Node reuse, instead of creating new ones?

我只是一个虾纸丫 提交于 2019-12-11 12:03:21
问题 I'm trying to create (action)->(state) pair in such a way so that if : the action exists, use it, instead of creating new one the state exists, use it, instead of creating new one and do it in single query. The one I have creates new action node if the state is different, from previous calls. So I end up with multiple action nodes which are the same. query = "merge (:state {id:%s})-[:q {q:%s}]->(:action {id:%s})" % (state, 0, action) I use radis-graph. The only way is to use 3 queries instead

Accessing Connected Vertices in OrientDB Javascript Functions

南笙酒味 提交于 2019-12-11 09:41:43
问题 I'm attempting to use the build in Functions in OrientDB studio to group Workstations that aren't in use by a Person. The query to get these vertices works fine but I'm trying to avoid Traverse as it is very slow - too slow to be used in production. Instead of iterating through each free station and grouping it together with all it's neighbours, keeping each grouped 'named' with the smallest @rid in the set. var groups = {}; //The list of groups of workpoints. The key is the lowest RID in the

How do i create relationships for existing nodes by importing csv file in neo4j?

﹥>﹥吖頭↗ 提交于 2019-12-11 07:09:22
问题 lets say i have created [a],[b],[c],[d] nodes in neo4j. how to create relationships among those nodes by importing csv data. csv data: id,fromNode,toNode,typeOfRelation 1,a,b,KNOWs 2,b,c,FOLLOWS 3,d,a,KNOWS .... 回答1: I would do it like this way if your Nodes are in the Graph already. CREATE INDEX ON :Label(name); LOAD CSV WITH HEADERS FROM "file:///<PathToYourCSV>" as input MATCH (from:Label {name: input.fromNode}), (to:Label {name: input.toNode}) CREATE (from)-[:RELATION { type: input

how to speed up insertion in neo4j from mysql?

左心房为你撑大大i 提交于 2019-12-11 06:51:19
问题 I have a dataset of 60000 items in mysql and i'm trying to insert it into neo4j. The insertion is taking place but it's taking a long time( approx. 10-15 per 3 sec). Is there any way i can speed it up? also is there any way i could give something such as unique key in neo4j so duplication indexes won't get indexed? I'm new to neo4j. I'm using neo4j 1.8 with PHP Everyman driver. 回答1: There is a nice presentation from Max De Marzi, about ETL into Neo4j. See: http://www.slideshare.net/maxdemarzi

Use views and table valued functions as node or edge tables in match clauses

淺唱寂寞╮ 提交于 2019-12-11 06:24:39
问题 I like to use Table Valued functions in MATCH clauses in the same way as is possible with Node tables. Is there a way to achieve this? The need for table valued functions There can be various use cases for using table valued functions or views as Node tables. For instance mine is the following. I have Node tables that contain NVarChar(max) fields that I would like to search for literal text. I need only equality searching and no full text searching, so I opted for using a index on the hash

Neo4J cypher query to get nodes connected by paths with the same generic attribute

情到浓时终转凉″ 提交于 2019-12-11 05:45:54
问题 I'm trying to create a cypher query that returns me the nodes connected by a given range of hops (i.e. 1..5), where all the relationships between these hops share a same attribute value, without specifying this attribute. So I would like to do something like MATCH (a {type: 'cin1'})-[rels:Next*1.. {value: 1}]->(b {type: 'cancer'}) RETURN (a), (b) But without specifying that the value on the edges should be one, they just need to be equal among all the edges in the hopping process. 回答1: I

Load Neo4J in memory on demand for heavy computations

烈酒焚心 提交于 2019-12-11 04:48:41
问题 How could I load Neo4J into memory on demand? On different stages of my long running jobs I'm persisting nodes and relationships to Neo4J. So Neo4J should be on disk, since it may consume too much memory and I don't know when I gonna run read queries against it. But at some point (only once) I will want to run pretty heavy read query against my Neo4J server, and it have very poor performance (hours). As a solution I want to load all Neo4J to RAM for better performance. What is the best option