How do I create relationships from substrings in Neo4J

Tom

I have a set of 'tag' nodes and 'category' nodes, and wanted to generate relationships between the two by testing if the category's name is a substring of the tag's name. This was my approach thus far (apologies, I'm one day into cypher so this may be fundamentally flawed but I am yet to find something equivalent to reverse engineer thus far)

match(cat:category)
match(tag:tag) where tag.name =~ '.*'+cat.name+'.*'
merge (tag)-[:belongs_to]-(cat)

Error:

Type mismatch: expected Boolean, Collection<Boolean> or Collection<Collection<Boolean>> but was String (line 2, column 48 (offset: 67))
"match(tag:tag) where tag.name =~ '.*'+cat.name+'.*'"

The error seems to revolve around the use of =~ and concatenated strings, any advice would be appreciated!

jjaderberg

The problem is with the order in which the expression in the WHERE clause is evaluated. You can get around it by being explicit: enclose the string concatenation in parentheses.

WHERE tag.name =~ ('.*' + cat.name + '.*')

I tried quickly looking for documentation on cypher operator precedence but it wasn't in the operator chapter, so I'm not sure where this is documented.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Neo4j: how do I delete all duplicate relationships in the database through cypher?

From Dev

Neo4j - Create relationships from JSON list

From Dev

Neo4j/CYPHER: How can I query some properties from a node, its relationships and target node efficiently?

From Dev

Neo4j/CYPHER: How can I query some properties from a node, its relationships and target node efficiently?

From Dev

How do I create a relationship in neo4j between two nodes?

From Dev

How do I create a node with Label via REST API in Neo4j 2.0

From Dev

How do I create a spacial index in neo4j using only cypher?

From Dev

How do I create a Neo4j relationship via the rails console?

From Dev

How do I extract raw data from the neo4j examples?

From Dev

How do I ignore the yield value from a java stored procedure in cypher (neo4j)?

From Dev

How do I ignore the yield value from a java stored procedure in cypher (neo4j)?

From Dev

Neo4J Nodes and Relationships : Do I have to model everything as a Node?

From Dev

Neo4J Nodes and Relationships : Do I have to model everything as a Node?

From Dev

How to create unique nodes and relationships by csv file imported in neo4j?

From Dev

Neo4j Cypher to C# how to create different relationships with other nodes based on the value of a parameter

From Dev

How to create one to many relationships in neo4j graph in most efficient way?

From Dev

How do I return coordinates of nodes in neo4j

From Dev

How to delete all nodes that do not have any relationships - neo4j/cypher

From Dev

How can I optimise a Neo4j MERGE query on a node with many relationships?

From Dev

How should I get all the existing relationships in a graph in neo4j by java?

From Dev

How can I mitigate having bidirectional relationships in a family tree, in Neo4j?

From Dev

How can I use ExecutionEngine to get a list of relationships in neo4j?

From Dev

How to use MERGE (or something else) in neo4j to create new nodes and relationships based on info in labels in other relationships

From Dev

how to get the relationship from Collection of relationships between two nodes using springdata Neo4j with GraphRepository

From Dev

How to prevent neo4j MERGE from creating duplicate relationships?

From Dev

How to display all nodes and relationships' names in sequence from a Neo4j path

From Dev

Neo4j, do nodes without relationships affect performance?

From Dev

Neo4j gem - Querying relationships that do not exist

From Dev

Neo4j gem - Querying relationships that do not exist

Related Related

  1. 1

    Neo4j: how do I delete all duplicate relationships in the database through cypher?

  2. 2

    Neo4j - Create relationships from JSON list

  3. 3

    Neo4j/CYPHER: How can I query some properties from a node, its relationships and target node efficiently?

  4. 4

    Neo4j/CYPHER: How can I query some properties from a node, its relationships and target node efficiently?

  5. 5

    How do I create a relationship in neo4j between two nodes?

  6. 6

    How do I create a node with Label via REST API in Neo4j 2.0

  7. 7

    How do I create a spacial index in neo4j using only cypher?

  8. 8

    How do I create a Neo4j relationship via the rails console?

  9. 9

    How do I extract raw data from the neo4j examples?

  10. 10

    How do I ignore the yield value from a java stored procedure in cypher (neo4j)?

  11. 11

    How do I ignore the yield value from a java stored procedure in cypher (neo4j)?

  12. 12

    Neo4J Nodes and Relationships : Do I have to model everything as a Node?

  13. 13

    Neo4J Nodes and Relationships : Do I have to model everything as a Node?

  14. 14

    How to create unique nodes and relationships by csv file imported in neo4j?

  15. 15

    Neo4j Cypher to C# how to create different relationships with other nodes based on the value of a parameter

  16. 16

    How to create one to many relationships in neo4j graph in most efficient way?

  17. 17

    How do I return coordinates of nodes in neo4j

  18. 18

    How to delete all nodes that do not have any relationships - neo4j/cypher

  19. 19

    How can I optimise a Neo4j MERGE query on a node with many relationships?

  20. 20

    How should I get all the existing relationships in a graph in neo4j by java?

  21. 21

    How can I mitigate having bidirectional relationships in a family tree, in Neo4j?

  22. 22

    How can I use ExecutionEngine to get a list of relationships in neo4j?

  23. 23

    How to use MERGE (or something else) in neo4j to create new nodes and relationships based on info in labels in other relationships

  24. 24

    how to get the relationship from Collection of relationships between two nodes using springdata Neo4j with GraphRepository

  25. 25

    How to prevent neo4j MERGE from creating duplicate relationships?

  26. 26

    How to display all nodes and relationships' names in sequence from a Neo4j path

  27. 27

    Neo4j, do nodes without relationships affect performance?

  28. 28

    Neo4j gem - Querying relationships that do not exist

  29. 29

    Neo4j gem - Querying relationships that do not exist

HotTag

Archive