Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using neomodel for querying Neo4j database created with py2neo #859

Open
jrkarki opened this issue Feb 13, 2025 · 0 comments
Open

Using neomodel for querying Neo4j database created with py2neo #859

jrkarki opened this issue Feb 13, 2025 · 0 comments

Comments

@jrkarki
Copy link

jrkarki commented Feb 13, 2025

Hi there community,

I am considering using neomodel to query a Neo4j database as cypher queries are no longer required. The neomodel documentation shows how to work on neomodel created node labels and fetch the associated attributes. For instance, people = Person.nodes.filter(age__gt=3). However, I have a different situation. I have a graph created with py2neo, however without a pre-defined nodes and relationships. I created nodes and relationships on the fly because I was not aware of all the node attributes in advance and the list kept growing.

Irrespective of these discrepancies, I assume that "class Person(StructuredNode)" is equivalent to the nodes I have in my graph. Assuming this, I want to able to retrieve node attributes just like the above example. My use case would be -> chem_info = Chemical.nodes.filter(Molecular Weight < 500) or retrieve the relationship where a certain protein is targeted by this chemical. How do I achieve this? How do I let neomodel know the available node labels from my graph?

I was able to connect to my database using neomodel and get couple of things done. See below:

from neomodel.scripts.neomodel_inspect_database import NodeInspector

NodeInspector.get_properties_for_label('Protein')

Output:
{'Name': 'STRING',
'GO cellular component': 'STRING',
'GO biological process': 'STRING',
'GO molecular function': 'STRING',
'Uniprot': 'STRING',
'Sequence': 'STRING'}**

This gives me a hint that things I want to do might be possible.

Please let me know or point me to the documentation where I can get counts of each labels or filter relationships based on user-defined constraints (of course without cypher queries).

Thanks in advance,
Reagon

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant