Skip to content

Instantly share code, notes, and snippets.

@pangloss
Created August 24, 2011 19:08
Show Gist options
  • Save pangloss/1168902 to your computer and use it in GitHub Desktop.
Save pangloss/1168902 to your computer and use it in GitHub Desktop.
Pacer 0.8.1 using Rexster
dw:jruby-1.6.3:~/dev/graph $ gem install pacer-rexster
Fetching: pacer-rexster-1.0.0-jruby.gem (100%)
Successfully installed pacer-rexster-1.0.0-java
1 gem installed
Building YARD (yri) index for pacer-rexster-1.0.0-java...
dw:jruby-1.6.3:~/dev/graph $ pry
pry(main)> require 'pacer-rexster'
=> true
pry(main)> g = Pacer.rexster 'http://localhost:8182/gratefulgraph'
=> #<RexsterGraph>
pry(main)> g.v.count
=> 809
pry(main)> g.e.count
=> 8049
pry(main)> g.e.labels.uniq
"followed_by" "sung_by" "written_by"
Total: 3
=> #<GraphE -> labels -> uniq>
pry(main)> g.v.out(:sung_by).uniq
#<V[574]> #<V[447]> #<V[340]> #<V[501]> #<V[539]> #<V[533]> #<V[415]> #<V[537]> #<V[356]> #<V[342]> #<V[345]> #<V[347]> #<V[527]> #<V[351]> #<V[525]>
#<V[354]> #<V[352]> #<V[469]> #<V[467]> #<V[481]> #<V[462]> #<V[567]> #<V[457]> #<V[476]> #<V[585]> #<V[461]> #<V[453]> #<V[451]> #<V[798]> #<V[498]>
#<V[623]> #<V[484]> #<V[416]> #<V[394]> #<V[362]> #<V[388]> #<V[359]> #<V[339]> #<V[368]> #<V[375]> #<V[474]> #<V[377]> #<V[507]> #<V[422]> #<V[726]>
#<V[553]> #<V[405]> #<V[384]> #<V[391]> #<V[645]> #<V[666]> #<V[381]> #<V[430]> #<V[373]> #<V[426]> #<V[408]> #<V[376]> #<V[628]> #<V[412]> #<V[757]>
Total: 60
=> #<GraphV -> out(:sung_by) -> uniq>
pry(main)> g.vertex_name = proc { |v| v[:name] }
=> #<Proc:0x175c39c3@(pry):9>
pry(main)> g.v.out(:sung_by).uniq
#<V[574] None> #<V[447] Bob_Dylan> #<V[340] Garcia> #<V[501] Suzanne_Vega>
#<V[539] Neil_Young> #<V[533] Hall_and_Oates> #<V[415] Welnick> #<V[537] Jon_Hendricks>
#<V[356] Pigpen> #<V[342] Grateful_Dead> #<V[345] Lesh_Pigpen> #<V[347] Hart>
#<V[527] Bo_Diddley> #<V[351] Weir> #<V[525] Spencer_Davis> #<V[354] Lesh>
#<V[352] Mydland> #<V[469] Joan_Baez> #<V[467] Neville_Brothers> #<V[481] Stephen_Stills>
#<V[462] John_Fogerty> #<V[567] Beach_Boys> #<V[457] Donna> #<V[476] Pigpen_Weir>
#<V[585] Boz_Scaggs> #<V[461] Pigpen_Mydland> #<V[453] All> #<V[451] Unknown>
#<V[798] Allman_Brothers> #<V[498] Elvin_Bishop> #<V[623] Jorma_Kaukonen> #<V[484] Joey_Covington>
#<V[416] Hornsby> #<V[394] Garcia_Weir_Lesh> #<V[362] Garcia_Lesh> #<V[388] Lesh_Hart_Kreutzmann>
#<V[359] Weir_Hart> #<V[339] Hunter> #<V[368] Weir_Hart_Welnick> #<V[375] Garcia_Kreutzmann>
#<V[474] Pigpen_Garcia> #<V[377] Donna_Godchaux> #<V[507] Garcia_Weir> #<V[422] Hart_Kreutzmann>
#<V[726] Weir_Garcia> #<V[553] Pigpen_Weir_Mydland> #<V[405] Weir_Kreutzmann> #<V[384] instrumental>
#<V[391] Keith_Godchaux> #<V[645] Pigpen?> #<V[666] Neal_Cassady> #<V[381] Weir_Mydland>
#<V[430] Welnick_Bralove> #<V[373] Weir_Wasserman> #<V[426] Garcia_Lesh_Weir> #<V[408] Weir_Bralove>
#<V[376] Garcia_Dawson> #<V[628] Lesh_Mydland> #<V[412] Mydland_Lesh> #<V[757] Etta_James>
Total: 60
=> #<GraphV -> out(:sung_by) -> uniq>
pry(main)>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment