This is an automated email from the ASF dual-hosted git repository.

spmallette pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/tinkerpop.git


The following commit(s) were added to refs/heads/master by this push:
     new 60afcb8  Added documentation for enabling Bolt on Neo4jGraph CTR
     new 01ef5b7  Merge branch 'tp34'
60afcb8 is described below

commit 60afcb84e1d50f58b6da60ae798a45a939753c1b
Author: stephen <[email protected]>
AuthorDate: Mon Oct 28 15:52:37 2019 -0400

    Added documentation for enabling Bolt on Neo4jGraph CTR
---
 docs/src/reference/implementations-neo4j.asciidoc | 78 ++++++++++++++++++++++-
 gremlin-server/conf/neo4j-empty.properties        |  5 ++
 2 files changed, 82 insertions(+), 1 deletion(-)

diff --git a/docs/src/reference/implementations-neo4j.asciidoc 
b/docs/src/reference/implementations-neo4j.asciidoc
index edb7aa1..a94b732 100644
--- a/docs/src/reference/implementations-neo4j.asciidoc
+++ b/docs/src/reference/implementations-neo4j.asciidoc
@@ -188,9 +188,85 @@ IMPORTANT: `LabelP.of()` is only required if multi-labels 
are leveraged. `LabelP
 filtering/looking-up vertices by their label(s) as the standard `P.eq()` does 
a direct match on the `::`-representation
 of `vertex.label()`
 
+=== Configuration
+
+The previous examples showed how to create a `Neo4jGraph` with the default 
configuration, but Neo4j has many other
+options to initialize it that are native to Neo4j. In order to expose those, 
`Neo4jGraph` has an `open(Configuration)`
+method which takes a standard Apache Configuration object. The same can be 
said of the standard method for creating
+`Graph` instances with `GraphFactory`. Each configuration key that Neo4j has 
must simply be prefixed with
+`gremlin.neo4j.conf.` and the suffix configuration key will be passed through 
to Neo4j.
+
+NOTE: Gremlin Server uses `GraphFactory` to instantiate the `Graph` instances 
it manages, so the example below is also
+relevant for that purpose as well.
+
+For example, a standard configuration file called `neo4j.properties` that sets 
the Neo4j
+`dbms.index_sampling.background_enabled` setting might look like:
+
+[source,properties]
+----
+gremlin.graph=org.apache.tinkerpop.gremlin.neo4j.structure.Neo4jGraph
+gremlin.neo4j.directory=/tmp/neo4j
+gremlin.neo4j.conf.dbms.index_sampling.background_enabled=true
+----
+
+which can then be used as follows:
+
+[source,text]
+----
+gremlin> graph = GraphFactory.open('neo4j.properties')
+==>neo4jgraph[community single [/tmp/neo4j]]
+gremlin> g = graph.traversal()
+==>graphtraversalsource[neo4jgraph[community single [/tmp/neo4j]], standard]
+----
+
+Having this ability to set standard Neo4j configurations makes it possible to 
better control the initialization of
+Neo4j itself and provides the ability to enable certain features that would 
not otherwise be accessible.
+
+=== Bolt Configuration
+
+While `Neo4jGraph` enables Gremlin based queries, users may find it helpful to 
also be able to connect to that graph
+with native Neo4j drivers and other tools from that space. It is possible to 
enable the
+link:https://boltprotocol.org/[Bolt Protocol] as a way to do this:
+
+[source,properties]
+----
+gremlin.graph=org.apache.tinkerpop.gremlin.neo4j.structure.Neo4jGraph
+gremlin.neo4j.directory=/tmp/neo4j
+gremlin.neo4j.conf.dbms.connector.0.type=BOLT
+gremlin.neo4j.conf.dbms.connector.0.enabled=true
+gremlin.neo4j.conf.dbms.connector.0.address=localhost:7687
+----
+
+This configuration is especially relevant to Gremlin Server where one might 
want to connect to the same graph instance
+with both Gremlin and Cypher.
+
+[source,text]
+----
+gremlin> :install org.neo4j.driver neo4j-java-driver 1.7.2
+==>Loaded: [org.neo4j.driver, neo4j-java-driver, 1.7.2]
+... // restart Gremlin Console
+gremlin> import org.neo4j.driver.v1.*
+==>org.apache.tinkerpop.gremlin.structure.*, 
org.apache.tinkerpop.gremlin.structure.util.*, ... org.neo4j.driver.v1.*
+gremlin> driver = GraphDatabase.driver( "bolt://localhost:7687", 
AuthTokens.basic("neo4j", "neo4j"))
+Oct 28, 2019 3:28:20 PM org.neo4j.driver.internal.logging.JULogger info
+INFO: Direct driver instance 1385140107 created for server address 
localhost:7687
+==>org.neo4j.driver.internal.InternalDriver@528f8f8b
+gremlin> session = driver.session()
+==>org.neo4j.driver.internal.NetworkSession@f3fcd59
+gremlin> session.run( "CREATE (a:person {name: {name}, age: {age}})",
+......1>                 Values.parameters("name", "stephen", "age", 29))
+gremlin> :remote connect tinkerpop.server conf/remote.yaml
+==>Configured localhost/127.0.0.1:8182
+gremlin> :remote console
+==>All scripts will now be sent to Gremlin Server - [localhost/127.0.0.1:8182] 
- type ':remote console' to return to local mode
+gremlin> g.V().elementMap()
+==>{id=0, label=person, name=stephen, age=29}
+----
+
 === High Availability Configuration
 
-image:neo4j-ha.png[width=400,float=right] TinkerPop supports running Neo4j 
with its fault tolerant master-slave replication configuration, referred to as 
its
+image:neo4j-ha.png[width=400,float=right] TinkerPop supports running Neo4j 
with its fault tolerant master-slave
+replication configuration, referred to as its
 
link:http://neo4j.com/docs/operations-manual/current/#_neo4j_cluster_install[High
 Availability (HA) cluster]. From the
 TinkerPop perspective, configuring for HA is not that different than 
configuring for embedded mode as shown above. The
 main difference is the usage of HA configuration options that enable the 
cluster. Once connected to a cluster, usage
diff --git a/gremlin-server/conf/neo4j-empty.properties 
b/gremlin-server/conf/neo4j-empty.properties
index 476458b..d1ad61e 100644
--- a/gremlin-server/conf/neo4j-empty.properties
+++ b/gremlin-server/conf/neo4j-empty.properties
@@ -33,3 +33,8 @@ gremlin.neo4j.conf.dbms.auto_index.nodes.enabled=true
 #gremlin.neo4j.conf.dbms.auto_index.nodes.keys=
 gremlin.neo4j.conf.dbms.auto_index.relationships.enabled=true
 #gremlin.neo4j.conf.dbms.auto_index.relationships.keys=
+
+# uncomment the following to enable Bolt on the specified port
+# gremlin.neo4j.conf.dbms.connector.0.type=BOLT
+# gremlin.neo4j.conf.dbms.connector.0.enabled=true
+# gremlin.neo4j.conf.dbms.connector.0.address=localhost:7687

Reply via email to