Reputation: 10531
I want to do this in Java API. For each node, I want to return it's labels, properties, and the property values.
What's the best way to do this?
Upvotes: 2
Views: 796
Reputation: 66967
Using the Java API, you can use the following methods on a Node
instance:
To get just the property keys (without their values): PropertyContainer.getPropertyKeys()
To get a Map of all property keys to their values: PropertyContainer.getAllProperties()
To get all labels for the node: Node.getLabels().
Upvotes: 1
Reputation: 16355
This solution uses labels(), keys() and reduce() functions:
match(n)
return
labels(n) as labels,
keys(n) as properties,
reduce(accumulator = [], key IN keys(n) | accumulator + n[key]) as values
Upvotes: 1