Skip to content

Tarik Billa

  • Web Development
    • html
    • vue.js
    • laravel
    • css
    • javascript
    • jquery
    • node.js
    • php
    • asp.net
  • Programming
    • python
    • java
    • c
    • c++
    • c#
  • git
  • android

cypher

neo4j: What is the syntax to set cypher query parameters in the browser interface?

April 7, 2024 by Tarik

In neo4j-browser you need type for example: :params {nodes: [{name: “John”, age: 18}, {name: “Phill”, age: 23}]} Then you can use params as usual: UNWIND {nodes} as node MERGE (A:User {name: node.name, age: node.age}) RETURN A For clear params in neo4j-browser type :params {}. For additional help type :help params.

Categories neo4j Tags cypher, neo4j Leave a comment

Difference between merge and create unique in Neo4j

January 7, 2024 by Tarik

CREATE UNIQUE has slightly more obscure semantics than MERGE. MERGE was developed as an alternative with more intuitive behavior than CREATE UNIQUE; if in doubt, MERGE is usually the right choice. The easiest way to think of MERGE is as a MATCH-or-create. That is, if something in the database would MATCH the pattern you are … Read more

Categories merge Tags cypher, merge, neo4j Leave a comment

how to add a property to existing node neo4j cypher?

January 4, 2024 by Tarik

Your matching by label is incorrect, the query should be: MATCH (n:User) SET n.surname=”Taylor” RETURN n What you wrote is: “match a user whose label property is User”. Label isn’t a property, this is a notion apart. As Michael mentioned, if you want to match a node with a specific property, you’ve got two alternatives: … Read more

Categories neo4j Tags cypher, graph-databases, neo4j Leave a comment

How to create unique constraint involving multiple properties in Neo4J

December 12, 2023 by Tarik

neo4j (2.0.1) does not currently support a uniqueness constraint that covers multiple properties simultaneously. However, I can think of a workaround that might be acceptable, depending on your use cases. Let’s say you want properties a, b, and c to be unique as a group. You can add an extra property, d, that concatenates the … Read more

Categories neo4j Tags cypher, neo4j Leave a comment

Excluding label names in simple Neo4j Query

December 11, 2023 by Tarik

This should do it: MATCH (n) WHERE NOT n:Label1 AND NOT n:Label2 RETURN n;

Categories neo4j Tags cypher, neo4j Leave a comment

How to push values to property array in Cypher?

December 11, 2023 by Tarik

Adding values to an array is analogous to incrementing an integer or concatenating a string and is signified the same way, in your case (let c be your [c:contains {id:[12345]}]) c.id = c.id + 1111 // [12345,1111] c.id = c.id + 14567 // [12345,1111,14567] or c.id = c.id + [1111,14567] // [12345,1111,14567]

Categories arrays Tags arrays, cypher, neo4j Leave a comment

How can I return all properties for a node using Cypher?

December 10, 2023 by Tarik

You can’t do this in Cypher yet. I think it would be a nice feature though, if you want to request it. Edit (thanks for comment pointing it out): You can now do this as of 2.2: MATCH (p:Product) WHERE p.price=”1950″ RETURN keys(p);

Categories graph Tags cypher, graph, neo4j Leave a comment

Change node label in neo4j

December 9, 2023 by Tarik

MATCH (n:OLD_LABEL {id:14}) REMOVE n:OLD_LABEL SET n:NEW_LABEL Guess this query explains itself.

Categories neo4j Tags cypher, neo4j Leave a comment

neo4j cypher: how to change the type of a relationship

December 9, 2023 by Tarik

Unfortunately there is no direct change of rel-type possible at the moment. You can do: MATCH (n:User {name:”foo”})-[r:REL]->(m:User {name:”bar”}) CREATE (n)-[r2:NEWREL]->(m) // copy properties, if necessary SET r2 = r WITH r DELETE r

Categories neo4j Tags cypher, neo4j Leave a comment

Why does neo4j warn: “This query builds a cartesian product between disconnected patterns”?

December 3, 2023 by Tarik

The browser is telling you that: It is handling your query by doing a comparison between every Gene instance and every Chromosome instance. If your DB has G genes and C chromosomes, then the complexity of the query is O(GC). For instance, if we are working with the human genome, there are 46 chromosomes and … Read more

Categories neo4j Tags cypher, neo4j Leave a comment
Older posts
Page1 Page2 Page3 Next →

Tarik Billa

Software Engineer
tarikbilla@gmail.com
+8801884414000
  • Reuse a hash in YAMLApril 17, 2024
  • Dockerfile: how to redirect the output of a RUN command to a variable?April 16, 2024
  • How to cd to a directory with spaces in the directory name?April 16, 2024
  • Maximum MIME type length when storing the type in a databaseApril 16, 2024
  • What is the difference between Unit, Integration, Regression and Acceptance Testing?April 16, 2024
© 2026 Tarik Billa