Reputation: 293
I'm creating a graph DB of Taxis network storing in each node a taxi with a long list of properties of (date, fee), I'm storing a date in Java
DATE
format that contains spaces but I cannot access it while matching.
MATCH (t) WHERE t.name='someTaxi' RETURN t.Sun Mar 01 00:00:00 EET 2015;
But this didn't work so I used backtick-ing
I stored property key with backticks like this 'Sun Mar 01 00:00:00 EET 2015' the second time
MATCH (t) WHERE t.name='someTaxi' RETURN t.'Sun Mar 01 00:00:00 EET 2015';
but this didn't work either.
So Is it possible to store a property key like that in Neo4j and How can I return it ?
Upvotes: 1
Views: 203
Reputation: 8731
You are storing some data this way (json representation):
{name: "someTaxi", Sun Mar 01 00:00:00 EET 2015 : fees}
This data model is bad, considering Neo'j's ability to manage such datas using relations.
You have to create a better data model using Neo4j's power: Relations. Here is an example of what you wan do:
Here is the node details (pseudo cypher representation):
(:Taxi{name:someTaxi})-[:EARNED{date:<Here you set your date>}]->(:Fees{value:<The amount>)
So now, to match your fees, you can simply use this query:
MATCH (t:Taxi{name : <taxi Name>})-[r:EARNED{date: <yourDate>}]->(f:Fees)
RETURN f.value
Upvotes: 1