Log in Register now
Main » Articles » Programming » neo4j

Entries in category: 3
Shown entries: 1-3

Sort by: Date · Name · Rating · Comments · Views

neo4jNeo4j orphan nodes detection

MATCH (n)
WHERE NOT EXISTS((n)--())
RETURN n

neo4jNeo4j + httpd + Selinux on CentOS

With enabled selinux I had non-working Neo4j with httpd on CentOS. To make it working we should introduce Neo4j 7474 port to Selinux.

It easily can be done with semanage tool. To find it you can use yum provides /usr/sbin/semanage command. In my case it gave me the policycoreutils-python-2.0.83-19.39.el6.x86_64 package. So yum installs policycoreutils-python-2.0.83-19.39.el6.x86_64

After semanage install Neo4j and httpd should be shutdown. Without it I had "Killed" message.

And add our desired listen port, 7474/tcp to the list:
semanage port -a -t http_port_t -p tcp 7474
After httpd and Neo4j start the problem has gone.

neo4jNeo4j duplicates removing with Cypher

This approach allows to delete all duplicate nodes with their relationships.

START project=node(123)
MATCH project-[:T]->tA<-[:F]-jA
WITH project, MIN(ID(jA)) AS minId
MATCH project-[:T]->tB<-[:F]-jB
WHERE ID(jB)>minId
WITH jB
MATCH jB-[r]-()
DELETE jB,r

In the result we will have one single node without duplicates.

UPD. The idea was good, but it not works as desired.