save gremlin graph usinf gremlin console - amazon-dynamodb

how to save graph made in gremlin console in local dynamo uses tinker popup 3
My PC is using Gremlin-version=3.0.1.incubating and Titan-version=1.0.0
I have tried as many and give a lot time by using
graph.tx().commit()
But shows :: Graph does not support transactions
Display stack trace? [yN]

Related

DSE graph: update the graph in analytics mode

I have a DSE graph in production. I want to update the graph based on the result of an analytic query.
For instance, for each vertex of type 'user', I want to count the incident edges with label 'subscribes', to calculate the number of subscribers of a particular user of the graph.
The count can be easily done with an analytic query in analytic mode (in transactional mode the query can timeout if there is too many edges).
The problem is that in analytic mode I cannot use the computed value to update my model.
When I try to update my counter I get this message: "property addition is not supported".
A workaround could be to count the edges in analytic mode, then switch from analytical mode to transactional mode, and then I can update the counter: this is OK to update a counter on a single particular user, but it's not really practical if I want to update all the users of my graph.
Is there a standard way to update the graph based on the results of analytics queries?
Thank you!
Have you tried DSE Graph Frames for this solution? This may help with your goal.
https://docs.datastax.com/en/dse/5.1/dse-dev/datastax_enterprise/graph/graphAnalytics/dseGraphFrameOverview.html
Ok to answer my own question: as answered by jlacefie, DseGraphFrames seems the way to go to run analytics queries and update the graph at the same time.
The purely analytic mode is not for update. But with writing a simple javascript client, with the dse graph nodejs driver, I was able to open two connections one OLAP and one OLTP, run analytic queries, get the result and use it to run OLTP queries to perform the update.
It is OK given the size of my database, but this approach cannot work if you have too much data to handle.
So the right answer to this question is to use DSEGraphFrames, unfortunately I cannot do it in my system since it doesn't work properly.
I will open a new question for this particular problem.

I am using Tinkerpop 3 and Gremlin. Can someone tell how I can commit the graph that I create using TinkerGraph.open()?

I am using Tinkerpop3 and Gremlin console (by running gremlin.bat). After I create a graph, add nodes, edges to it, if for some reason the console has to be closed I cannot retrieve the graph I created previously. Could someone please tell how I can save the graph I create ?
example- graph = TinkerGraph.open()
// commands to add nodes and edges
// Committing this graph to the db
There is no commit() for TinkerGraph as it's not transactional, but you can save your graph in several different formats. Check out Gremlin I/O docs to learn about the supported formats and get some examples on how to save / load graphs.

Trouble retrieving newly created Vertices by label using DSE Graph

I am trying to write a simple node application that uses the dse node driver to create some vertices and then to retrieve the created vertices for use in creating edges. The actual vertex retrieval traversals are in the groovy code that I'm submitting to DSE. My code for retrieving the vertices looks like:
g.V().hasLabel('someVertex').has('id', 'myId').next();
There is a vertex search index on my id property. Unfortunately, I get an error:
FastNoSuchElementException
The same groovy query works perfectly in the Gremlin REPL. The query also works if I take out the hasLabel call.
I thought that perhaps there was an eventual consistency issue, so I wrote a while loop in groovy that checks for the count of the traversal to be greater than zero. It never returns.
This same application works perfectly against my Titan graph.
Am I perhaps not understanding something about implicit transactions in DSE?
Edit: The code works if I wait 10 seconds after creating the vertices.

Titan + d3 for computer network visualisation

I've been experimenting with Titan over the past few weeks and would like some pointers on the way forward, plus a few specific questions. The purpose of the project is to store log data on a Cassandra cluster (for this question let's use the example of web traffic) and represent relationships in a Titan graph. All nodes are modelled as having an entity value and type (e.g. "google.com","hostname"), and edges have a label (e.g. "connects") as well as several attributes of the relationship (timestamp, flow length and so on).
Once this data is stored in cassandra and represented as a Titan graph, I plan to use d3 code to generate visualisations. At the end of the tunnel I am hoping to be able to build large-scale, interactive, complex graph networks that look something like this: http://goo.gl/CVEd55
My current setup is as follows:
A python script to convert log files into vertices.csv and edges.csv files for Gremlin to load in
Titan Server 0.4 (using CassandraThrift as the storage backend) - gremlin script to load converted data into Titan
Python script that uses NetworkX to open a RexPro connection, allowing the analyst to enter a custom Gremlin query, outputting the result as a JSON
Local web front-end that uses the generated JSON and d3 to display the results of the query as a graph
Ideally as a test base case, I would like the user to be able to type a Gremlin query into the web front-end and be directed to a page containing an interactive d3 graph of the result.
My specific questions are are follows:
What is the process for assigning attributes to edges? I have had trouble finding sample code that helps me represent the graph using the model listed above.
My gremlin script to load data into Titan uses bg.commit() to create a batch graph which is later referenced in the RexPro connection conn= RexProConnection('localhost,8184,'bg'). This was working originally but after changing my load script, clearing the graph in Gremlin and then reloading, the RexPro connection cannot be opened due to the graph bg apparently not existing. What is the process of updating graphs in Titan? Presumably running a load script twice using the same graph will only add nodes/vertices to the existing one, so how would I go about generating a new graph with the same name every time I update my model, and have RexPro be able to reference it when running a query?
How easy would it be to extend the interface to allow an analyst to enter SQL queries into the front end, using RexPro to access the graph in a similar way to the one described?
Apologies for the long post, but if anyone could share their expertise that would be much appreciated!
For d3 visualization, you can use force directed graph. There are a few variations of them.
Relationship Graph
https://vida.io/documents/qZ5SJdRJfj3XmSXYJ
Force Layout Tree
https://vida.io/documents/sy7vzWW7BJEvKdZeL
If your network contains a large number of node and edges, you'll need to cluster data before visualizing. You can use tools like Gephi, NodeXL to perform clustering. Then use clustered data to build force directed visualization.
What is the process for assigning attributes to edges?
The process is the same as adding properties to vertices. Get an Edge instance then do:
Edge e = g.addEdge(v1,v2,'label')
e.setProperty('weight',0.1d)
As for:
What is the process of updating graphs in Titan? Presumably running a load script twice using the same graph will only add nodes/vertices to the existing one, so how would I go about generating a new graph with the same name every time I update my model, and have RexPro be able to reference it when running a query?
You don't want a reference to a BatchGraph after loading as it comes with limitations that will prevent you from querying. It sounds like you should just configure "yourgraph" in rexster.xml, when you load through your script, simply wrap your rexster.xml configured Graph in your code, and perform your load operations against it. When you want to query it, simply reference "yourgraph" instead of "bg".
conn = RexProConnection('localhost,8184,'yourgraph')
How easy would it be to extend the interface to allow an analyst to enter SQL queries into the front end, using RexPro to access the graph in a similar way to the one described?
It's hard to say if that's "easy" as that depends on factors outside of just the technology. I'll say that it's possible to to build an interface that accepts Gremlin queries (your wrote SQL, but I assume you meant Gremlin), passes them to Rexster and gets back an answer. What you do with that answer is up to you, but as far as Rexster's part plays into it, I don't see why that would be a problem.

how to present graph with query results in orientdb

I am newbie to orientdb.
I want to know how to show the node/edge graph in the figure with query results.
I search online for it, however, I still can not find clue.
Use the OrientDB studio:
start OrientDB as server
Connect to http://localhost:2480
Execute your query in the "query" tab
Get an item and click on "Graph" tab

Resources