简体   繁体   中英

Is there a way to write queries in neo4j while using neo4jrestclient and python?

I need to filter my data and use queries. I am using neo4jrestclient library and working with Neo4J Desktop for visualizing my data.

Here is my program:

#creating node

users = db.labels.create("Worker")
u1 = db.nodes.create(name="Keanu Reeves", born=1999, city="New York", experience=3)
...
u6 = db.nodes.create(name="Emil Eifrem", born=1978, city="New York", experience=0.5)
users.add(u1, u2, u3, u4, u5, u6)

departments = db.labels.create("Department")
d3 = db.nodes.create(name="Manufacturing", city="Kaunas")
d4 = db.nodes.create(name="Management", city="New York")
departments.add(d1, d2, d3, d4)

#adding relationships

u1.relationships.create("works", d4, since=2016)
u2.relationships.create("works", d3, since=2018)

How can I filter my data (for example get all workers, who work in New York?)? Maybe somehow using queries language? Please, help me.

The docs suggest you can query using Cypher just like you can in the Desktop.

As alternatives if that's a bit clunky, there's also the official client , and the unofficial Neomodel project which is an ORM on top of Neo4j that makes things slightly easier to consume if you're familiar with Django (or any other ORM). The official client page also has an example project based on the Movies sample database that should give you some pointers.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM