Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
01-08-2021 06:35 AM
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
01-08-2021 07:05 AM
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
01-08-2021 07:21 AM
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
01-08-2021 07:28 AM
It's a good option, I forgot this one
Choose the one you prefer
01-08-2021 07:45 AM
Sorry, I wrote in Italian as I didn't remember I was on an English community!
Thanks for your support!
All the sessions of the conference are now available online