ºÝºÝߣ

ºÝºÝߣShare a Scribd company logo
neotool
(using py2neo from the command line)
py2neo 1.6 @technige
Usage
$ neotool <options> <command> <args>
$ python -m py2neo.tool <options> <command> <args>
clear Clear all nodes and relationships
cypher <query> Execute Cypher query and output as text
cypher-csv <query> Execute Cypher query and output as CSV
cypher-geoff <query> Execute Cypher query and output as Geoff
cypher-json <query> Execute Cypher query and output as JSON
cypher-tsv <query> Execute Cypher query and output as tab separated values
geoff-insert <file> Insert Geoff data
geoff-merge <file> Merge Geoff data
xml-geoff <file> Convert XML data to Geoff data
py2neo 1.6 @technige
abba.xml
<?xml version="1.0" encoding="UTF-8" ?>
<group id="abba">
<member id="agnetha">
<name>Agnetha F?ltskog</name><birth date="1950-04-05" />
</member>
<member id="bj?rn">
<name>Bj?rn Ulvaeus</name><birth date="1945-04-25" />
</member>
<member id="benny">
<name>Benny Andersson</name><birth date="1946-12-16" />
</member>
<member id="frida">
<name>Anni-Frid Lyngstad</name><birth date="1945-11-15" />
</member>
<song id="waterloo" release_date="1974-03-04">
<name>Waterloo</name><length min="2" sec="42" />
</song>
</group>
py2neo 1.6 @technige
XML to Geoff
$ neotool xml-geoff abba.xml
(abba)
(agnetha {"birth date":"1950-04-05","name":"Agnetha F?ltskog"})
(bj?rn {"birth date":"1945-04-25","name":"Bj?rn Ulvaeus"})
(benny {"birth date":"1946-12-16","name":"Benny Andersson"})
(frida {"birth date":"1945-11-15","name":"Anni-Frid Lyngstad"})
(waterloo {"length min":2,"length sec":42,"name":"Waterloo"})
(abba)-[:member]->(agnetha)
(abba)-[:member]->(bj?rn)
(abba)-[:member]->(benny)
(abba)-[:member]->(frida)
(abba)-[:song {"release_date":"1974-03-04"}]->(waterloo)
py2neo 1.6 @technige
Loading Geoff
$ neotool geoff-insert abba.geoff
$ neotool geoff-merge abba.geoff
waterloo (63 {"length sec":42,"length min":2,"name":"Waterloo"})
abba (68)
bj?rn (66 {"name":"Bj?rn Ulvaeus","birth date":"1945-04-25"})
benny (65 {"name":"Benny Andersson","birth date":"1946-12-16"})
frida (64 {"name":"Anni-Frid Lyngstad","birth date":"1945-11-15"})
agnetha (67 {"name":"Agnetha F?ltskog","birth date":"1950-04-05"})
py2neo 1.6 @technige
Cypher Queries
$ neotool cypher "START a=node(68) MATCH a-->b RETURN b"
b
-----------------------------------------------------------------
(67 {"name":"Agnetha F?ltskog","birth date":"1950-04-05"})
(66 {"name":"Bj?rn Ulvaeus","birth date":"1945-04-25"})
(65 {"name":"Benny Andersson","birth date":"1946-12-16"})
(64 {"name":"Anni-Frid Lyngstad","birth date":"1945-11-15"})
(63 {"length sec":42,"length min":2,"name":"Waterloo"})
(5 rows)
py2neo 1.6 @technige
https://pypi.python.org/pypi/py2neo
~
https://github.com/nigelsmall/py2neo
py2neo 1.6 @technige

More Related Content

Neotool (using py2neo from the command line)

  • 1. neotool (using py2neo from the command line) py2neo 1.6 @technige
  • 2. Usage $ neotool <options> <command> <args> $ python -m py2neo.tool <options> <command> <args> clear Clear all nodes and relationships cypher <query> Execute Cypher query and output as text cypher-csv <query> Execute Cypher query and output as CSV cypher-geoff <query> Execute Cypher query and output as Geoff cypher-json <query> Execute Cypher query and output as JSON cypher-tsv <query> Execute Cypher query and output as tab separated values geoff-insert <file> Insert Geoff data geoff-merge <file> Merge Geoff data xml-geoff <file> Convert XML data to Geoff data py2neo 1.6 @technige
  • 3. abba.xml <?xml version="1.0" encoding="UTF-8" ?> <group id="abba"> <member id="agnetha"> <name>Agnetha F?ltskog</name><birth date="1950-04-05" /> </member> <member id="bj?rn"> <name>Bj?rn Ulvaeus</name><birth date="1945-04-25" /> </member> <member id="benny"> <name>Benny Andersson</name><birth date="1946-12-16" /> </member> <member id="frida"> <name>Anni-Frid Lyngstad</name><birth date="1945-11-15" /> </member> <song id="waterloo" release_date="1974-03-04"> <name>Waterloo</name><length min="2" sec="42" /> </song> </group> py2neo 1.6 @technige
  • 4. XML to Geoff $ neotool xml-geoff abba.xml (abba) (agnetha {"birth date":"1950-04-05","name":"Agnetha F?ltskog"}) (bj?rn {"birth date":"1945-04-25","name":"Bj?rn Ulvaeus"}) (benny {"birth date":"1946-12-16","name":"Benny Andersson"}) (frida {"birth date":"1945-11-15","name":"Anni-Frid Lyngstad"}) (waterloo {"length min":2,"length sec":42,"name":"Waterloo"}) (abba)-[:member]->(agnetha) (abba)-[:member]->(bj?rn) (abba)-[:member]->(benny) (abba)-[:member]->(frida) (abba)-[:song {"release_date":"1974-03-04"}]->(waterloo) py2neo 1.6 @technige
  • 5. Loading Geoff $ neotool geoff-insert abba.geoff $ neotool geoff-merge abba.geoff waterloo (63 {"length sec":42,"length min":2,"name":"Waterloo"}) abba (68) bj?rn (66 {"name":"Bj?rn Ulvaeus","birth date":"1945-04-25"}) benny (65 {"name":"Benny Andersson","birth date":"1946-12-16"}) frida (64 {"name":"Anni-Frid Lyngstad","birth date":"1945-11-15"}) agnetha (67 {"name":"Agnetha F?ltskog","birth date":"1950-04-05"}) py2neo 1.6 @technige
  • 6. Cypher Queries $ neotool cypher "START a=node(68) MATCH a-->b RETURN b" b ----------------------------------------------------------------- (67 {"name":"Agnetha F?ltskog","birth date":"1950-04-05"}) (66 {"name":"Bj?rn Ulvaeus","birth date":"1945-04-25"}) (65 {"name":"Benny Andersson","birth date":"1946-12-16"}) (64 {"name":"Anni-Frid Lyngstad","birth date":"1945-11-15"}) (63 {"length sec":42,"length min":2,"name":"Waterloo"}) (5 rows) py2neo 1.6 @technige