Questions tagged [cypher]
Cypher is a graph query language for Neo4j and AgensGraph. For ciphers as in encryption, see cipher.
9,762
questions
0
votes
2
answers
20
views
How to create constraint both on node by it's attribute and another node the firts one is related to?
Let's say i have two different nodes in my DB: (p:person {name: "Claudia"})-[:likes]->(h:hobby {name: "football", experience: "2 years"}). So, my goal is to make each ...
0
votes
1
answer
21
views
Neo4j Cypher query DB hits optimization
I have the following Cypher query:
PROFILE MATCH (p:Profile) MATCH (v:Vacancy:Decision {id: 17210})
WHERE NOT exists((v)<-[:POSSIBLE_PROFILE]-(p))
RETURN p, v;
and only 5000 Profiles in my test ...
0
votes
3
answers
31
views
How to update the existing nodes in neo4j using python
I've successfully managed to display and create nodes in Neo4j using Python, but I'm struggling to update nodes in Neo4j using Python. I've attempted to seek assistance from ChatGPT, but I'm still ...
0
votes
2
answers
27
views
Splitting string with apoc.periodic.iterate
I am encountering errors when including a function to split a string inside apoc.periodic.iterate in Neo4j. Namely, here is my query which runs fine:
WITH collect(file.URL) AS fileURLs
UNWIND fileURLs ...
1
vote
2
answers
51
views
Grouping Cypher query results by direct relationships
Given the following graph (where all relationships have the FOLLOWS type), how can we get the results such that they are grouped according to previous and next node(s) of a given node?
H->G->E-&...
1
vote
1
answer
32
views
How can I translate this Neo4j cypher query to a PHP cypher DSL?
We are translating a Neo4j cypher query to PHP cypher DSL (Domain-Specific Language) using the php-cypher-dsl library to have more flexibility.
We struggle with this because the library's ...
0
votes
1
answer
23
views
neo4j: What are the tradeoffs of --normalize-types=false?
The neo4j-admin tool can import data from CSV. One of the options it takes is:
--normalize-types[=<true/false>]
Determines whether or not to normalize property types to Cypher types, e.g. int ...
0
votes
1
answer
25
views
Modifying cypher query with additional properties and labels
So I have a system whereby I will be handed in cypher queries to do specific operations (e.g. create a new node) as part of a pipeline.
The question I have, is that I would like to add additional ...
2
votes
2
answers
32
views
Converting an integer to a fixed-length string with leading zeros
Ideally I want toFixed function in JavaScript https://www.w3schools.com/jsref/jsref_tofixed.asp I know I can do this with Cypher like below.
WITH 3 AS inputNumber
RETURN
CASE
WHEN inputNumber &...
0
votes
1
answer
44
views
Optimizing a Cypher query in Neo4j
I have this Cypher query that I have written.
MATCH (grade:Grade:`2547`:Transaction WHERE grade.NodeID="2547:12117:000:6839" or grade.NodeID="2547:12117:000:6841" or grade.NodeID=&...
0
votes
3
answers
55
views
Is there a method to access specific node and relationship data within a graph catalog in neo4j GDS?
In Neo4j Graph Data Science (GDS), each graph can have a corresponding projection. How can I obtain detailed information about the actual nodes and relationships stored within a specific projection? ...
0
votes
1
answer
26
views
Neo4j multilabel modes and query performance
Let's say I have a Decision base node with a defined ID:
@NodeEntity
public class Decision {
@Id
@Index(unique = true)
private Long id;
}
I have defined a UNIQUE INDEX on Decision.id.
...
0
votes
1
answer
23
views
Unable to load NODE 4:db8c4fa***.. error when i using CALL apoc.create.vNode
Here's a cypher that finds a pattern, creates a virtual node, and then creates a relationship with the real node.
MATCH (account:Account:Iam)-[:DATE]->(date:Date)-[:ACTED]-(start_log:Log)-[:ACTED*1....
0
votes
0
answers
22
views
How to show Relationship for specific node in cypher neo4j with neovis.js?
Is there a way to get a relationships of specific node only in neovis.js. From the Movie sample limited the node to 2. Now we have two movie nodes The Matrix and The Matrix Reloaded, want to show the ...
0
votes
0
answers
35
views
How to store and use rules as string in neo4j node property
create (a:Class {name:'A'})-[:subClassOf]->(b:Class {name:'B'})
create (b)-[:subClassOf]->(c:Class {name:'C'})
create (rule:Rule {name:'Rule1',
condition:'exists( (a:Class)-[:subClassOf]...
2
votes
3
answers
55
views
How to write a cypher query which recursively traverses a graph in Neo4j to find all the nodes visited
I have created a graph in neo4j community edition running in a docker container in my local using below cypher.
create (a:Account{name:'account.a'}),
(b:Account{name:'account.b'}),
(c:Account{name:'...
0
votes
1
answer
39
views
How to store a condition as a string in node property or relationship property and use it in a query?
create (bird:Class {name:'bird'})-[:isSubClassOf]->(animal:Class {name:'animal'})
create (animal)-[:hasOrgan {condition:'Exists (({x})-[:isInstanceOf]->(bird))'}]->(wing:organ {name:'wing'})
...
1
vote
2
answers
42
views
Concise way to Add virtual property with neighbour count to each result node in Cypher
I'm using NeoDash, and I want to generate a graph report where each node size is weighted by the number of neighbors.
So this count must become a property of the node to be analyzed by NeoDash ...
0
votes
1
answer
53
views
Query for Collapsing Node in Path with Multiple Relationships
In my DB, my connections between item nodes are done through a three-way node-connection, like the one highlighted below. I chose it this way because I don't think there's a way to do a three-way ...
0
votes
1
answer
28
views
Security of JSON in Neo4j array property
I have code that successfully does the following:
MATCH (c:Companies) WHERE c.CompanyID = "1234" SET c.Contacts = ['{"Name":"Test","Email":"[email protected]&...
0
votes
1
answer
44
views
Neo4j Cypher query Optional match with multiple CASE WHEN THEN
The scenario is to get the sum of values of the nodes matched using multiple optional matches and then the value is selected based on the matching case
MATCH (a:Type1 {id: '1234'})-[:REL_W]->(...
0
votes
0
answers
28
views
Neo4j migration from 5.5.0 to 5.11.0 - Failed to invoke procedure `apoc.cypher.mapParallel2`: Caused by:RuntimeException: Error polling, timeout
I'm trying to migrate from Neo4j 5.5.0 to 5.11.0 (also tried 5.10.0)
The following query works fine on Neo4j 5.5.0:
MATCH ( childD:Vacancy ) WITH collect({`childD`: childD}) as childDDgRdgd
CALL ...
1
vote
1
answer
42
views
Cypher to find (multiple) "lowest" nodes
Case:
I've nodes Categories that looks like below and i created a relation from category to parent.
CREATE(p1:Categorie {
id: 2,
parent_id: 1,
name: "Kids",
is_active: true ,
...
0
votes
0
answers
37
views
Neo4j Access to record went out of bounds of the page. Migration Neo4j 5.5.0 to 5.10.0
I'm attempting to upgrade from Neo4j 5.5.0 to Neo4j 5.10.0, but currently my tests on this version are failing with the following error:
org.neo4j.driver.exceptions.DatabaseException: Access to record ...
0
votes
1
answer
49
views
How to find the shortest path not containing a pattern?
I am using Neo4j 5.9.0 community
Problem description :
My graph only has one type of relationship [:Relationship], and one type of node (:Node).
I want to find the shortest path between two nodes, but ...
0
votes
1
answer
47
views
Neo4j GDS: Cannot use Cypher to make a complex projection
The following query from the GDS documentation shows how to create a GDS projection via Cypher:
MATCH (source) OPTIONAL MATCH (source)-[r:READ]->(target)
WHERE r.numberOfPages IS NOT NULL
WITH gds....
0
votes
2
answers
30
views
NEO4J UNWIND CREATE runs endless
I have a problem with the execution of the following code:
public static void create(final Session session, final String nodeName, final Map<String, List<Object>> attributes) {
...
0
votes
1
answer
27
views
Neo4j Cypher Pattern comprehension in return statement
I need to add to my Cypher query's return statement the following Pattern comprehension:
[ (rc:Criterion) WHERE rc.id IN childD.replaceableCriterionIds | {entity: rc} ] AS decisionReplaceableCriteria
...
0
votes
1
answer
48
views
Neo4j Cypher reduce UNWINDs calls
I have the following Cypher query:
UNWIND childD.detailedCriterionIds as dCId
WITH childD, childDStat, dCId + coalesce(childDStat['replaceableCriterionIds.' + dCId],[]) as cGroup
WITH childD, ...
0
votes
2
answers
44
views
Issue Creating TempArticle in Neo4j Cypher Query
Question:
I'm working on a Neo4j Cypher query that aims to update or create relationships between a store and articles. The goal is to update an existing relationship if its date is older than a new ...
1
vote
1
answer
23
views
When to use WHERE in Cypher Neo4j?
I was going through docs and a 2-month-old youtube video on neo4j for beginners.
I want to find a user from the database using his name. So here are two way of doing this:
Docs way: MATCH (u:USER {...
1
vote
1
answer
23
views
Return a count of every edge type leaving a node in neo4j
Given a node with several types of outbound edges, let's say of types ["A","B","C"], how would I use cypher to query a neo4j database to return the counts of every edge.
...
0
votes
1
answer
41
views
What causes Neo4j error: Illegal char <:> at index 3
LOAD CSV WITH HEADERS FROM "file:///C:/Users/SESA472806/Desktop/CustomerTagDB_IOAssgiment_M91_with_IO_Allocation_LAST_4.csv" as line
with line, line.`Plant Name` as plnt
Call{
...
0
votes
2
answers
55
views
calculation of percentage from a column is table neo4j/Cypher
I want to calculate percentage of how much each type of skill is present for each occupation.
I made a have different nodes occupation and Soft_skills they have an relationship [r:MAPS_TO] the ...
2
votes
3
answers
113
views
Cypher query warning give inconsistent result when fix
When I run this query:
MATCH (n:test) with n limit 100
WITH DISTINCT n, keys(n) AS allKeys
UNWIND allKeys AS key
with n,
CASE
WHEN key STARTS WITH 'prop.title' THEN {column: 'title', ...
0
votes
2
answers
34
views
Cypher, Reusing information, with EXISTS{} as varname and then use varname, fails
My Query should create a Connection from A to B if this doesn't lead to a cycle. This means I can't connect A to B if there is already a connection from B to A.
I have following query:
1 MATCH (a:...
0
votes
1
answer
34
views
Neo4j match and 2 merges
I have the following Neo4j Cypher query which is hopefully fairly obvious:
MATCH (n:Companies) WHERE CompanyID = $CompanyID
MERGE (c:Countries {CountryISOCode:$CountryID}) RETURN c
MERGE (n)-[r:...
1
vote
1
answer
64
views
Quantifying path patterns
I am learning neo4j right now and understood/created the relationships between the nodes. I am trying to understand the quantifying path patterns. It seems like I was able to write the general queries ...
0
votes
1
answer
54
views
apoc.periodic.iterate never return a result
in my database I have multiple nodes that have the same properties, so I want to merge all of these nodes into one. Those nodes are connected by the relationship "similar", so I use gds ...
0
votes
1
answer
22
views
Adding Elements to an Already Existing Graph in Neo4j
I have a question about how to add elements to an already existing graph in Neo4j.
First, I have created nodes and relationships using the following query:
CALL apoc.import.csv(
[{fileName: "...
1
vote
2
answers
39
views
Get all the relations between models including node data
I have this nodes and relations, but I have a issue regarding the from and to node info
I have this 3 transactions
from: 111, to: 222 -> amount: $10000
from: 222, to: 333 -> amount: $2000
from: ...
0
votes
0
answers
188
views
How to get Nodes and Edges From Neo4j To C# Object Structure using Neo4jClient
I am using the Neo4jClient and am trying to start at a parent node and get all related nodes and relationships to build and return an Object.
The object is simply:
public class NodeModel
{
public ...
0
votes
1
answer
42
views
Neo4j search for nodes while combining relationship types in different directions?
I have a starting node, and I'm supposed to find all matching nodes that can be found using 3 different relationship types.
For example: (n1:NodeType1)-[:Use|Realisation|Aggregation]-(n2:NodeType2)
...
0
votes
2
answers
54
views
Optimized way to create relationship between millions of nodes
I have nodes uploaded to neo4j and each of the nodes have properties like email, phone, address, etc. I need to create relationship between two nodes if sum of levenshtein distance between properties ...
0
votes
1
answer
26
views
Best way to query a large list of nodes in neo4j
I'm trying to do something like the following using the py2neo module to get information for a large quantity of nodes in a neo4j database that I already know the id's of:
query = f'''
MATCH
...
0
votes
1
answer
42
views
jQAssistant analysis to find microservices and their clients
I'm following https://github.com/graphaware/fix-your-microservices to scan and identify the Micro services and their respective consumers to identify if there are any circular dependencies in my ...
1
vote
3
answers
49
views
Neo4j APOC custom function hangs when nothing is found
I have written the following custom function that performs a complex search and returns a list of IDs. Here is a simplified version:
CALL apoc.custom.declareFunction('test()::LIST OF INTEGER?', '
...
0
votes
0
answers
35
views
model node-relation in graphql api in python
in our neo4j database, "Device" node is connected to "DeviceFeature" node with one way relation called "has". I am trying to find an efficient way to model this in my ...
0
votes
1
answer
39
views
How to write a neo4j cypher query to find closed loop of similar nodes
I'm trying to find if in my database I have a closed loop consisting of only nodes that match certain criteria. I know how to specify a variable number of relationships matching criteria, such as: -[...
0
votes
2
answers
32
views
Get neighbors of a node that can be reached with n jumps (edges)
I am trying to get all of the nodes and relationships of a node up to n jumps(edges). Meaning that what are the nodes that I can reach with e.g., n edges, and what are the relations in between each ...