tinkerpop-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From spmalle...@apache.org
Subject [18/50] tinkerpop git commit: TINKERPOP-1878 Added basic docs for sparql-gremlin
Date Thu, 16 Aug 2018 16:58:06 GMT
TINKERPOP-1878 Added basic docs for sparql-gremlin


Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/7343ca89
Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/7343ca89
Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/7343ca89

Branch: refs/heads/TINKERPOP-1342
Commit: 7343ca89ad441294aca2878043f8db67135513be
Parents: 973d8cf
Author: Stephen Mallette <spmva@genoprime.com>
Authored: Mon Jan 29 11:04:23 2018 -0500
Committer: Stephen Mallette <spmva@genoprime.com>
Committed: Mon Aug 13 14:39:23 2018 -0400

----------------------------------------------------------------------
 docs/preprocessor/install-plugins.sh    |  2 +-
 docs/src/reference/index.asciidoc       |  2 +
 docs/src/reference/transpilers.asciidoc | 66 ++++++++++++++++++++++++++++
 3 files changed, 69 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/7343ca89/docs/preprocessor/install-plugins.sh
----------------------------------------------------------------------
diff --git a/docs/preprocessor/install-plugins.sh b/docs/preprocessor/install-plugins.sh
index 0a7ca31..f1da197 100755
--- a/docs/preprocessor/install-plugins.sh
+++ b/docs/preprocessor/install-plugins.sh
@@ -25,7 +25,7 @@ TMP_DIR=$3
 INSTALL_TEMPLATE="docs/preprocessor/install-plugins.groovy"
 INSTALL_FILE="${TMP_DIR}/install-plugins.groovy"
 
-plugins=("hadoop-gremlin" "spark-gremlin" "neo4j-gremlin")
+plugins=("hadoop-gremlin" "spark-gremlin" "neo4j-gremlin", "sparql-gremlin")
 # plugins=()
 pluginsCount=${#plugins[@]}
 

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/7343ca89/docs/src/reference/index.asciidoc
----------------------------------------------------------------------
diff --git a/docs/src/reference/index.asciidoc b/docs/src/reference/index.asciidoc
index 6e81bf2..02a218b 100644
--- a/docs/src/reference/index.asciidoc
+++ b/docs/src/reference/index.asciidoc
@@ -45,6 +45,8 @@ include::implementations-hadoop-end.asciidoc[]
 
 include::gremlin-variants.asciidoc[]
 
+include::transpilers.asciidoc[]
+
 include::conclusion.asciidoc[]
 
 include::acknowledgements.asciidoc[]

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/7343ca89/docs/src/reference/transpilers.asciidoc
----------------------------------------------------------------------
diff --git a/docs/src/reference/transpilers.asciidoc b/docs/src/reference/transpilers.asciidoc
new file mode 100644
index 0000000..305e3dc
--- /dev/null
+++ b/docs/src/reference/transpilers.asciidoc
@@ -0,0 +1,66 @@
+////
+Licensed to the Apache Software Foundation (ASF) under one or more
+contributor license agreements.  See the NOTICE file distributed with
+this work for additional information regarding copyright ownership.
+The ASF licenses this file to You under the Apache License, Version 2.0
+(the "License"); you may not use this file except in compliance with
+the License.  You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+////
+[[transpilers]]
+= Gremlin Transpilers
+
+There are many languages built to query data. SQL is typically used to query relational data.
There is SPARQL for RDF
+data. Cypher is used to do pattern matching in graph data. The list could go on. Transpilers
convert languages like
+these to Gremlin so that it becomes possible to use them in any context that Gremlin is used.
In other words, a
+Gremlin Transpiler enables a particular query language to work on any TinkerPop-enabled graph
system.
+
+== SPARQL-Gremlin
+
+[source,xml]
+----
+<dependency>
+   <groupId>org.apache.tinkerpop</groupId>
+   <artifactId>sparql-gremlin</artifactId>
+   <version>x.y.z</version>
+</dependency>
+----
+
+The SPARQL-Gremlin transpiler converts link:https://en.wikipedia.org/wiki/SPARQL[SPARQL]
queries into Gremlin so that
+they can be executed across any TinkerPop-enabled graph system. To use this transpiler in
the Gremlin Console, first
+install and activate the "tinkerpop.sparql" plugin:
+
+[source,text]
+----
+gremlin> :install org.apache.tinkerpop sparql-gremlin x.y.z
+==>Loaded: [org.apache.tinkerpop, sparql-gremlin, x.y.z]
+gremlin> :plugin use tinkerpop.sparql
+==>tinkerpop.sparql activated
+----
+
+Installing this plugin will download appropriate dependencies and import certain classes
to the console so that they
+may be used as follows:
+
+[gremlin-groovy,modern]
+----
+graph = TinkerFactory.createModern()
+g = graph.traversal(SparqlTraversalSource)                                              
              <1>
+g.sparql("""SELECT ?name ?age
+            WHERE { ?person v:name ?name . ?person v:age ?age }
+            ORDER BY ASC(?age)""")                                                      
              <2>
+----
+
+<1> Define `g` as a `TraversalSource` that uses the `SparqlTraversalSource` - by default,
the `traversal()` method
+usually returns a `GraphTraversalSource` which includes the standard Gremlin starts steps
like `V()` or `E()`. In this
+case, the `SparqlTraversalSource` enables starts steps that are specific to SPARQL only -
in this case the `sparql()`
+start step.
+<2> Execute a SPARQL query against the TinkerGraph instance. The `SparqlTraversalSource`
uses a
+<<traversalstrategy,TraversalStrategy>> to transparently converts that SPARQL
query into a standard Gremlin traversal
+and then when finally iterated, executes that against the TinkerGraph.


Mime
View raw message