Create\Add a graph Titan server using default rexster - titan

when i run
rexster.getGraphNames()
my only result is graph, when i ran a gremlin instance directly over titan i had
tmp
and created a graph called
mygraph
i have been loooking around and havent found anything

Titan Server will only host a single instance of a graph. Therefore, rexster.getGraphNames() will always only return one graph and it will always be called graph.
Creating a graph called mygraph with the Gremlin REPL won't connect Titan Server to the graph unless you've configured it to do so and even then, it will still be referred to by Titan Server as just graph.

Related

Update attribute in Overpass-API Local server

I have created an overpass API server locally using docker (https://hub.docker.com/r/wiktorn/overpass-api). Suppose I would like to update an attribute of a node/way such as smoothness, surface, speed limit etc. with a new value for a single point or make a bulk update of points in my locally installed server (instead of the public server), how does one do that? Any feedback is appreciated.

Store Gremlin graph in local DynamoDB

Instead of using AWS, I am using its local available DynamoDB database and creating a graph in the Gremlin console.
My PC is using Gremlin-version=3.0.1.incubating and Titan-version=1.0.0
My question: How to save a graph in my local DynamoDB so that I can retrieve it back whenever I wish? (E.g. after computer restart).
I have tried a lot, using save() or commit() graph. But I always got an error:
g.commit()
No signature of method: org.apache.tinkerpop.gremlin.process.traversal.dsl.graph
.GraphTraversalSource.commit() is applicable for argument types: () values: []
Possible solutions: wait(), computer(), collect(), wait(long), computer(java.lang.Class), collect(groovy.lang.Closure)
I am using Tinkerpop 3.
Relevant documentation links:
Amazon DynamoDB Storage Backend for Titan
Running DynamoDB on Your Computer
As Filipe mentioned, g.commit() throws an exception because there is no commit() method on g which is a GraphTraversalSource. I suggested that you use graph.tx().commit(), where graph.tx() gets the Transaction from the Graph. In the comments we found out that you were trying to commit() a transaction on a TinkerGraph, which does not support transactions.
You need to instantiate a TitanGraph, not a TinkerGraph. This commonly done with a properties file, and there is a DynamoDB Local example properties file in the dynamodb-titan-storage-backend repository. Make sure to update the storage.dynamodb.client.endpoint to match your configuration. If you are using the Titan Server directions from the DynamoDB-Titan link, the port is 4567. If you are using the directions from the DynamoDB local link above, the default port is 8000.
gremlin> graph = TitanFactory.open('conf/gremlin-server/dynamodb-local.properties')
==>standardtitangraph[com.amazon.titan.diskstorage.dynamodb.DynamoDBStoreManager:[127.0.0.1]]
gremlin> v0 = graph.addVertex('name', 'jason'); v1 = graph.addVertex('name', 'mustaffa'); v0.addEdge('helps', v1)
==>e[175-39k-1lh-374][4232-helps->4144]
gremlin> graph.tx().commit()
==>null
Also note, the DynamoDB-Titan directions end up starting an in-memory DynamoDB Local instance. This behavior can be changed by commenting out the -inMemory argument the pom.xml.
You are attempting to commit your traversal g. You should be attempting to commit your graph like so: graph.commit().
g is the traversal which is initialised as such: g = graph.traversal() and it cannot be committed.

Titan - How to Use 'Lucene' Search Backend

I am attempting to use the lucene search backend with Titan. I am setting the index.search.backend property to lucene as so.
TitanFactory.Builder config = TitanFactory.build();
config.set("storage.backend", "hbase");
config.set("storage.hostname", "node1");
config.set("storage.hbase.table", "titan");
config.set("index.search.backend", "lucene");
config.set("index.search.directory", "/tmp/foo");
TitanGraph graph = config.open();
GraphOfTheGodsFactory.load(graph);
graph.getVertices().forEach(v -> System.out.println(v.toString()));
Of course, this does not work because this setting is of the GLOBAL_OFFLINE variety. The logs make me aware of this. Titan ignores my 'lucene' setting and then attempts to use Elasticsearch as the search backend.
WARN com.thinkaurelius.titan.graphdb.configuration.GraphDatabaseConfiguration
- Local setting index.search.backend=lucene (Type: GLOBAL_OFFLINE)
is overridden by globally managed value (elasticsearch). Use
the ManagementSystem interface instead of the local configuration to control
this setting.
After some reading, I understand that I need to use the Management System to set the index.search.backend. I need some code that looks something like the following.
graph.getManagementSystem().set("index.search.backend", "lucene");
graph.getManagementSystem().set("index.search.directory", "/tmp/foo");
graph.getManagementSystem().commit();
I am confused on how to integrate this in my original example code above. Since this is a GLOBAL_OFFLINE setting, I cannot set this on an open graph. At the same time, I do not know how to get a graph unless I open one first. How do I set the search backend correctly?
There is no inmemory search backend. The supported search backends are Lucene, Solr, and Elasticsearch.
Lucene is a good option for a small scale, single machine search backend. You need to set 2 properties to do this, index.search.backend and index.search.directory:
index.search.backend=lucene
index.search.directory=/path/to/titansearchindexdir
As you've noted, the search backend is a GLOBAL_OFFLINE, so you should configure this before initially creating your graph. Since you've already created a titan table in your HBase, either disable and drop the titan table, or set your graph configuration to point at a new storage.hbase.table.

OrientDB No edge created Execption

I am currently getting a "No edge created" exception while using OrientDB 2.1
As per the CREATE EDGE documentation (http://orientdb.com/docs/2.1/SQL-Create-Edge.html):
Beginning with version 2.1, when no edges are created OrientDB throws
a OCommandExecutionException error. This makes it easier to integrate
edge creation in transactions. In such cases, if the source or target
vertices don't exist, it rolls back the transaction.
I was wondering if there was some way to log/print out information regarding the vertices it is trying to create an edge between. I am using a JSON file to query for updates from a DB and transformer inside that JSON to create the edges using the IDs as parameters of the query results. Thanks
I solved my issue of getting ID information of the vertices by adding "log": "debug" to the JSON file.

Loading data into Titan

I am currently running Titan Server (0.4) [via bin/titan.sh -c cassandra-es start] and load the sample data using rexster-console:
rexster[groovy]> g = rexster.getGraph("graph")
rexster[groovy]> GraphOfTheGodsFactory.load(g)
How can I do the same thing above using a RexsterClient in java? Essentially, Is it possible to get access to graph without me having to embed all this in client.execute()?
Thanks for your help.
Once you've created the graph you can access it with RexsterClient. You shouldn't need to recreate the graph again with it as the data is already in Cassandra. Just specify the graph name when constructing your RexsterClient instance (in the case of Titan Server the graph name is just "graph"):
RexsterClient client = RexsterClientFactory.open("localhost", "graph");
List<Map<String, Object>> results = client.execute("g.v(4).map");
That will initialize "g" and allow you to just issue some Gremlin against the Graph of the Gods sample data set. You can read more about the options for RexsterClient here.