Closed amcp closed 7 years ago
Preparation:
git clone git@github.com:awslabs/dynamodb-titan-storage-backend.git
git checkout 1.0.0
cp src/test/resources/dynamodb.properties .
Remove elastic search config from properties file
mv dynamodb.properties titan.properties
Upload titan.properties to a s3 bucket I control and note the s3 URL
Launch the cloud formation template in us-east-1
ssh -o ServerAliveInterval=50 -i ${HOME}/.ec2/********.pem ec2-user@ec2-###-###-###-###.compute-1.amazonaws.com
cd /usr/local/packages/dynamodb-titan100-storage-backend-1.0.0-hadoop1
dynamodb-titan100-storage-backend-1.0.0-hadoop1]$ bin/gremlin.sh
May 03, 2017 11:51:38 AM java.util.prefs.FileSystemPreferences$1 run
INFO: Created user preferences directory.
\,,,/
(o o)
-----oOOo-(3)-oOOo-----
plugin activated: aurelius.titan
plugin activated: tinkerpop.server
plugin activated: tinkerpop.utilities
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/usr/local/packages/dynamodb-titan100-storage-backend-1.0.0-hadoop1/lib/slf4j-log4j12-1.7.5.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/usr/local/packages/dynamodb-titan100-storage-backend-1.0.0-hadoop1/lib/logback-classic-1.1.2.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/usr/local/packages/dynamodb-titan100-storage-backend-1.0.0-hadoop1/ext/dynamodb-titan100-storage-backend/slf4j-log4j12-1.7.5.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [org.slf4j.impl.Log4jLoggerFactory]
11:51:49 INFO org.apache.tinkerpop.gremlin.hadoop.structure.HadoopGraph - HADOOP_GREMLIN_LIBS is set to: /usr/local/packages/dynamodb-titan100-storage-backend-1.0.0-hadoop1/lib
plugin activated: tinkerpop.hadoop
plugin activated: tinkerpop.tinkergraph
In the Gremlin shell:
gremlin> :remote connect tinkerpop.server conf/remote.yaml
==>Connected - localhost/127.0.0.1:8182
gremlin> :> com.amazon.titan.example.MarvelGraphFactory.load(graph, 100, false)
==>null
In the Gremlin shell:
gremlin> :> g.V().has('weapon', within('shield','claws')).as('weapon', 'character', 'book').select('weapon', 'character','book').by('weapon').by('character').by(__.out('appeared').values('comic-book'))
==>{weapon=claws, character=DR. STRANGE, book=COC 1}
==>{weapon=claws, character=ROSS, GEN. THADDEUS , book=H2 252}
==>{weapon=claws, character=MOCKINGBIRD, book=COC 1}
==>{weapon=shield, character=DR. LEONA, book=H2 252}
==>{weapon=shield, character=PROFESSOR X, book=COC 1}
==>{weapon=shield, character=TONY STARK , book=COC 1}
==>{weapon=claws, character=G'RATH, book=AA2 35}
==>{weapon=claws, character=HUMAN ROBOT, book=WI? 9}
==>{weapon=claws, character=SHROUD, book=COC 1}
==>{weapon=shield, character=CRIMSON DYNAMO V, book=COC 1}
==>{weapon=shield, character=CRYSTAL [INHUMAN], book=COC 1}
==>{weapon=claws, character=3-D MAN, book=M/PRM 36}
==>{weapon=claws, character=SYLVIA, book=COC 1}
==>{weapon=shield, character=T'CHAL, book=COC 1}
==>{weapon=shield, character=TORPEDO III, book=COC 1}
==>{weapon=shield, character=IKE HARRIS [E, book=COC 1}
==>{weapon=shield, character=QUASAR III, book=COC 1}
==>{weapon=shield, character=SHADOWCAT, book=COC 1}
==>{weapon=shield, character=NATASHA , book=COC 1}
==>{weapon=shield, character=ANGEL, book=COC 1}
==>{weapon=shield, character=RUTH BAT-SERAP, book=COC 1}
==>{weapon=claws, character=LIBRA, book=AVF 4}
==>{weapon=claws, character=WARREN KENNETH, book=COC 1}
==>{weapon=shield, character=ROBER, book=WI? 9}
==>{weapon=shield, character=QUICKSILVER, book=COC 1}
==>{weapon=shield, character=DARKSTAR, book=COC 1}
==>{weapon=shield, character=CAPTAIN AMERICA, book=AVF 4}
==>{weapon=shield, character=BLACK WIDOW, book=COC 1}
==>{weapon=shield, character=BROCK JO, book=COC 1}
gremlin> :> g.V().has('weapon').has('weapon', without('shield','claws')).as('weapon', 'character', 'book').select('weapon', 'character','book').by('weapon').by('character').by(__.out('appeared').values('comic-book'))
==>{weapon=cards, character=DRUMM, JERICHO, book=COC 1}
==>{weapon=gun, character=INVISIBLE WOMAN, book=COC 1}
==>{weapon=swords, character=IKARIS, book=COC 1}
==>{weapon=surf board, character=WASP, book=AVF 4}
==>{weapon=lasso, character=SABRA, book=COC 1}
==>{weapon=swords, character=DR. ROBERT BRUC, book=H2 252}
==>{weapon=robotic suit, character=STEPHEN , book=COC 1}
==>{weapon=gun, character=HELLSTORM, book=COC 1}
==>{weapon=swords, character=EN DWI G, book=COC 1}
==>{weapon=swords, character=WANDA , book=COC 1}
==>{weapon=ring, character=ROBERT L. FR, book=COC 1}
==>{weapon=gun, character=JANET VAN DYNE , book=AVF 4}
==>{weapon=cards, character=FROST, CARMILLA, book=AA2 35}
==>{weapon=lasso, character=MAXIMILLIAN Q, book=COC 1}
==>{weapon=glider, character=HULK, book=H2 252}
==>{weapon=ring, character=M'SHULLA, book=AA2 35}
==>{weapon=glider, character=JENNIFER WA, book=COC 1}
==>{weapon=ring, character=PIETRO M, book=COC 1}
==>{weapon=swords, character=WALTER LAN, book=COC 1}
==>{weapon=ring, character=MIKHLO, book=COC 1}
==>{weapon=glider, character=SERSI, book=COC 1}
==>{weapon=robotic suit, character=GRANDMASTER, book=COC 1}
==>{weapon=glider, character=JONATHAN R, book=AA2 35}
==>{weapon=robotic suit, character=ANT-MAN, book=AVF 4}
==>{weapon=ring, character=SHE-HULK, book=COC 1}
==>{weapon=gun, character=NORRISS, SISTER BARB, book=COC 1}
==>{weapon=robotic suit, character=SCOTT SUMMER, book=COC 1}
==>{weapon=ring, character=JEANNE-MARIE , book=COC 1}
==>{weapon=ring, character=AURORA, book=COC 1}
==>{weapon=lasso, character=HELLCAT, book=COC 1}
==>{weapon=cards, character=CHARLES , book=COC 1}
==>{weapon=glider, character=JACK OF HEARTS, book=COC 1}
==>{weapon=swords, character=OLD SKULL, book=AA2 35}
==>{weapon=surf board, character=SLOAN, FRED, book=H2 252}
==>{weapon=robotic suit, character=IGOR, book=COC 1}
==>{weapon=robotic suit, character=PATSY WALKER, book=COC 1}
==>{weapon=cards, character=EMMANUEL, book=AA2 35}
==>{weapon=ring, character=ALEX SUMMERS , book=COC 1}
==>{weapon=robotic suit, character=SUE , book=COC 1}
==>{weapon=glider, character=GORILLA-MAN, book=WI? 9}
==>{weapon=lasso, character=SCARLET WITCH, book=COC 1}
==>{weapon=robotic suit, character=BLACK PANTHER, book=COC 1}
==>{weapon=surf board, character=DOC SAMSON, book=H2 252}
==>{weapon=ring, character=LAYNIA SERG, book=COC 1}
==>{weapon=surf board, character=GUSTAV BRANDT, book=AVF 4}
==>{weapon=ring, character=SCOTT HAR, book=COC 1}
==>{weapon=glider, character=WOODGOD, book=H2 252}
==>{weapon=lasso, character=KATHERINE , book=COC 1}
==>{weapon=gun, character=MIKHAIL U, book=COC 1}
==>{weapon=robotic suit, character=BANNER, BETTY ROSS T, book=H2 252}
==>{weapon=ring, character=DIM, book=COC 1}
==>{weapon=cards, character=URSA MAJOR, book=COC 1}
==>{weapon=gun, character=DEFENSOR, book=COC 1}
==>{weapon=robotic suit, character=CARL LUCA, book=COC 1}
==>{weapon=surf board, character=DR. BARB, book=COC 1}
==>{weapon=gun, character=KARNAK [INHUMAN], book=COC 1}
==>{weapon=cards, character=LOBO, book=COC 1}
==>{weapon=ring, character=WENDELL V, book=COC 1}
==>{weapon=glider, character=JONES, RICHARD MILHO, book=H2 252}
==>{weapon=glider, character=ANT-MAN II, book=COC 1}
==>{weapon=glider, character=KILLRAVEN, book=AA2 35}
==>{weapon=swords, character=ANTHONY LU, book=COC 1}
==>{weapon=lasso, character=CHARLES CHAN, book=M/PRM 36}
==>{weapon=swords, character=CYCLOPS, book=COC 1}
==>{weapon=ring, character=GYPSY MOTH, book=COC 1}
==>{weapon=ring, character=DR. DRUID, book=COC 1}
==>{weapon=lasso, character=DAIMON HEL, book=COC 1}
==>{weapon=gun, character=JACK , book=COC 1}
==>{weapon=lasso, character=24-HOUR MAN, book=AA2 35}
==>{weapon=cards, character=PHARAOH RAMA-TUT, book=AVF 5}
==>{weapon=swords, character=BENJAMIN J. GR, book=COC 1}
==>{weapon=swords, character=HAVOK, book=COC 1}
==>{weapon=ring, character=IRON MAN, book=COC 1}
==>{weapon=lasso, character=VENUS II, book=WI? 9}
==>{weapon=ring, character=THING, book=COC 1}
==>{weapon=robotic suit, character=DR. HENRY J., book=AVF 4}
==>{weapon=gun, character=CAGE, LUKE, book=COC 1}
==>{weapon=cards, character=LOCKJAW [INHUMAN], book=COC 1}
==>{weapon=cards, character=COLLECTIVE MAN, book=COC 1}
==>{weapon=lasso, character=SASQUATCH, book=COC 1}
==>{weapon=cards, character=MARVEL BOY III, book=WI? 9}
==>{weapon=gun, character=WHIZZER, book=COC 1}
==>{weapon=cards, character=HAWK, book=AVF 4}
gremlin> :> g.V().has('comic-book', 'AVF 4').in('appeared').values('character').order()
==>3-D MAN
==>ANT-MAN
==>CAPTAIN AMERICA
==>CHARLES CHAN
==>DR. HENRY J.
==>GORILLA-MAN
==>GUSTAV BRANDT
==>HAWK
==>HUMAN ROBOT
==>JANET VAN DYNE
==>JONES, RICHARD MILHO
==>LIBRA
==>MARVEL BOY III
==>ROBER
==>VENUS II
==>WASP
gremlin> :> g.V().has('comic-book', 'AVF 4').in('appeared').has('weapon', without('shield','claws')).values('character').order()
==>ANT-MAN
==>CHARLES CHAN
==>DR. HENRY J.
==>GORILLA-MAN
==>GUSTAV BRANDT
==>HAWK
==>JANET VAN DYNE
==>JONES, RICHARD MILHO
==>MARVEL BOY III
==>VENUS II
==>WASP
Control-C to exit
Verify the DynamoDB tables:
dynamodb-titan100-storage-backend-1.0.0-hadoop1]$ aws dynamodb --region us-east-1 list-tables
{
"TableNames": [
"v100_edgestore",
"v100_graphindex",
"v100_system_properties",
"v100_systemlog",
"v100_titan_ids",
"v100_txlog"
]
}
Connect to Gremlin console on JanusGraph:
$ ssh -o ServerAliveInterval=50 -t -i ${HOME}/.ec2/********.pem ec2-user@ec2-###-###-###-###.compute-1.amazonaws.com /usr/local/packages/dynamodb-janusgraph010-storage-backend-1.0.0/bin/gremlin.sh
May 03, 2017 4:15:37 PM java.util.prefs.FileSystemPreferences$1 run
INFO: Created user preferences directory.
\,,,/
(o o)
-----oOOo-(3)-oOOo-----
plugin activated: janusgraph.imports
plugin activated: tinkerpop.server
plugin activated: tinkerpop.utilities
16:15:42 WARN org.apache.hadoop.util.NativeCodeLoader - Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
plugin activated: tinkerpop.hadoop
plugin activated: tinkerpop.spark
plugin activated: tinkerpop.tinkergraph
Read the Marvel stuff:
gremlin> :remote connect tinkerpop.server conf/remote.yaml session
==>Configured localhost/127.0.0.1:8182-[8a4c2fe9-b149-43e5-a67e-8cf817198cbc]
gremlin> :remote console
==>All scripts will now be sent to Gremlin Server - [localhost/127.0.0.1:8182]-[8a4c2fe9-b149-43e5-a67e-8cf817198cbc] - type ':remote console' to return to local mode
gremlin> g.V().has('weapon', within('shield','claws')).as('weapon', 'character', 'book').select('weapon', 'character','book').by('weapon').by('character').by(__.out('appeared').values('comic-book'))
==>{weapon=claws, character=DR. STRANGE, book=COC 1}
==>{weapon=claws, character=ROSS, GEN. THADDEUS , book=H2 252}
==>{weapon=claws, character=MOCKINGBIRD, book=COC 1}
==>{weapon=shield, character=DR. LEONA, book=H2 252}
==>{weapon=shield, character=PROFESSOR X, book=COC 1}
==>{weapon=shield, character=TONY STARK , book=COC 1}
==>{weapon=claws, character=G'RATH, book=AA2 35}
==>{weapon=claws, character=HUMAN ROBOT, book=WI? 9}
==>{weapon=claws, character=SHROUD, book=COC 1}
==>{weapon=shield, character=CRIMSON DYNAMO V, book=COC 1}
==>{weapon=shield, character=CRYSTAL [INHUMAN], book=COC 1}
==>{weapon=claws, character=3-D MAN, book=M/PRM 36}
==>{weapon=claws, character=SYLVIA, book=COC 1}
==>{weapon=shield, character=T'CHAL, book=COC 1}
==>{weapon=shield, character=TORPEDO III, book=COC 1}
==>{weapon=shield, character=IKE HARRIS [E, book=COC 1}
==>{weapon=shield, character=QUASAR III, book=COC 1}
==>{weapon=shield, character=SHADOWCAT, book=COC 1}
==>{weapon=shield, character=NATASHA , book=COC 1}
==>{weapon=shield, character=ANGEL, book=COC 1}
==>{weapon=shield, character=RUTH BAT-SERAP, book=COC 1}
==>{weapon=claws, character=LIBRA, book=AVF 4}
==>{weapon=claws, character=WARREN KENNETH, book=COC 1}
==>{weapon=shield, character=ROBER, book=WI? 9}
==>{weapon=shield, character=QUICKSILVER, book=COC 1}
==>{weapon=shield, character=DARKSTAR, book=COC 1}
==>{weapon=shield, character=CAPTAIN AMERICA, book=AVF 4}
==>{weapon=shield, character=BLACK WIDOW, book=COC 1}
==>{weapon=shield, character=BROCK JO, book=COC 1}
gremlin> g.V().has('weapon').has('weapon', without('shield','claws')).as('weapon', 'character', 'book').select('weapon', 'character','book').by('weapon').by('character').by(__.out('appeared').values('comic-book'))
==>{weapon=cards, character=DRUMM, JERICHO, book=COC 1}
==>{weapon=gun, character=INVISIBLE WOMAN, book=COC 1}
==>{weapon=swords, character=IKARIS, book=COC 1}
==>{weapon=surf board, character=WASP, book=AVF 4}
==>{weapon=lasso, character=SABRA, book=COC 1}
==>{weapon=swords, character=DR. ROBERT BRUC, book=H2 252}
==>{weapon=robotic suit, character=STEPHEN , book=COC 1}
==>{weapon=gun, character=HELLSTORM, book=COC 1}
==>{weapon=swords, character=EN DWI G, book=COC 1}
==>{weapon=swords, character=WANDA , book=COC 1}
==>{weapon=ring, character=ROBERT L. FR, book=COC 1}
==>{weapon=gun, character=JANET VAN DYNE , book=AVF 4}
==>{weapon=cards, character=FROST, CARMILLA, book=AA2 35}
==>{weapon=lasso, character=MAXIMILLIAN Q, book=COC 1}
==>{weapon=glider, character=HULK, book=H2 252}
==>{weapon=ring, character=M'SHULLA, book=AA2 35}
==>{weapon=glider, character=JENNIFER WA, book=COC 1}
==>{weapon=ring, character=PIETRO M, book=COC 1}
==>{weapon=swords, character=WALTER LAN, book=COC 1}
==>{weapon=ring, character=MIKHLO, book=COC 1}
==>{weapon=glider, character=SERSI, book=COC 1}
==>{weapon=robotic suit, character=GRANDMASTER, book=COC 1}
==>{weapon=glider, character=JONATHAN R, book=AA2 35}
==>{weapon=robotic suit, character=ANT-MAN, book=AVF 4}
==>{weapon=ring, character=SHE-HULK, book=COC 1}
==>{weapon=gun, character=NORRISS, SISTER BARB, book=COC 1}
==>{weapon=robotic suit, character=SCOTT SUMMER, book=COC 1}
==>{weapon=ring, character=JEANNE-MARIE , book=COC 1}
==>{weapon=ring, character=AURORA, book=COC 1}
==>{weapon=lasso, character=HELLCAT, book=COC 1}
==>{weapon=cards, character=CHARLES , book=COC 1}
==>{weapon=glider, character=JACK OF HEARTS, book=COC 1}
==>{weapon=swords, character=OLD SKULL, book=AA2 35}
==>{weapon=surf board, character=SLOAN, FRED, book=H2 252}
==>{weapon=robotic suit, character=IGOR, book=COC 1}
==>{weapon=robotic suit, character=PATSY WALKER, book=COC 1}
==>{weapon=cards, character=EMMANUEL, book=AA2 35}
==>{weapon=ring, character=ALEX SUMMERS , book=COC 1}
==>{weapon=robotic suit, character=SUE , book=COC 1}
==>{weapon=glider, character=GORILLA-MAN, book=WI? 9}
==>{weapon=lasso, character=SCARLET WITCH, book=COC 1}
==>{weapon=robotic suit, character=BLACK PANTHER, book=COC 1}
==>{weapon=surf board, character=DOC SAMSON, book=H2 252}
==>{weapon=ring, character=LAYNIA SERG, book=COC 1}
==>{weapon=surf board, character=GUSTAV BRANDT, book=AVF 4}
==>{weapon=ring, character=SCOTT HAR, book=COC 1}
==>{weapon=glider, character=WOODGOD, book=H2 252}
==>{weapon=lasso, character=KATHERINE , book=COC 1}
==>{weapon=gun, character=MIKHAIL U, book=COC 1}
==>{weapon=robotic suit, character=BANNER, BETTY ROSS T, book=H2 252}
==>{weapon=ring, character=DIM, book=COC 1}
==>{weapon=cards, character=URSA MAJOR, book=COC 1}
==>{weapon=gun, character=DEFENSOR, book=COC 1}
==>{weapon=robotic suit, character=CARL LUCA, book=COC 1}
==>{weapon=surf board, character=DR. BARB, book=COC 1}
==>{weapon=gun, character=KARNAK [INHUMAN], book=COC 1}
==>{weapon=cards, character=LOBO, book=COC 1}
==>{weapon=ring, character=WENDELL V, book=COC 1}
==>{weapon=glider, character=JONES, RICHARD MILHO, book=H2 252}
==>{weapon=glider, character=ANT-MAN II, book=COC 1}
==>{weapon=glider, character=KILLRAVEN, book=AA2 35}
==>{weapon=swords, character=ANTHONY LU, book=COC 1}
==>{weapon=lasso, character=CHARLES CHAN, book=M/PRM 36}
==>{weapon=swords, character=CYCLOPS, book=COC 1}
==>{weapon=ring, character=GYPSY MOTH, book=COC 1}
==>{weapon=ring, character=DR. DRUID, book=COC 1}
==>{weapon=lasso, character=DAIMON HEL, book=COC 1}
==>{weapon=gun, character=JACK , book=COC 1}
==>{weapon=lasso, character=24-HOUR MAN, book=AA2 35}
==>{weapon=cards, character=PHARAOH RAMA-TUT, book=AVF 5}
==>{weapon=swords, character=BENJAMIN J. GR, book=COC 1}
==>{weapon=swords, character=HAVOK, book=COC 1}
==>{weapon=ring, character=IRON MAN, book=COC 1}
==>{weapon=lasso, character=VENUS II, book=WI? 9}
==>{weapon=ring, character=THING, book=COC 1}
==>{weapon=robotic suit, character=DR. HENRY J., book=AVF 4}
==>{weapon=gun, character=CAGE, LUKE, book=COC 1}
==>{weapon=cards, character=LOCKJAW [INHUMAN], book=COC 1}
==>{weapon=cards, character=COLLECTIVE MAN, book=COC 1}
==>{weapon=lasso, character=SASQUATCH, book=COC 1}
==>{weapon=cards, character=MARVEL BOY III, book=WI? 9}
==>{weapon=gun, character=WHIZZER, book=COC 1}
==>{weapon=cards, character=HAWK, book=AVF 4}
gremlin> g.V().has('comic-book', 'AVF 4').in('appeared').values('character').order()
==>3-D MAN
==>ANT-MAN
==>CAPTAIN AMERICA
==>CHARLES CHAN
==>DR. HENRY J.
==>GORILLA-MAN
==>GUSTAV BRANDT
==>HAWK
==>HUMAN ROBOT
==>JANET VAN DYNE
==>JONES, RICHARD MILHO
==>LIBRA
==>MARVEL BOY III
==>ROBER
==>VENUS II
==>WASP
gremlin> g.V().has('comic-book', 'AVF 4').in('appeared').has('weapon', without('shield','claws')).values('character').order()
==>ANT-MAN
==>CHARLES CHAN
==>DR. HENRY J.
==>GORILLA-MAN
==>GUSTAV BRANDT
==>HAWK
==>JANET VAN DYNE
==>JONES, RICHARD MILHO
==>MARVEL BOY III
==>VENUS II
==>WASP
Write graph of gods on JanusGraph
gremlin> GraphOfTheGodsFactory.loadWithoutMixedIndex(graph, true)
==>null
Read graph of gods on JanusGraph
gremlin> saturn = g.V().has('name', 'saturn').next()
==>v[4256]
gremlin> g.V(saturn).valueMap()
==>{name=[saturn], age=[10000]}
gremlin> g.V(saturn).in('father').in('father').values('name')
==>hercules
gremlin> g.E().has('place', geoWithin(Geoshape.circle(37.97, 23.72, 50)))
==>e[6rv9r3-6rv8qg-2exh-6ds][409604344-battled->8272]
==>e[6rv9cv-6rv8qg-2exh-6rvbu8][409604344-battled->409608368]
gremlin> g.E().has('place', geoWithin(Geoshape.circle(37.97, 23.72, 50))).as('source').inV().as('god2').select('source').outV().as('god1').select('god1', 'god2').by('name')
==>{god1=hercules, god2=hydra}
==>{god1=hercules, god2=nemean}
gremlin> hercules = g.V(saturn).repeat(__.in('father')).times(2).next()
==>v[409604344]
gremlin> g.V(hercules).out('father', 'mother')
==>v[8288]
==>v[4176]
gremlin> g.V(hercules).out('father', 'mother').values('name')
==>jupiter
==>alcmene
gremlin> g.V(hercules).out('father', 'mother').label()
==>god
==>human
gremlin> hercules.label()
==>demigod
gremlin> g.V(hercules).out('battled')
==>v[8272]
==>v[409608368]
==>v[409612464]
gremlin> g.V(hercules).out('battled').valueMap()
==>{name=[hydra]}
==>{name=[nemean]}
==>{name=[cerberus]}
gremlin> g.V(hercules).outE('battled').has('time', gt(1)).inV().values('name')
==>cerberus
==>hydra
gremlin> g.V(hercules).outE('battled').has('time', gt(1)).inV().values('name').toString()
==>[GraphStep(vertex,[v[409604344]]), VertexStep(OUT,[battled],edge), HasStep([time.gt(1)]), EdgeVertexStep(IN), PropertiesStep([name],value)]
gremlin> pluto = g.V().has('name', 'pluto').next()
==>v[12384]
gremlin> g.V(pluto).out('lives').in('lives').values('name')
==>pluto
==>cerberus
gremlin> g.V(pluto).out('lives').in('lives').where(is(neq(pluto))).values('name')
==>cerberus
gremlin> g.V(pluto).as('x').out('lives').in('lives').where(neq('x')).values('name')
==>cerberus
gremlin> g.V(pluto).out('brother').out('lives').values('name')
==>sea
==>sky
gremlin> g.V(pluto).out('brother').as('god').out('lives').as('place').select('god', 'place')
==>{god=v[4264], place=v[4192]}
==>{god=v[8288], place=v[409604272]}
gremlin> g.V(pluto).out('brother').as('god').out('lives').as('place').select('god', 'place').by('name')
==>{god=neptune, place=sea}
==>{god=jupiter, place=sky}
gremlin> g.V(pluto).outE('lives').values('reason')
==>no fear of death
gremlin> g.E().has('reason', textContains('loves'))
==>e[1zp-3ag-2gid-38g][4264-lives->4192]
==>e[558-6e8-2gid-6rv8og][8288-lives->409604272]
gremlin> g.E().has('reason', textContains('loves')).as('source').values('reason').as('reason').select('source').outV().values('name').as('god').select('source').inV().values('name').as('thing').select('god', 'reason', 'thing')
==>{god=neptune, reason=loves waves, thing=sea}
==>{god=jupiter, reason=loves fresh breezes, thing=sky}
gremlin> :remote console
==>All scripts will now be evaluated locally - type ':remote console' to return to remote mode for Gremlin Server - [localhost/127.0.0.1:8182]-[8a4c2fe9-b149-43e5-a67e-8cf817198cbc]
After connecting to Titan instance
$ bin/gremlin.sh
\,,,/
(o o)
-----oOOo-(3)-oOOo-----
plugin activated: aurelius.titan
plugin activated: tinkerpop.server
plugin activated: tinkerpop.utilities
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/usr/local/packages/dynamodb-titan100-storage-backend-1.0.0-hadoop1/lib/slf4j-log4j12-1.7.5.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/usr/local/packages/dynamodb-titan100-storage-backend-1.0.0-hadoop1/lib/logback-classic-1.1.2.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/usr/local/packages/dynamodb-titan100-storage-backend-1.0.0-hadoop1/ext/dynamodb-titan100-storage-backend/slf4j-log4j12-1.7.5.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [org.slf4j.impl.Log4jLoggerFactory]
16:28:29 INFO org.apache.tinkerpop.gremlin.hadoop.structure.HadoopGraph - HADOOP_GREMLIN_LIBS is set to: /usr/local/packages/dynamodb-titan100-storage-backend-1.0.0-hadoop1/lib
plugin activated: tinkerpop.hadoop
plugin activated: tinkerpop.tinkergraph
Reading Graph of the Goods in Titan after it was written by JanusGraph:
gremlin> :remote connect tinkerpop.server conf/remote.yaml
==>Connected - localhost/127.0.0.1:8182
gremlin> :> g.V().has('name', 'saturn').next()
==>v[4256]
gremlin> :> g.V().has('name', 'saturn').valueMap()
==>{name=[saturn], age=[10000]}
gremlin> :> g.V().has('name', 'saturn').in('father').in('father').values('name')
==>hercules
gremlin> :> g.E().has('place', geoWithin(Geoshape.circle(37.97, 23.72, 50)))
==>e[6rv9r3-6rv8qg-2exh-6ds][409604344-battled->8272]
==>e[6rv9cv-6rv8qg-2exh-6rvbu8][409604344-battled->409608368]
gremlin> :> g.E().has('place', geoWithin(Geoshape.circle(37.97, 23.72, 50))).as('source').inV().as('god2').select('source').outV().as('god1').select('god1', 'god2').by('name')
==>{god1=hercules, god2=hydra}
==>{god1=hercules, god2=nemean}
gremlin> :> saturn = g.V().has('name', 'saturn').next(); hercules = g.V(saturn).repeat(__.in('father')).times(2).next(); g.V(hercules).out('father', 'mother')
==>v[8288]
==>v[4176]
gremlin> :> saturn = g.V().has('name', 'saturn').next(); hercules = g.V(saturn).repeat(__.in('father')).times(2).next(); g.V(hercules).out('father', 'mother').values('name')
==>jupiter
==>alcmene
gremlin> :> saturn = g.V().has('name', 'saturn').next(); hercules = g.V(saturn).repeat(__.in('father')).times(2).next(); g.V(hercules).out('father', 'mother').label()
==>god
==>human
gremlin> :> saturn = g.V().has('name', 'saturn').next(); hercules = g.V(saturn).repeat(__.in('father')).times(2).next(); hercules.label()
==>demigod
gremlin> :> saturn = g.V().has('name', 'saturn').next(); hercules = g.V(saturn).repeat(__.in('father')).times(2).next(); g.V(hercules).out('battled')
==>v[8272]
==>v[409608368]
==>v[409612464]
gremlin> :> saturn = g.V().has('name', 'saturn').next(); hercules = g.V(saturn).repeat(__.in('father')).times(2).next(); g.V(hercules).out('battled').valueMap()
==>{name=[hydra]}
==>{name=[nemean]}
==>{name=[cerberus]}
gremlin> :> saturn = g.V().has('name', 'saturn').next(); hercules = g.V(saturn).repeat(__.in('father')).times(2).next(); g.V(hercules).outE('battled').has('time', gt(1)).inV().values('name')
==>cerberus
==>hydra
gremlin> :> saturn = g.V().has('name', 'saturn').next(); hercules = g.V(saturn).repeat(__.in('father')).times(2).next(); g.V(hercules).outE('battled').has('time', gt(1)).inV().values('name').toString()
==>[GraphStep([v[409604344]],vertex), VertexStep(OUT,[battled],edge), HasStep([time.gt(1)]), EdgeVertexStep(IN), PropertiesStep([name],value)]
gremlin> :> pluto = g.V().has('name', 'pluto').next()
==>v[12384]
gremlin> :> pluto = g.V().has('name', 'pluto').next(); g.V(pluto).out('lives').in('lives').values('name')
==>pluto
==>cerberus
gremlin> :> pluto = g.V().has('name', 'pluto').next(); g.V(pluto).out('lives').in('lives').where(is(neq(pluto))).values('name')
==>cerberus
gremlin> :> pluto = g.V().has('name', 'pluto').next(); g.V(pluto).as('x').out('lives').in('lives').where(neq('x')).values('name')
==>cerberus
gremlin> :> pluto = g.V().has('name', 'pluto').next(); g.V(pluto).out('brother').out('lives').values('name')
==>sea
==>sky
gremlin> :> pluto = g.V().has('name', 'pluto').next(); g.V(pluto).out('brother').as('god').out('lives').as('place').select()
Could not find which method select() to invoke from this list:
public org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal#select(java.lang.String)
public org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal#select(org.apache.tinkerpop.gremlin.process.traversal.Pop, java.lang.String)
public transient org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal#select(java.lang.String, java.lang.String, [Ljava.lang.String;)
public transient org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal#select(org.apache.tinkerpop.gremlin.prNcess.traversal.Pop, java.lang.String, java.lang.String, [Ljava.lang.String;)
gremlin> tack trace? [yN] [A
gremlin> :> pluto = g.V().has('name', 'pluto').next(); g.V(pluto).out('brother').as('god').out('lives').as('place').select().by('name')
Could not find which method select() to invoke from this list:
public org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal#select(java.lang.String)
public org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal#select(org.apache.tinkerpop.gremlin.process.traversal.Pop, java.lang.String)
public transient org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal#select(java.lang.String, java.lang.String, [Ljava.lang.String;)
public transient org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal#select(org.apache.tinkerpop.gremlin.process.traversal.Pop, java.lang.String, java.lang.String, [Ljava.lang.String;)
Display stack trace? [yN] N
gremlin> :> pluto = g.V().has('name', 'pluto').next(); g.V(pluto).outE('lives').values('reason')
==>no fear of death
gremlin> :> g.E().has('reason', textContains('loves'))
==>e[1zp-3ag-2gid-38g][4264-lives->4192]
==>e[558-6e8-2gid-6rv8og][8288-lives->409604272]
gremlin> :> g.E().has('reason', textContains('loves')).as('source').values('reason').as('reason').select('source').outV().values('name').as('god').select('source').inV().values('name').as('thing').select('god', 'reason', 'thing')
==>{god=neptune, reason=loves waves, thing=sea}
==>{god=jupiter, reason=loves fresh breezes, thing=sky}
Test successful - was able to read and data in a Titan graph and Titan indexes using JanusGraph. Next, I was able to add data to the same graph using JanusGraph (graph of the gods) and read that data with Titan. Note that in the Graph of the Gods, the vertex ids and edge ids match exactly.