cypher


cypher delete node and all the list of related node


I'm trying to delete an entire list starting from a given node to the end of the list.
Where is the list of the root,relationship and child nodes. The child nodes can have an undetermined nodes.
(r:Root {name:'masterDoc'})<-[p:previous]<-(s1:schema)<-[p1:previous]<-(s2:schema)<-[pn:previous]<-(sn:Schema)
When I run the cypher query below I'm getting a Type mismatch: expected Node, Path or Relationship but was Collection
MATCH (n:`Root` {name:'masterDoc'})-[r:previous*]-(s) delete s,r,n
Any Idea?
You want to pull out the longest path of nodes, iterate over the relationships and delete each one and then iterate over the nodes and delete them.
NOTE: This assumes that each node in the path is no longer anchored to anything other than the nodes in the path otherwise they will not be able to be removed.
// match the path that you want to delete
match p=(:Root {name: 'masterDoc'} )-[:previous*]->()
with p
// order it in descending order by length
order by length(p) desc
// grab the longest one
limit 1
// delete all of the relationships
foreach (r in relationships(p) | delete r)
// delete all of the remaining nodes
foreach (n in nodes(p) | delete n)

Related Links

Querying a directed networkx graph
cypher how to create unique nodes from substring of other nodes
Iterating count function in cypher
Neo4j Cypher Query Not Filtering on Edge Label
Neo4jrb 8.x- Cypher query issues
Spring Data Neo4j Cypher get entity type or class name
Creating a string from a path
Reserved words of AgensGraph
Spring Data Neo4j 4 and Pageable vs repository method ORDER BY parameters
SDN4, Neo4j OGM #QueryResult Session.query and Pagable
Spring Data Neo4j 4 Pageable with org.neo4j.ogm.session.Session.query
CYPHER: How to create a tabulated 'edge list' from matched pattern or graph
Cypher Unable to load NODE with id, version 3.0.4
How do I use Structr to iterate through elements in a cypher collection?
Analogue of #Formula annotation from JPA for Spring data neo4j?
Cypher Query does not work

Categories

HOME
knockout.js
android-studio
yii
dotnetnuke
scroll
command-prompt
embedded-resource
biztalk
vsts-build
mathematical-optimization
dependencies
drag-and-drop
cocotb
bellman-ford
siesta
responsivevoice
mpu6050
fresco
twisted
pfobject
android-permissions
kaggle
liferay-6.2
gollum-wiki
amazon-sns
candlestick-chart
exchange-server-2010
fusetools
router
openbravo
react-bootstrap-table
adapter
windows2012
seafile-server
shapeless
ms-media-foundation
subclassing
telephonymanager
jacoco-maven-plugin
klee
data-uri
system-on-chip
coverage.py
optionaldataexception
transparency
react-intl
head.js
redisson
mobile-angular-ui
1010
http4s
cocoa-bindings
yui3
xcode6.4
carmen
adp
strpos
teamviewer
android-expansion-files
html.actionlink
decidable
ibm-was
astropy
azure-xplat-cli
signed
ssmtp
mutators
maven-shade-plugin
xml-signature
nesper
mobile-country-code
loginview
box2dweb
accessory
two.js
jini
cidr
code39
lsa
compiler-flags
acitree
codahale-metrics
bcdedit
html-frames
background-thread
handshake
simplecov
msinfo32
uipangesturerecognizer
kolite
fbml
zend-server-ce
mmc3
glassfish-esb
play2-mini
data-dump
cewolf
upshot
dip
3-tier
j2mepolish
oracle-pro-c
mysqli-multi-query
spring-modules
rtti
autobench
icon-language

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App