7

I'm discovering a new graph data model in Neo4j and I was wondering how to list all the possible node properties but not their value if possible.

For the relations, I found this very handy generic cypher query :

start n=node(*)
match n-[r]-m
return distinct type(r)

which return a useful list of properties you can start to use to query more specifically the graph:

==> +------------+
==> | type(r)    |
==> +------------+
==> | "RATED"    |
==> | "FRIEND"   |
==> | "DIRECTED" |
==> | "ACTS_IN"  |
==> +------------+
==> 4 rows
==> 0 ms
==>

Is there any function/expression that allows to do this but for the node properties ?

Thanks

  • 1
    i dont think so. only listing the whole node/rel manually will show you the properties. – ulkas Jan 18 '13 at 08:37
  • 1
    Something like this will probably come into play when cypher supports map types to handle such structures correctly. – Michael Hunger Jan 18 '13 at 23:44
  • 1
    @MichaelHunger: Do you know when it will happen? – Gil Stal Apr 02 '13 at 11:26
  • With the labels and schemas allowing creation of node categories and proper "structures" in proper terms it seems more and more important to be able to "list" structural characteristics and node/relationship characteristics that are structurally localized. – retrography Jul 11 '14 at 15:52

2 Answers2

2

type() does not return relationship properties, but the relationship type.

Both nodes and relationships can have properties, but only relationships can have a type.

Werner Kvalem Vesterås
  • 10,226
  • 5
  • 43
  • 50
0

To list all the properties of nodes in graph DB, you can try using following cypher:

match (n) 
WITH distinct keys(n) as properties 
UNWIND properties as property 
return distinct property

Thanks, Vishal