From 2c4723798a2d1336bd7aab43df964d734a50aaa1 Mon Sep 17 00:00:00 2001 From: Otavio Santana Date: Sat, 10 Aug 2024 17:40:47 +0100 Subject: [PATCH] docs: upgrade readme and remove graph reference Signed-off-by: Otavio Santana --- README.adoc | 110 ---------------------------------------------------- 1 file changed, 110 deletions(-) diff --git a/README.adoc b/README.adoc index 6d35088b4..72465bd51 100644 --- a/README.adoc +++ b/README.adoc @@ -464,116 +464,6 @@ public DocumentManager getManagerB() { } ---- -=== Graph - -Currently, the Jakarta NoSQL doesn't define an API for Graph database types but Eclipse JNoSQL provides a Graph template to explore the specific behavior of this NoSQL type. - -Eclipse JNoSQL offers a mapping implementation for Graph NoSQL types: - -[source,xml] ----- - - org.eclipse.jnosql.mapping - jnosql-mapping-graph - 1.1.1 - ----- - -Despite the other three NoSQL types, Eclipse JNoSQL API does not offer a communication layer for Graph NoSQL types. Instead, it integrates with https://tinkerpop.apache.org/[Apache Tinkerpop 3.x]. - -[source,java] ----- -@Inject -GraphTemplate template; -... - -Category java = Category.of("Java"); -Book effectiveJava = Book.of("Effective Java"); - -template.insert(java); -template.insert(effectiveJava); -EdgeEntity edge = template.edge(java, "is", software); - -Stream books = template.getTraversalVertex() - .hasLabel("Category") - .has("name", "Java") - .in("is") - .hasLabel("Book") - .getResult(); ----- - -Apache TinkerPop is database agnostic. Thus, you can change the database in your application with no or minimal impact on source code. - -You can define the database settings using the https://microprofile.io/microprofile-config/[MicroProfile Config] specification, so you can add properties and overwrite it in the environment following the https://12factor.net/config[Twelve-Factor App]. - -[source,properties] ----- -jnosql.graph.provider= -jnosql.provider.host= -jnosql.provider.user= -jnosql.provider.password= ----- - -TIP: The ```jnosql.graph.provider``` property is necessary when you have more than one driver in the classpath. Otherwise, it will take the first one. - -These configuration settings are the default behavior. Nevertheless, there is an option to programmatically configure these settings. Create a class that implements the ```Supplier```, then define it using the ```@Alternative``` and ```@Priority``` annotations. - -[source,java] ----- -@Alternative -@Priority(Interceptor.Priority.APPLICATION) -public class ManagerSupplier implements Supplier { - - @Produces - public Graph get() { - Graph graph = ...; // from a provider - return graph; - } -} ----- - -You can work with several document database instances through CDI qualifier. To identify each database instance, make a `Graph` visible for CDI by putting the ```@Produces``` and the ```@Database``` annotations in the method. - -[source,java] ----- -@Inject -@Database(value = DatabaseType.GRAPH, provider = "databaseA") -private GraphTemplate templateA; - -@Inject -@Database(value = DatabaseType.GRAPH, provider = "databaseB") -private GraphTemplate templateB; - -// producers methods -@Produces -@Database(value = DatabaseType.GRAPH, provider = "databaseA") -public Graph getManagerA() { - return manager; -} - -@Produces -@Database(value = DatabaseType.GRAPH, provider = "databaseB") -public Graph getManagerB() { - return manager; -} ----- - - -Eclipse JNoSQL does not provide https://mvnrepository.com/artifact/org.apache.tinkerpop/gremlin-core[Apache Tinkerpop 3 dependency]; check if the provider does. Otherwise, do it manually. - -[source,xml] ----- - - org.apache.tinkerpop - jnosql-gremlin-core - ${tinkerpop.version} - - - org.apache.tinkerpop - jnosql-gremlin-groovy - ${tinkerpop.version} - ----- === Jakarta Data