Questions tagged [cypher]

Cypher is a graph query language for Neo4j and AgensGraph. For ciphers as in encryption, see cipher.

Cypher is a declarative graph query language provided by the graph database.

If you are doing encryption, use the tag (note spelling) or .

9748 questions
2
votes
1 answer

Delete all but the top-k nodes of some query

I try to replicate the behaviour of the following SQL query in neo4j DELETE FROM history WHERE history.name = $modelName AND id NOT IN ( SELECT history.id FROM history JOIN model ON model.id = history.model_id ORDER BY created DESC …
joe776
  • 1,106
  • 14
  • 23
2
votes
2 answers

match a node that has direct links to all nodes in a set

When there is only 2 nodes in the set , it's relatively easy MATCH (a:Article {id : "PMID:16009338"}),(c:Article {id: "PMID:21743479"}) WITH a, c MATCH (a)-[r]-(d)-[r1]-(c) RETURN d But a similar attempt with 3 nodes didn't work MATCH (a:Article…
user732456
  • 2,638
  • 2
  • 35
  • 49
2
votes
0 answers

Neo4j - Import very large CSV into existing Database

I'm quite new to Neo4j and already lost with all the out of date documentation and very unclear commands, their effect or speed. I am looking for a way to import some very large data fast. The data is in B scale for one kind of data, split into…
Einharch
  • 69
  • 1
  • 4
2
votes
2 answers

Cypher query with ORDER BY on translation with fallback

I have the following data model: node entity BusinessObject node entity Translation containing a language and a text property relationship TRANSLATES from translation to the business object, potentially multiple The translations allow me to…
Steffen Harbich
  • 2,639
  • 2
  • 37
  • 71
2
votes
1 answer

How to get the minimum relational scope for multiple input nodes?

The statement below creates a representative data set in Neo4j. I want to return the minimum relational graph for a given set of input nodes. e.g., the minimum relational graph for the set of nodes "C", "G", "D" is "C, G, D"; and for "A", "E" it…
Ray.xia
  • 21
  • 1
2
votes
1 answer

apoc.export.csv.query runs without completing

I'm trying to execute a csv export using the APOC procedure library, specifically, the procedure CALL apoc.export.csv.query The procedure runs forever even with a simple query, for example: CALL apoc.export.csv.query("match (m:Movie) where…
anarche
  • 536
  • 4
  • 19
2
votes
0 answers

Neo4j Shortest Path / Minimum nodes

I have the following neo4j database design: Nodes: Courses Skills Jobs Relationships: Courses have Skills Jobs have skills ** Both Courses and Skills have no linearity/dependencies. E.g. It is not necessary to take course A in order to take…
Adam
  • 21
  • 2
2
votes
2 answers

Hide middle nodes in neo4j (Browser)

My question is the following. I have the following node relationship: (Student)-[:StudiesIn]->(Class)<-[:Teaches]-(Professor) I'm trying to display on the graph generator in the browser a query like: MATCH st=(a:Student)-[]-()-[]-(sir:Professor)…
Myxoh
  • 93
  • 9
2
votes
2 answers

Cypher Query where 2 different labels do not contain a relationship to a 3rd label/node

I have 3 labels, A, B, and Z. A & B both have a relationship to Z. I want to find all the A nodes that do not have share any of nodes Z in common with B Currently, doing a normal query where the relationship DOES exist, works. MATCH…
ndyr
  • 503
  • 4
  • 20
2
votes
1 answer

Count the number of Relationships between two specific Nodes - Neo4j / Cypher

I would like to input two specific nodes and return the quantity of relationships that are along the path that connect the specific nodes. (There is only 1 path possible in every case) In some cases, two specific nodes are related through two…
JBoz
  • 43
  • 1
  • 6
2
votes
2 answers

Removing duplicates from output of COLLECT clause

I have nodes of type Challenge, Entry, User, Comment An Entry can be PART_OF a Challenge A Challenge or Entry can be POSTED_BY a User A Comment can be POSTED_BY a User A Comment can be POSTED_IN a Challenge A User can LIKE a Challenge or an…
Gaurav Jain
  • 419
  • 4
  • 17
2
votes
3 answers

Getting all nodes related to an specific node but not to another

Having this model: (:Person)-[:has]-(:Movie) I need to get all the movies that an arbitrary group of people have but another one does not. I started with: MATCH (p1.Person {Name: 'Josh'})-[:has]->(m:Movie) WHERE not exists ((p2:Person {Name:…
Dexter
  • 138
  • 2
  • 3
  • 17
2
votes
1 answer

ArgumentError: Invalid session type: :server_db (expected one of [:http, :bolt, :embedded])

I'm trying to create a node using Ruby on Rails and I'm following the steps from here. Everything is fine until I execute Asset.create(title: 'A predictive analysis of predictive analytics') It gives me ArgumentError: Invalid session type:…
Jp Reddy
  • 366
  • 1
  • 4
  • 15
2
votes
1 answer

Neo4j Cypher query and composite objects

I have a following Cypher query that returns all Decision that belong to a particular Tag: MATCH (d:Decision)-[:BELONGS_TO]->(t:Tag) WHERE t.id = {tagId} RETURN d According to my business logic every Tag can have a set of…
alexanoid
  • 24,051
  • 54
  • 210
  • 410
2
votes
2 answers

Cypher: Match random node in Neo4j

I have a database with 3.4 millions of nodes and want to select a random node. I tried using something like MATCH (n) WHERE rand() <= 0.01 RETURN n LIMIT 1 but it seems like the algorithm always starts with the same nodes and selects the first…
Pascal
  • 2,590
  • 3
  • 21
  • 46