Setup and Configuration of SPARQL-Gremlin plugin (with ArcadeDB)
Dear All,
I would like to use the SPARQL-Gremlin ( https://tinkerpop.apache.org/docs/current/reference/#sparql-gremlin ) plugin with the embedded Gremlin server in ArcadeDB.
ArcadeDB exposes the
gremlin-server.groovy
, gremlin-server.properties
, and gremlin-server.yaml
files in its config
directory. So my questions are:
1. How do I install the plugin? Particularly, is there a way without recompiling the embedding ArcadeDB?
2. What configurations do I have to add to these files to activate and use the SPARQL plugin? I found some hints and partial examples here and there but patchworking those did not work.
Thank you very much for your help18 Replies
I'm not sure what @arcadedb allows with its embedded Gremlin Server but you would normally need to do two things with a standalone Gremlin Server:
1. get the
sparql-gremlin
in Gremlin Server's classpath with bin/gremlin-server.sh install org.apache.tinkerpop sparql-gremlin <version>
which will install not only sparql-gremlin
but all its dependencies. if that shell script isn't available with ArcadeDB, i guess you would have to get all those dependencies on the ArcadeDB classpath manually. maybe a shortcut way to do that would be to install sparql-gremlin
in the Gremlin console then pull the jars from the {CONSOLE_HOME}/ext/sparql-gremlin
directory
2. Add an entry like this to the Gremlin Server yaml file: https://github.com/apache/tinkerpop/blob/3.6.2/gremlin-server/conf/gremlin-server-spark.yaml#L50 but reference org.apache.tinkerpop.gremlin.sparql.jsr223.SparqlGremlinPlugin
GitHub
tinkerpop/gremlin-server-spark.yaml at 3.6.2 · apache/tinkerpop
Apache TinkerPop - a graph computing framework. Contribute to apache/tinkerpop development by creating an account on GitHub.
Hi @spmallette , Thank you for your reply.
I performed the two steps you suggested (I manually copied all the jars below
ext/sparql-gremlin
to the folder holding ArcadeDB's jars), but I get, when using g.sparql("""SELECT * WHERE { ?x ?y ?z . }""")
, the error No signature of method: org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource.sparql()
. Also when running graph = TinkerFactory.createModern()
I get the error No such property: TinkerFactory for class: Script5
.did you configure
g
to in the Gremlin Server initialization script to use sparql-gremlin? your script should configure g
like: g = traversal(SparqlTraversalSource)
(i have no idea if ArcadeDB allows you to use the init script)Running
g = traversal(SparqlTraversalSource)
results in the error: No such property: SparqlTraversalSource for class: Script8
. About the init
script, I can't say either.that seems to indicate to me that either (step 2) isn't setup right or the jars aren't on the classpath somehow. not sure how ArcadeDB loads jars for this embedding, so maybe it's not as simple as just putting them in ArcadeDB's
/lib
folder (or equivalent). do Gremlin Server's logs show on startup? any errors?This could be the case. The logs just state:
GremlinServer plugin started
Thank you nonetheless, this is a good foundation to start experimenting more. I will come back with further questions if necessary.Hi,
I have two follow up questions:
1. Which subfolder jars of
ext/sparql-gremlin
do I need to copy: lib
or plugin
? I copied both but there seem to be duplicates.
2. I get now the log output with the above suggested config in the gremlin-server.yaml
:
Thank you again!if they are identical (and i suspect they are) it shouldn't matter which you copy. some plugins like spark have different uses/contents so it might matter in those cases. that error is really strange if you have the sparql-gremlin jar on arcadedb's classpath. i'm not sure why you would get that error except in the cases where it's not being found.
I had the same feeling, given the error
java.lang.ClassNotFoundException: org.apache.tinkerpop.gremlin.sparql.jsr223.SparqlGremlinPlugin
.
The line to add to the gremlin-server.yaml
being org.apache.tinkerpop.gremlin.sparql.jsr223.SparqlGremlinPlugin: {}
is correct, right?
Just using the plugin
jars I got a step further. Cool!i think the line is right, but that's not the only step. you have to
bin/gremlin-server.sh install ....
to get the dependencies into the Gremlin Server path normally. maybe the best thing to do would be to do that in a vanilla Gremlin Server and then copy/paste from the server's /ext
directory to the ArcadeDB pathMaybe I am missing an import in the
gremlin-server.groovy
or a processor or serializer in the gremlin-server.yaml
?looks like "g" simply isn't isn't initialized properly. does your
gremlin-server.groovy
file include the SparqlTraversalSource
in the setup of "g"?It has
globals << [g : traversal(SparqlTraversalSource)]
hmm - that's not bound to a
Graph
instance though. like, i'd expect it to be like:
where "graph" is a graph name in your yaml file.
that said, a bit odd that you got a parsing error with that. i'd have expected something else
otoh, i'm not sure how ArcadeDB handles the embedded Gremlin Server it hasCan you explain what you mean with "where "graph" is a graph name in your yaml file." in more detail? Thank you for your patience
well, if you just do:
g = traversal(SparqlTraversalSource)
it doesn't bind "g" to a Graph
instance. it just create a SparqlTraversalSource
with an EmptyGraph
which holds nothing. just like any construction of "g" you need to actually bind the traversal source to a graph, like, in Gremlin Console you would do:
you have to do the same thing in Gremlin Server. Gremlin Server configures Graph
instances you can give to withEmbedded()
in the gremlin-server.yaml
file as shown here: https://github.com/apache/tinkerpop/blob/master/gremlin-server/conf/gremlin-server-modern.yaml#L22
again, no idea how this applies to ArcadeDB, but that's why you'd do in a vanilla Gremlin Server.Thank you for this explanation.