Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cypher queries as batch operations on Neo4j

I need to run this type of queries in PHP:

START n = node($thisUser), m = node($userId)
MATCH n-[r:RATED]->m
WHERE r.skillId = $id
RETURN id(r)

There are a lot of them for a single page (~30). Since it's using REST, the run-time comes out not applicable (~5-10 seconds). So I'm trying to send them in a single batch but I cannot find any method to send actual cypher queries through REST as operations in a single batch.

Is there a way to do it?

like image 724
gzg Avatar asked Jan 08 '14 13:01

gzg


People also ask

What is Neo4j query language cypher?

Cypher is Neo4j's graph query language that lets you retrieve data from the graph. It is like SQL for graphs, and was inspired by SQL so it lets you focus on what data you want out of the graph (not how to go get it).

What are the weaknesses of Neo4j?

Neo4j has some upper bound limit for the graph size and can support tens of billions of nodes, properties, and relationships in a single graph. No security is provided at the data level and there is no data encryption. Security auditing is not available in Neo4j.

How can you run CQL commands in Neo4j?

Neo4j CQL has commands to perform Database operations. Neo4j CQL supports many clauses such as WHERE, ORDER BY, etc., to write very complex queries in an easy manner. Neo4j CQL supports some functions such as String, Aggregation. In addition to them, it also supports some Relationship Functions.


1 Answers

Have you tried the following?

a) the transactional rest resource
b) batching multiple calls to the /db/data/cypher resource via the /db/data/batch resource, with "to":"/cypher" in the payload
c) passing collections instead of single values as parameters

like image 137
jjaderberg Avatar answered Sep 23 '22 15:09

jjaderberg