I'll let someone else answer the time lines in graphs part of your question
- I know we have lots of examples of that.
I would express your query something like this:
MATCH (n:User { id:'1'}), (m:User)
WHERE (n)-[:TEXTED {year: '2013'}]->(m)
AND NOT (n)-[:TEXTED {year: '2014'}]->(m)
RETURN n.id AS User1, m.id AS User2
If you have a lot of users, this could be a slowish query, I'm afraid.
We're working on improving this situation...
HTH,
Andrés
On Wed, Apr 16, 2014 at 8:35 PM, Alx <[email protected]> wrote:
> I have a Neo4j graph database containing: a) user nodes (U1, U2, etc) and
> b) a relationship [:TEXTED] with properties: i)year (2013, 2014), ii)
> message_count.
>
> I am trying to retrieve all the users that U1 texted in 2013 and not in
> 2014 and vice versa. So far I have come up with the following query:
>
> MATCH (n:User { id:'1'}) - [r:TEXTED]-> (m) WHERE r.year = '2013' WITH n,m
> MATCH (n)-[k:TEXTED]->(m) WHERE k.year <> '2014' RETURN n.id AS User1,
> m.id AS User2
>
> However this query returns all the user U1 texted in 2013 regardless if
> they texted them in 2014. I can query to find the common user pairs in 2013
> and 2014 and then import to some spreadsheet program but defeats
> efficiency.
>
> Any suggestions for creating the query would be much appreciated.
>
>
>
> Also as a general question, how should time-based relationships like the
> one above should they be stored in the graph database? For the above
> problem I think it would be easier to create 2 separate relationship ( [
> TEXTED_IN_2013] and [TEXTED_IN_2014]) . But I wonder if that's the way to
> go.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Neo4j" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/d/optout.
>
--
The best way to ask for Cypher help: http://console.neo4j.org/usage.html
--
You received this message because you are subscribed to the Google Groups
"Neo4j" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.