In general, this is very hard indeed. You have to not only know the labels of existing nodes, but the meaning of the Cypher query. Although Cypher isn't likely Turing-complete, it is nearly certain that there are legal queries that you can't easily (or at all) *prove *are legal. This is equivalent to the question of "What does this program do?" - which is known to be impossible to answer for Turing-complete languages. Michael's suggestion of a query generator which only generates updates which conform to the schema is likely your best bet. -- Alan Robertson [email protected]
On Tue, May 30, 2017, at 06:48 PM, Clark Richey wrote: > This is quite challenging to implement. That being said we have > implemented this in our application (http://factgem.com) and would be > happy to discuss with you directly.> > Sent from my iPhone > > On May 30, 2017, at 12:20, Yash Sharma <[email protected]> wrote:>> >> 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. -- 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.
