tinkerpop3

How to add property to vertex property in java?

非 Y 不嫁゛ 提交于 2019-12-10 20:18:37
问题 I want to add property to a vertex property. In gremlin i add property "phone" to vertex property "places" that has value is "place1" g.V(v).properties('places').hasValue('place1').property('phone',"123456789") It worked ok without using transaction commit. But when i used this way in java code, it not worked. So in java code, how to add a property to vertex property? Thank for your help. 回答1: You need to iterate() the traversal. g.V(v).properties('places').hasValue('place1').property('phone'

Gremlin find highest match

强颜欢笑 提交于 2019-12-10 19:36:59
问题 I am planning to use a Graph Database (AWS Neptune) that can be queried with Gremlin as a sort of Knowledge base. The KB would be used as a classification tool on with entities with multiple features. For simplicity, I am using geometric shapes to code the properties of my entities in this example. Let's suppose I want to classify Points that can be related to Squares, Triangles and Circles. I have blueprint the different possible relationships of Points with the possibles Squares, Triangles

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-Server Add Vertex with Multiple Properties (Titan 1.0.0)

那年仲夏 提交于 2019-12-07 10:21:55
问题 I'm creating a Titan graph (backed by Dynamodb); I'm using Titan 1.0.0 and running Gremlin-Server 3 (on TinkerPop3). I'm trying to add a vertex to my graph with a label and multiple properties in a single line. I'm able to add a vertex with a label and a single property, and I can add multiple properties to a vertex after it has been created, but it seems that I can't do it all at once. For testing I'm running commands in the gremlin shell, but the end use case is interacting with it via REST

Proper handling of date operations in Gremlin

丶灬走出姿态 提交于 2019-12-07 08:42:39
问题 I am using AWS Neptune Gremlin with gremlin_python . My date in property is stored as datetime as required in Neptune specs. I created it using Python code like this: properties_dict['my_date'] = datetime.fromtimestamp(my_date, timezone.utc) and then constructed the Vertex with properties: for prop in properties: query += """.property("%s", "%s")"""%(prop, properties[prop]) Later when interacting with the constructed graph, I am only able to find the vertices by an exact string matching query

Tinkerpop 3: compute connected components with Gremlin traversal

元气小坏坏 提交于 2019-12-06 13:39:09
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 . Obviously, if I remove the until clause I get an infinite loop. Moreover, if I use simplePath the

Gremlin-Server Add Vertex with Multiple Properties (Titan 1.0.0)

六眼飞鱼酱① 提交于 2019-12-05 15:34:54
I'm creating a Titan graph (backed by Dynamodb); I'm using Titan 1.0.0 and running Gremlin-Server 3 (on TinkerPop3). I'm trying to add a vertex to my graph with a label and multiple properties in a single line. I'm able to add a vertex with a label and a single property, and I can add multiple properties to a vertex after it has been created, but it seems that I can't do it all at once. For testing I'm running commands in the gremlin shell, but the end use case is interacting with it via REST api (which is already working fine). As a note, I'm rolling back after each of these transactions so I

How to get a subgraph consisting of all vertices, that satisfy specific condition

蓝咒 提交于 2019-12-04 16:53:49
The Document and the Revision are two objects that reside in our domain logic specific layer. The Document represents an abstraction around any material piece of paper that you could think of. That is - every contract, invoice or drawing could be called a Document . On the other hand, the material representation of the Document is the Revision : the list of paper, that construction engineer receives on site, represents a Revision of the Document that designer has created. If something in a drawing has to be changed, due to an error or changed requirements, then a new revision will show up on

TinkerPop: Adding Vertex Graph API v/s Traversal API

旧城冷巷雨未停 提交于 2019-12-04 01:40:59
问题 Background : In one of the SO posts it is recommended to use Traversal API than Graph API to make mutation. So I tried out some tests and found Graph API seemed to be faster, I do totally believe the advice but I am trying to understand how its better. I did try googling but did not find a similar post Testing : Query 1 : Executed in 0.19734525680541992 seconds g.addV('Test').property('title1', 'abc').property('title2', 'abc') Query 2 : Executed in 0.13838958740234375 seconds graph.addVertex