Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

LIKE clause in CYPHER Query

Tags:

neo4j

cypher

It appears that LIKE is not supported in Cypher queries.

Is there any other construct that would perform the same task?

For instance:

start n = node(*) where n.Name LIKE('%SUBSTRING%') return n.Name, n; 
like image 924
johnc Avatar asked Dec 11 '12 21:12

johnc


People also ask

WHAT IS WITH clause in Cypher?

The WITH clause allows query parts to be chained together, piping the results from one to be used as starting points or criteria in the next. It is important to note that WITH affects variables in scope. Any variables not included in the WITH clause are not carried over to the rest of the query.

When you create a relationship in Cypher You must specify a direction True or false?

Syntax: Creating relationships When you create the relationship, it must have direction. You can query nodes for a relationship in either direction, but you must create the relationship with a direction.

How do you write a Cypher query?

Cypher uses an ASCII-art type of syntax where (nodes)-[:ARE_CONNECTED_TO]->(otherNodes) using rounded brackets for circular (nodes) , and -[:ARROWS]-> for relationships. When you write a query, you draw a graph pattern through your data.

Is Cypher similar to SQL?

Cypher is like SQL a declarative, textual query language, but for graphs. It consists of clauses, keywords and expressions like predicates and functions, many of which will be familiar (like WHERE , ORDER BY , SKIP LIMIT , AND , p. unitPrice > 10 ). Unlike SQL, Cypher is all about expressing graph patterns.


2 Answers

using regular expressions: http://neo4j.com/docs/developer-manual/current/#query-where-regex

start n = node(*) where n.Name =~ '.*SUBSTRING.*' return n.Name, n; 
like image 185
ulkas Avatar answered Sep 21 '22 12:09

ulkas


As of version 2.0, the preferred syntax uses MATCH.

e.g.

MATCH (n) where n.Name =~ '.*SUBSTRING.*' return n.Name, n; 
like image 22
Ryan Walls Avatar answered Sep 23 '22 12:09

Ryan Walls