Created
January 16, 2010 09:36
-
-
Save peterneubauer/278756 to your computer and use it in GitHub Desktop.
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
#öffne einen neuen Neo4j Graph als den default-Graphen ($_g) | |
$_g := neo4j:open('tmp/matrix') | |
#die Knoten mit Namen | |
$neo := g:add-v() | |
$neo/name := 'Neo' | |
$morpheus := g:add-v() | |
$morpheus/name := 'Morpheus' | |
$trinity := g:add-v() | |
$trinity/name := 'Trinity' | |
$cypher := g:add-v() | |
$cypher/name := 'Cypher' | |
$smith := g:add-v() | |
$smith/name := 'Agent Smith' | |
$architect := g:add-v() | |
$architect/name := 'The Architect' | |
#und jetzt die Kanten | |
g:add-e($neo,'KNOWS',$morpheus) | |
g:add-e($morpheus,'KNOWS',$cypher) | |
g:add-e($morpheus,'KNOWS',$trinity) | |
g:add-e($cypher,'KNOWS',$smith) | |
g:add-e($trinity,'LOVES',$neo) | |
g:add-e($architect,'HAS_CODED',$smith) | |
#stelle dich auf Neo als Ausgangspunkt ($_) durch eine indexierten Volltextsuche | |
$_ := g:key('name','Neo') | |
#ist dies auch Neo? | |
./name | |
#welche Kanten (Edges) gibt's denn hier, rein und raus? | |
./bothE | |
#und nur die KNOWS-Kanten? | |
./bothE[@label='KNOWS'] | |
#Die Namen von Neo's Freunden | |
g:key('name','Neo')/bothE[@label='KNOWS']/inV/@name | |
#Neo's Friends of friends | |
#anyone in the graph who has an outgoing LOVES edge |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment