This article was first published on the Nebula Graph Community public account
about the author
Hello everyone, I'm Anyzm, the founder of the graph-ocean (GitHub: https://github.com/nebula-contrib/graph-ocean ) project. I am currently working in 360 Digital, and my position is a senior JAVA development engineer.
After introducing myself, let's introduce what graph-ocean is?
Introduction to graph-ocean
graph-ocean is an ORM (Object Relational Mapping) framework based on the nebula-java client. Friends familiar with ORM should know that ORM is to create a "virtual object database" that can be used in programming languages, allowing developers to more efficiently develop business.
And I named the Java ORM graph-ocean because Ocean echoes the Nebula (star) of Nebula Graph, which means the sea of stars.
Why design a Java ORM
If community users are familiar with 360 Mathematics, they will know that we are in the "JanusGraph to NebulaGraph Migration" written by our technical team (link: https://discuss.nebula-graph.com.cn/t/topic/1172 ) Nebula Graph has been using it very early, and it has been running in the test environment before the official release of v1.0.0.
In the process of using Nebula Graph v1.0.0 in 360 Digits, our Java client uses enumeration to present the Tag and Edge data used, and the process of parsing API into nGQL also strongly relies on enumeration. Invasive .
Therefore, in the process of contacting the project later, I was determined to change this situation.
Solve code hacking problems
We all know that no matter what framework is connected to the database, the framework will eventually be parsed into a language that the database can recognize. For Nebula Graph, users can use openCypher or nGQL, the native query language of Nebula Graph.
We are accustomed to using nGQL in our project, so the step of parsing business code into nGQL has been completed for a large part in the process of using v1.0.0. The intrusive nature of business code is brought about by the enumeration of vertices and edges. The function of enumeration is to locate Tag or Edge. To obtain this information from entity classes without intrusion, I thought of imitating JPA (Java Persistence API) annotation method.
As a result, graph-ocean has a preliminary appearance in mind. Once the entity class is determined, the corresponding Tag or Edge should also be determined, so cache can be used to improve performance.
(overall design drawing)
After a simple design, graph-ocean was born. After it was developed, my colleagues and I felt very happy to use it, so we decided to open source the framework and feed it back to the community.
graph-ocean features
graph-ocean allows developers to read and write to Nebula Graph more elegantly and flexibly, and can help us quickly convert entity and database data (this is also the characteristic of ORM framework), and because of the existence of cache, performance Don't worry about that either.
Simple usage of graph-ocean
graph-ocean is composed of Java annotations, reflection, caching, string concatenation, nebula-java connection pool, session management, etc. If users have skilled reflection and connection pool development experience, they can get started quickly. If not, it doesn’t matter, they mainly focus on NebulaSessionPoolManager (session management), GraphMapper (basic database operation class), @GraphEdge (edge annotation), @ GraphVertex (vertex annotation), @GraphProperty (property annotation), GraphQuery (query API), QueryResult (query result) these classes or interfaces are enough.
Future plans for graph-ocean
graph-ocean currently does not support all the built-in functions of Nebula Graph (but it has met most business scenarios). Since graph-ocean depends on nebula-java, with the replacement of nebula-java versions, graph-ocean also needs long-term maintenance version problem.
Since graph-ocean is currently maintained by myself, the documentation is not complete, and there are still many points that need to be improved.
Therefore, the next stage is to gradually improve the use of documents and improve the API. At the same time, we hope that more like-minded people will participate together to maintain the sea of stars in the graph-ocean .
Exchange graph database technology? To join the Nebula exchange group, please fill in your Nebula business card first, and the Nebula assistant will pull you into the group~~
**粗体** _斜体_ [链接](http://example.com) `代码` - 列表 > 引用
。你还可以使用@
来通知其他用户。