Question

How to correctly/standardly define schema for neo4j database in my C# application?

In my application, I have nodes with properties and relations with properties. I want to define templates/Classes of these nodes and relations that can then be created and related at run time and retrieved as objects of a class with queries.

After a lot of search and research, I found something that was nearly related to my question: http://blog.micic.ch/net/using-neo4j-graph-db-with-c-net

But according to the Neo4j Documentation these are legacy methods. https://github.com/Readify/Neo4jClient/wiki

So What is the Current standard way in Neo4J 2.0? As we also have labels now.

I hope I am clear enough in my question. If not, Please let me know.

Was it helpful?

Solution

The basic idea is that now you use the Cypher querying capabilities to do everything, so where as Darko uses the REST API to Create / CreateRelationship the client has moved to use Cypher instead.

This means you no-longer need the Relationship based classes, and can stick to POCO (Plain Old CLR Objects) for storing and querying - which makes your code simpler to use...

The standard ways can all be found on the 'Cypher Examples' page on the Neo4jClient wiki, and I've put a gist up with an updated version of Darko's code.

All the addition of labels etc comes from the way you write the Cypher, and as Neo4jClient is as near as can be to being direct Cypher (but with C# niceness added in) the translation should be pretty simple.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top