Spring Data Gremlin for Azure Cosmos DB Graph API
We are pleased to announce that Spring Data Gremlin is now available on Maven Central and source code on GitHub. This project provides Spring Data support for Graph databases that use Gremlin as a traversal language. For Azure users, it provides a delightful experience to interact with Azure Cosmos DB using Graph API. Java developers can now use Spring annotations to map with database entities, such as Vertex and Edge. It also allows developers to create their own database queries based on Spring Data Repository.
Spring Data Gremlin supports annotation-oriented programming model to simplify the mapping to the database entity. It also provides supports to create custom queries.
- Mapping with database entities, including annotations.
- @Id to map a filed in the domain class with id field of an entity.
- @Vertex and @VertexSet map to Vertex.
- @Edge, @EdgeSet, @EdgeFrom and @EdgeTo to map with Edge
- Advanced operations with Vertex, Edge and Graph.
- findVertexById and findEdgeById to find data by specific field.
- vertexCount and edgeCount for counting Vertex and Edge numbers.
- Spring Data CRUD functionality.
- Custom database queries based on Spring Data Repository.
You can follow this tutorial to create a Graph database instance in Azure Cosmos DB and add a new Graph in Data Explorer. Use the URI and Keys on the overview page to configure your project.
Configure your project
Include the Spring Data Gremlin library in your project, by opening the pom.xml file and adding the following settings in the <dependencies> section. Then set up the application.yml file to connect with the Graph database you just created.
<dependency> <groupId>com.microsoft.spring.data.gremlin</groupId> <artifactId>spring-data-gremlin</artifactId> <version>2.0.0</version> </dependency>
More detailed configurations are available on GitHub.
Get started with our sample! Once you’ve executed it, you can open the Azure Portal to check the updated Graph in your database.
When it’s done, read about our project on GitHub and discover more advanced features.
More information about using Spring on Azure, visit the following pages:
- GitHub: Spring Data Gremlin
- GitHub: Spring Data Azure Cosmos DB
- GitHub: Spring Boot Starters for Azure Services
- Developer center: Spring on Azure
- Developer center: Java on Azure
Feedback and questions help us to improve. You can share your thoughts by contacting us on GitHub.
Source: Azure Blog Feed