Difference between cypher used by BangDB vs Neo4j
Following are basic differences from Cypher point of view:
- For all queries (retrieval), the query starts with "<token>=>", instead of "Match"
- The queries could be nested using the "[]" bracket which becomes subject for subsequent nodes. For example, look at following two queries.
S2=>[S1=>(Person:*)-[ACTED_IN]->(Movie:*)]-[LIVES_IN]->(City:Bangalore)
S1=>(Person:*)-[ACTED_IN]->(Movie:*)-[DIRECTED_BY]->(Person:*)-[LIVES_IN]->(City:SFO)
First one will first fetch all the persons who have acted in any movies, and who lives in city Bangalore.
Second one will fetch all the persons who live in "SFO" who have directed movies in which some persons have acted in etc…
- Specific methods like; #ALL_PATH, #SHORT_PATH, #ALL_NODE is supported to find all paths between any two nodes, shortest path between two nodes and all nodes in between two nodes.
- Here we use "label:name" instead of "name":"label" as in Cypher. This is mainly because it's more intuitive to use labels first and then name. If we wish to take any name, we can put '*' in place of it. In-fact we can put '*' for label or relation as well.
- The variable or alias begins with'@', like (@p Person:Sachin) etc. This is handy for selection of attributes/properties from a node or relation
- All data science or ML related activities can be done using the Keywords like "SIMILARITY", "CLUSTER", "CENTRALITY", "COMMUNITY_DETECTION", "GROUPS" to leverage inbuilt dedicated ML+Graph processing. However, we can bring the entire ML algos to Graph by simply using "ML_ALGO" keyword along with the model's name that is trained within BangDB.