This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Type: LinkedHashMap Value: {id=1, label=person, name=[marko], age=[29]} | |
Type: LinkedHashMap Value: {id=2, label=person, name=[vadas], age=[27]} | |
Type: LinkedHashMap Value: {id=3, label=software, name=[lop], lang=[java]} | |
Type: LinkedHashMap Value: {id=4, label=person, name=[josh], age=[32]} | |
Type: LinkedHashMap Value: {id=5, label=software, name=[ripple], lang=[java]} | |
Type: LinkedHashMap Value: {id=6, label=person, name=[peter], age=[35]} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
https://discord.com/events/838910279550238720/1264929259957518356 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package org.apache.tinkerpop.gremlin.util; | |
import org.apache.tinkerpop.gremlin.driver.remote.DriverRemoteConnection; | |
import org.apache.tinkerpop.gremlin.process.traversal.Traversal; | |
import org.apache.tinkerpop.gremlin.process.traversal.TraversalStrategy; | |
import org.apache.tinkerpop.gremlin.process.traversal.Traverser; | |
import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource; | |
import org.apache.tinkerpop.gremlin.process.traversal.step.Configuring; | |
import org.apache.tinkerpop.gremlin.process.traversal.step.map.FlatMapStep; | |
import org.apache.tinkerpop.gremlin.process.traversal.step.map.VertexStep; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
gremlin> g.V().hasLabel('person').order().by('name').store('x').by('age').project('name','running').by('name').by(select('x').mean(local)) | |
==>[name:josh,running:32.0] | |
==>[name:marko,running:30.5] | |
==>[name:peter,running:32.0] | |
==>[name:vadas,running:30.75] | |
gremlin> g.V().hasLabel('person').aggregate('results').profile('profile').cap('results','profile').next() | |
==>profile=Traversal Metrics | |
Step Count Traversers Time (ms) % Dur | |
============================================================================================================= |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
gremlin> g.V('1','2','3').aggregate('a').has(T.id,'1'). | |
repeat(out().where(P.without('a')).aggregate('a')).emit(). | |
select('a') | |
==>[v[1],v[2],v[3],v[4]] | |
==>[v[1],v[2],v[3],v[4],v[5]] | |
gremlin> g.V('1','2','3').aggregate('a').has(T.id,'1'). | |
repeat(out().where(P.without('a')).aggregate(global,'a')).emit(). | |
barrier(). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
g.mergeV([(T.label):'Dog', name:'Max']).option(onCreate, [alias: 'Maximus', city: 'Boston'], set) | |
// 3.7.2-SNAPSHOT | |
gremlin> g.mergeV([(T.label):'Dog', name:'Max']).option(onCreate, [alias: 'Maximus', city: 'Boston'], set) | |
==>v[0] | |
gremlin> g.V().valueMap() | |
==>[city:[Boston],name:[Max],alias:[Maximus]] | |
gremlin> g.V().properties() | |
==>vp[city->Boston] | |
==>vp[name->Max] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// * Improved performance of the application of `FilterRankingStrategy` for large traversals with deeply nested traversals by improving the cache operation. | |
g.V().as("n"). | |
where(__.or(__.select("n").hasLabel("software"), __.select("n").hasLabel("person"))). | |
select("n").by("name") | |
before | |
FilterRankingStrategy [O] [GraphStep(vertex,[])@[n], TraversalFilterStep([OrStep([[SelectOneStep(last,n,null), HasStep([~label.eq(software)])], [SelectOneStep(last,n,null), HasStep([~label.eq(person)])]])]), SelectOneStep(last,n,value(name))] | |
after |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
https://discord.com/channels/838910279550238720/1191149924256071853/1191149924256071853 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
gremlin> g = TinkerFactory.createModern().traversal() | |
==>graphtraversalsource[tinkergraph[vertices:6 edges:6], standard] | |
gremlin> g.V(). | |
......1> emit(__.loops().is(gte(1))). | |
......2> repeat(__.bothE().otherV()).times(2).as('x'). | |
......3> emit(__.loops().is(gte(1))). | |
......4> repeat(__.inE().outV()).times(2). | |
......5> bothE(). | |
......6> dedup().by(__.path()). | |
......7> otherV(). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
g.V('44').repeat(local(outE('route').sample(1).inV())).times(3).path().by('code').by('dist') |
NewerOlder