cancel
Showing results for 
Search instead for 
Did you mean: 

Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.

List properties of a label/relationship

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

4 REPLIES 4

Hello @dario.piantanida

Without APOC

  • Nodes:
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
  • Relations:
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

  • Nodes:
MATCH (n:CI)
RETURN apoc.coll.toSet(apoc.coll.flatten(collect(keys(n)))) AS keys
  • Relations:
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

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

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!