In general Neo4j is a schema free database so it's strength is in many other areas.
Best would be to use a query generator/DSL that adhere's to the schema. You can look into the work on ontologies by my colleague Jesus: https://jesusbarrasa.wordpress.com/2016/04/06/building-a-semantic-graph-in-neo4j/ You can use existence constraints for properties, there are currently none for cardinalities. And if you run a cypher query with explain you will get warnings about unused labels, rel-types and properties. You can also checkout our neo4j.com/developer/graphql work, which uses graphql-schema and then generates queries and mutations from that. > Am 30.05.2017 um 18:20 schrieb Yash Sharma <[email protected]>: > > > I have a neo4j database and I want it to conform to a predefined schema > (model). > > > This schema has some constraints like a node with label x should be related > to a node with label y with relation type r only. No other relationship type > between x and y is allowed. For example, only nodes labeled :Person can be at > the two ends of a :friend_of relationship, but a node with label :Object > cannot be at any end of the :friend_of relationship. Another constraint can > be what type of properties are allowed on a node having a particular label or > a relationship of a particular type. For example a node with label :Person > can only have properties name and age. No other property is allowed. > > > > So I want to create a method which takes input an update cypher query and > checks if it updates the database as per the existing schema or not. Assume > that the schema exists in JSON or XML format. Can someone guide me how can I > go about solving the problem? Should I perhaps parse the query using > CypherParser and then do something? > > > -- > 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. -- 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.
