graph-databases

Neo4j slow creation method [closed]

余生颓废 提交于 2019-12-06 02:38:15
Closed. This question is off-topic . It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 4 years ago . In my Neo4j/Neo4j Spring Data application I have a following entities: VoteGroup contains relationships VOTED_ON and VOTED_FOR to entities Criterion and Decision and list of Vote @NodeEntity public class VoteGroup extends BaseEntity { private static final String VOTED_ON = "VOTED_ON"; private final static String VOTED_FOR = "VOTED_FOR"; private final static String CONTAINS = "CONTAINS"; @GraphId private Long id;

Stored procedure in Neo4j

帅比萌擦擦* 提交于 2019-12-06 02:16:44
问题 I wanted to know if there is any Neo4j equivalent of a stored procedure? When I researched this, I came across events , but I found them more like triggers and not stored procedures. 回答1: Stored procedures are available as capabilities CALLABLE from the Cypher language since version 3.0 A first reference can be found here https://dzone.com/articles/neo4j-30-stored-procedures A remarkable example, showing how graph can be processed in the large through procedure to achieve network clustering

Error in Executing Neo4j Cypher Query (by Java) embedded mode

廉价感情. 提交于 2019-12-06 01:38:32
Im having error in executing Cypher query in java (embedded mode) This is my code: import org.neo4j.cypher.internal.ExecutionEngine; import org.neo4j.cypher.internal.ExecutionResult; import org.neo4j.graphdb.GraphDatabaseService; import org.neo4j.graphdb.factory.GraphDatabaseFactory; public class test { public static void main(String[] args) { GraphDatabaseFactory graphdbFactory = new GraphDatabaseFactory(); GraphDatabaseService graphdb = new graphdbFactory.newEmbeddedDatabase("C:/Users/dell/Documents/Neo4j"); ExecutionEngine execEngine = new ExecutionEngine(graphDb); ExecutionResult

How to get nodes that have a given amount of outgoing relationships with a given property in Neo4j Cypher?

末鹿安然 提交于 2019-12-06 00:51:50
In my domain a node can have several relationships of the same type to other entities. Each relationship have several properties and I'd like to retrieve the nodes that are connected by at least 2 relationships that present a given property. EG: A relationship between nodes have a property year . How do I find the nodes that have at least two outgoing relationships with the year set to 2012 ? Why Chypher query so far looks like this (syntax error) START x = node(*) MATCH x-[r:RELATIONSHIP_TYPE]->y WITH COUNT(r.year == 2012) AS years WHERE HAS(r.year) AND years > 1 RETURN x; I tried also

TITAN : Gremlin query returns inconsistent results on repeated execution

元气小坏坏 提交于 2019-12-05 19:41:01
I am running REXSTER/TITAN 0.4 over cassandra and uses gremlin for traversals. I ran below gremlin query in Rexster Doghouse Gremlin console. Vertex 92 was deleted earlier, since it was a duplicate vertex with same key ("eddy.com") But when I am querying, I am getting that vertex sometimes, and sometimes not . This is running in local dev machine, means no other threads or parallel task is running/updating this vertex in between. Am I missing any configuration/settings here? is this a bug? please help! gremlin> g.V('domain','eddy.com') ==>v[88] gremlin> g.V('domain','eddy.com') ==>v[88] ==>v

Neo4J - Storing into relationship vs nodes

大兔子大兔子 提交于 2019-12-05 14:01:46
I was wondering if there are any advantages or disadvantages in storing data into relationships or nodes. For example, if I were to store comments related to a discussion into the DB, should I store the comment data in a "comment" relationship or a "comment" node that is related to the discussion through a separate relationship. The correct data model depends on the types of queries you need to make. You should figure out what your queries are, and then determine a data model that meets these criteria: It allows you to answer all your queries, It allows your queries to finish sufficiently

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

早过忘川 提交于 2019-12-05 11:10:06
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 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 and pitfalls from relational modelling get transferred over to the graph model and introduce other oddities.

Neo4j - NOT IN query

不羁岁月 提交于 2019-12-05 10:36:21
The graph schema I have is (actors)-[:ACTED_IN]->(movies) . I know how to find actors who have worked with a particular actor as below: MATCH (actor {name:"Tom Hanks"} )-[:ACTED_IN]->(movies)<-[:ACTED_IN]-(costars) return distinct costars; I know how to find all the actors who have worked in some movie: MATCH (all_actor)-[:ACTED_IN]->(movies) return distinct all_actor; However I don't know how to find all actors not in costars. How do I go about it? Michael Hunger As you want to deduct the coactors from the global list of actors this is not the best graph query, here are some suggestions. //

How to use OrientDB ETL to create edges only

半世苍凉 提交于 2019-12-05 07:52:28
I have two CSV files: First containing ~ 500M records in the following format id,name 10000023432,Tom User 13943423235,Blah Person Second containing ~ 1.5B friend relationships in the following format fromId,toId 10000023432,13943423235 I used OrientDB ETL tool to create vertices from the first CSV file. Now, I just need to create edges to establish friendship connection between them. I have tried multiple configuration of the ETL json file so far, the latest being this one: { "config": {"parallel": true}, "source": { "file": { "path": "path_to_file" } }, "extractor": { "csv": {} },

How to merge nodes that have the same value for name property in Neo4j

拜拜、爱过 提交于 2019-12-05 07:40:41
I just push text corpus into Neo4j database. When I execute MATCH (n) RETURN n Cypher query, it returns multiple nodes with the same name. how can I merge these nodes as one? nodes having same name Your name values have different values because of upper and lower case letters ("Java" and "java" are different). I reproduced your scenario creating a sample data set: CREATE (n1:Node {name : "Java"}), (n2:Node {name : "Java"}), (n3:Node {name : "java"}), (n1)-[:TYPE]->(), (n1)-[:TYPE]->(), (n1)-[:TYPE]->(), (n2)-[:TYPE]->(), (n2)-[:TYPE]->(), (n3)-[:TYPE]->() The above query will produce this