Typed Relationships and Cypher

51 views
Skip to first unread message

Benjamin Grabkowitz

unread,
Sep 8, 2015, 9:46:51 AM9/8/15
to Neo4jClient
The documentation still references Typed Relationships utilizing IRelationship, but its unclear if this is legacy or still best practice?

I get the feeling that it has been replaced with Cypher, yet I don't see any examples on creating/querying Relationships as entities with Cypher.

Chris Skardon

unread,
Sep 8, 2015, 10:00:25 AM9/8/15
to neo4j...@googlegroups.com
Hi,

The docs are undergoing a bit of an overhaul - IRelationship shouldn't be used, it is legacy - I'll look into getting that fixed...

In terms of a quick (very quick) example:

//Create
var by = new BetterThan {By = 10};
gc.Cypher
    .Match("(m1:Movie {title:'The Matrix'}),(m2:Movie {title:'The Matrix Reloaded'})")
    .Create("(m1)-[r:BETTER_THAN {byParam}]->(m2)")
    .WithParam("byParam", by)
    .ExecuteWithoutResults();
 
//Get
var results = gc.Cypher
    .Match("(m1:Movie {title:'The Matrix'})-[r:BETTER_THAN]->(m2:Movie {title:'The Matrix Reloaded'})")
    .Return(r => r.As<BetterThan>())
    .Results;
 
foreach (var betterThan in results)
    Console.WriteLine("Better Than By: {0}", betterThan.By);

On 8 September 2015 at 14:46, Benjamin Grabkowitz <bgrab...@gmail.com> wrote:
The documentation still references Typed Relationships utilizing IRelationship, but its unclear if this is legacy or still best practice?

I get the feeling that it has been replaced with Cypher, yet I don't see any examples on creating/querying Relationships as entities with Cypher.

--
You received this message because you are subscribed to the Google Groups "Neo4jClient" group.
To unsubscribe from this group and stop receiving emails from it, send an email to neo4jclient...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages