Sint
Sint

Reputation: 1620

Cypher accessing space separated relationship property neo4j

I have a few million nodes large data set imported with https://github.com/jexp/batch-import .

Unfortunately, the script made relationship property names space separated as in "Some Property".

How do I ask for this property in Cypher?

As expected

r.Some Property 

does not work, which is only fair.

I also tried:

r["Some Property"] 

Is there a syntax for such naming?

Should I just redo the import with camel case property names or underscore separated ones?

Upvotes: 1

Views: 2498

Answers (2)

Cameron Tinker
Cameron Tinker

Reputation: 9789

You can return properties with spaces in the names by using backticks, `, to enclose the property name. Something like this should work in Cypher:

START r=rel(0) RETURN r.`Some Property`;

This goes for node properties as well.

Upvotes: 9

Sumsun
Sumsun

Reputation: 27

you can use MATCH (r) WHERE r.type=~'Some Property.*' RETURN r;

I hope this will get you exact relation-type.

OR

MATCH (n)-[r]->() WHERE type(r)=~'S.*' It will give you all relationship started with S.

Upvotes: 2

Related Questions