Hello, I need to list all the possibile properties of all the nodes of type "CI"; next I need to list of properties of relationship "USES". Can you please help?
I find examples, but the use some APOC.MAP functions that my Neo refuses to recognize.
Thank you
cobra
(Cobra)
January 8, 2021, 3:05pm
2
Hello @dario.piantanida
Without APOC
MATCH (n:CI)
WITH REDUCE(output = [], r IN collect(keys(n)) | output + r) AS flat
UNWIND flat AS item
RETURN COLLECT(DISTINCT item) AS keys
MATCH ()-[n:USES]->()
WITH REDUCE(output = [], r IN collect(keys(n)) | output + r) AS flat
UNWIND flat AS item
RETURN COLLECT(DISTINCT item) AS keys
With APOC
MATCH (n:CI)
RETURN apoc.coll.toSet(apoc.coll.flatten(collect(keys(n)))) AS keys
MATCH ()-[n:USES]->()
RETURN apoc.coll.toSet(apoc.coll.flatten(collect(keys(n)))) AS keys
Don't forget to check in the neo4j.conf file these settings:
dbms.security.procedures.unrestricted=apoc.*
dbms.security.procedures.whitelist=apoc.*
You can also have a look at the properties() function if you want to get the values instead of the keys.
Regards,
Cobra
1 Like
Macinando, ho trovato questa che sembra soddisfacente, che dici?
call db.schema.nodeTypeProperties() yield nodeType, nodeLabels, propertyName, propertyTypes
where "CI" in nodeLabels
return nodeType, propertyName, propertyTypes
cobra
(Cobra)
January 8, 2021, 3:28pm
4
It's a good option, I forgot this one
Choose the one you prefer
Sorry, I wrote in Italian as I didn't remember I was on an English community!
Thanks for your support!
1 Like