tinkerpop

How to Perfrom Where Filter in Gremlin queries

戏子无情 提交于 2020-07-23 06:51:17
问题 where(​ and​ (​ choose(constant(0).is(1),​ select('WorkLocation'). is(within('Not Updated')),​ select('WorkLocation')),​ ​ choose(constant(1).is(1),​ select('Status'). is(within('Red', 'Orange')),​ select('Status')),​ ​ choose(constant(0).is(1),​ select('ConfirmationDate'). is(between(637281491635663900, 637258237221895200)),​ select('ConfirmationDate'))​ )​ ) In the Above Where condition Query, I have to do a filter on three fields WorkLocation, Status, ConfirmationDate, I have used choose

can we relate a property with other property of same vertex

我的未来我决定 提交于 2020-06-29 03:21:29
问题 A sample vertex g.addV('a').property('vehicle','v1').property('time',1000).property(list,'vehicle','v2').property(list,'time',830) how can we map the values in property 'vehicle' to the values in property 'time'. I tired the following code g.V(1).hasKey('vehicle').map(hasKey('time')) To find path I tired following code g.V().hasLabel('a').repeat(out().simplePath()).until(hasLabel('h')).path().by(union(label(),values('vehicle','time')).fold()) can you help me please 回答1: Changing the data

can we relate a property with other property of same vertex

孤人 提交于 2020-06-29 03:21:23
问题 A sample vertex g.addV('a').property('vehicle','v1').property('time',1000).property(list,'vehicle','v2').property(list,'time',830) how can we map the values in property 'vehicle' to the values in property 'time'. I tired the following code g.V(1).hasKey('vehicle').map(hasKey('time')) To find path I tired following code g.V().hasLabel('a').repeat(out().simplePath()).until(hasLabel('h')).path().by(union(label(),values('vehicle','time')).fold()) can you help me please 回答1: Changing the data

gremlin intersection operation

与世无争的帅哥 提交于 2020-06-28 05:16:17
问题 I'm using the gremlin console v3.3.1. Using the "Modern" graph from the tutorial: http://tinkerpop.apache.org/docs/current/tutorials/getting-started/ Creating the graph with this: gremlin>graph = TinkerFactory.createModern() gremlin>g = graph.traversal() I can find all the people that know "vadas" like this: g.V().hasLabel('person').has('name', 'vadas').in('knows').hasLabel('person').valueMap() And I can find all the people that created the software "lop" with this: g.V().hasLabel('software')

gremlin intersection operation

感情迁移 提交于 2020-06-28 05:16:09
问题 I'm using the gremlin console v3.3.1. Using the "Modern" graph from the tutorial: http://tinkerpop.apache.org/docs/current/tutorials/getting-started/ Creating the graph with this: gremlin>graph = TinkerFactory.createModern() gremlin>g = graph.traversal() I can find all the people that know "vadas" like this: g.V().hasLabel('person').has('name', 'vadas').in('knows').hasLabel('person').valueMap() And I can find all the people that created the software "lop" with this: g.V().hasLabel('software')

Displaying sub-levels in gremlin query

天涯浪子 提交于 2020-06-28 04:11:40
问题 I have the graph as shown in the figure below. The numbers represent the level format of the node which is required as output from the gremlin query along with the properties of the nodes. The graph structure can change that is more nodes can be added to the graph. The level must be returned in a similar format for additional nodes. For example, children of 1.1.1 should return the level as 1.1.1.1,1.1.1.2 ... The following query but the level is in continuous format 1,2,3 ... g.withSack(0). V

Displaying sub-levels in gremlin query

那年仲夏 提交于 2020-06-28 04:11:08
问题 I have the graph as shown in the figure below. The numbers represent the level format of the node which is required as output from the gremlin query along with the properties of the nodes. The graph structure can change that is more nodes can be added to the graph. The level must be returned in a similar format for additional nodes. For example, children of 1.1.1 should return the level as 1.1.1.1,1.1.1.2 ... The following query but the level is in continuous format 1,2,3 ... g.withSack(0). V

What is the equivalent of the gremlin queries in gremlin javascript?

妖精的绣舞 提交于 2020-05-30 08:23:46
问题 How can I write the 3 gremlin queries below with gremlin javascript, please? gremlin> g.V.filter{it.name.matches(".*ark.*")}.name g.V().filter({ it.getProperty("name").contains("ark") }) g.V().filter(label().is('person')) 回答1: filter() traversal method expects a predicate or a traversal. Predicates using lambdas are not yet supported on the JavaScript GLV, I've filed a ticket for it: https://issues.apache.org/jira/browse/TINKERPOP-2001 const gremlin = require('gremlin'); const __ = gremlin

What is the equivalent of the gremlin queries in gremlin javascript?

允我心安 提交于 2020-05-30 08:22:48
问题 How can I write the 3 gremlin queries below with gremlin javascript, please? gremlin> g.V.filter{it.name.matches(".*ark.*")}.name g.V().filter({ it.getProperty("name").contains("ark") }) g.V().filter(label().is('person')) 回答1: filter() traversal method expects a predicate or a traversal. Predicates using lambdas are not yet supported on the JavaScript GLV, I've filed a ticket for it: https://issues.apache.org/jira/browse/TINKERPOP-2001 const gremlin = require('gremlin'); const __ = gremlin

Java GraphTraversal output Gremlin query

拟墨画扇 提交于 2020-05-15 21:45:12
问题 How to output Gremlin query from a Java GraphTraversal object? The default output ( graphTraversal.toString() ) looks like [HasStep([~label.eq(brand), name.eq(Nike), status.within([VALID])])] which is not easy to read. 回答1: Gremlin provides the GroovyTranslator class to help with that. Here is an example. // Simple traversal we can use for testing a few things Traversal t = g.V().has("airport","region","US-TX"). local(values("code","city"). fold()); // Generate the text form of the query from