gremlin

Scala, gremlin-scala, HLists, Poly2, RightFold and a missing implicit Prepend

夙愿已清 提交于 2019-12-10 18:16:20
问题 So, I am trying to encapsulate a series of operations from gremlin-scala into an HList so I can do a RightFold over them (this would allow me to construct a gremlin query as data: specifically an HList of Operations ). Here is what I mean: usually you can make a call to gremlin-scala like so: import gremlin.scala._ import org.apache.tinkerpop.gremlin.tinkergraph.structure.TinkerFactory def graph = TinkerFactory.createModern.asScala graph.V.hasLabel("person").out("created").as("creations")

How to create custom classes in orientdb using Gremlin

有些话、适合烂在心里 提交于 2019-12-10 16:13:39
问题 I want the equivalant of this syntax in SQL: create class Person extends V in Gremlin 回答1: I'm not sure it is possible to manipulate OrientDB schema through Gremlin. Gremlin is independent on OrientDB and is not adapted on schemas because not all of graph databases support schemas. For adding vertex of particular class in OrientDB you can use Graph API (see doc). If you prepend string class: before the name of the class, you will create a vertex of this class. graph.addVertex("class:User");

Mysql vs Cypher vs Gremlin on union query

谁说胖子不能爱 提交于 2019-12-10 11:52:50
问题 I working on a project where I have to make real time recommandation based on filters. I decided to take a look on graph db and started to play with neo4j and compared it performance with mysql. rows are about : "broadcast": 159844, "format": 5, "genre": 10, "program": 60495 the mysql the query look like : select f.id, sum(weight) as total from ( select program.id, 15 as weight from broadcast inner join program on broadcast.programId = program.id where broadcast.startedAt > now() and

Tinkerpop 3: compute connected components with Gremlin traversal

荒凉一梦 提交于 2019-12-10 11:06:57
问题 I think the tags explain quite well my problem :) I've been trying to write a Gremlin traversal to compute the connected components of the simple graph described at the end of the post. I tried with g.V().repeat(both('e')).until(cyclicPath()).dedup().tree().by('name').next() obtaining ==>a={b={a={}, c={b={}}, d={c={d={}}}}, c={d={c={}}}} ==>e={f={e={}, g={f={}}}, h={f={h={}}}} ==>g={f={g={}}} which is bad, since the cyclicPath filter terminated the traversal starting from e before reaching g

Gremlin when storing a GremlinGroovyPipeline and calling .count() on it

好久不见. 提交于 2019-12-10 11:04:17
问题 This works as expected: gremlin> root.out.outE.has('size', 4).count() ==>3 gremlin> result = root.out.outE.has('size', 4).count() ==>3 gremlin> result ==>3 gremlin> root.out.outE.has('count', 4).getClass() ==>class com.tinkerpop.gremlin.groovy.GremlinGroovyPipeline When I store the GremlinGroovyPipeline into a variable, I can't count() it anymore: gremlin> result = root.out.outE.has('size', 4) ==>e[359:200:36028797018964014][200-sizes->40] ==>e[669:404:36028797018964014][404-sizes->400] ==>e

How to increase performance of shortest path using Gremlin?

痞子三分冷 提交于 2019-12-09 03:35:26
I'm using JanusGraph with Gremlin and this dataset cotaining 2.6k nodes and 6.6k edges (3.3k edges on both sides). I've run the query for 10 minutes without find the shortest path. Using Gephi the shortest path is almost instantaneous. Here's my query: g.V(687).repeat(out().simplePath()).until(hasId(1343)).path().limit(1) With simplePath() your query still processes a lot more paths than necessary. For example, if 688 is a direct neighbor of 687 , but also a neighbor of 1000 , which is 10 hops away on another path, why would you want to follow the path from 1000 to 688 , if you've already seen

Number of nodes/edges in a large graph via Gremlin?

这一生的挚爱 提交于 2019-12-08 16:05:20
问题 What is the easiest & most efficient way to count the number of nodes/edges in a large graph via Gremlin? The best I have found is using the V iterator: gremlin> g.V.gather{it.size()} However, this is not a viable option for large graphs, per the documentation for V: The vertex iterator for the graph. Utilize this to iterate through all the vertices in the graph. Use with care on large graphs unless used in combination with a key index lookup. 回答1: I think the preferred way to do a count of

RexProScriptException transaction is not open in Django with Titan (graph DB)

一个人想着一个人 提交于 2019-12-08 16:03:46
问题 I have stuck with my TitanDB, Django1.8 and Mogwai0.7.7 package. I have Graph database titan/cassandra on localhost dev machine, and after creating wrong queries in rexster gremlin web interface my Django Object Graph Mapper mogwai stopped to work. Titan is still working and data are present but Django stopped to work with it. File "/Users/x/envs/graph/lib/python2.7/site-packages/rexpro/connectors/base.py", line 281, in close_transaction raise exceptions.RexProScriptException("transaction is

Gremlin correlated queries kill performance

回眸只為那壹抹淺笑 提交于 2019-12-08 14:00:13
问题 I understand that implementation specifics factor into this question, but I also realize that I may be doing something wrong here. If so, what could I do better? If Gremlin has some multi-resultset submit queries batch feature I don't know about, that would solve the problem. As in, hey Gremlin, run these three queries in parallel and give me their results. Essentially, I need to know when a vertex has a certain edge and if it doesn't have that edge, I need to pull a blank. So... g.V().as("v"

Adding multiple vertices, changing one property-value (tinkerpop3 + python GLV)

守給你的承諾、 提交于 2019-12-08 12:03:46
问题 I'm trying to size down my code, but I need several instances of data of this type: g.addV('A').property('a-type','thing-x').property('a-value',1).next() g.addV('A').property('a-type','thing-x').property('a-value',2).next() ... g.addV('A').property('a-type','thing-x').property('a-value',n).next() Up to 'a-value' being n (for instance 50). # I tried a version of a loop I found here # https://stackoverflow.com/questions/40907529/create-multiple-edges-having-vertex-id-number-0-to-49 # g.inject(