Models followthemoney Schemas into neomodel ogm classes
Project description
followthemoney-neomodel
Models followthemoney Schemas into neomodel ogm classes
On the fly creation of classes for nodes and edges based on follow the money schema
Classes can be directly imported and used to create objects in a neo4j graph and traverse the graph
Setup
Requires followthemoney and neomodel. Any version of followthemoney will work as
pip install followthemoney-neomodel
This takes any version of followthemoney and will model whatever schemas are defined in that version
Usage
Basic
Just import and use classes directly to create objects
from followthemoney_neomodel import Person, Vehicle
# create two edges based on Person and Vehicle schema
me = Person(name='me')
me.save()
car = Vehicle(name='honda')
car.save()
# connect the two nodes together with edge OWNERSHIP relation and properties
me.owns.connect(car, {'role': 'lease'})
The module also has a models dict that you can use instead of importing to reference all models created
from followthemoney_neomodel import models
me = models['Person'](name='me')
Person.nodes.traverse("owns__name").all()
Async
Want async support? The modeler also sets up matching Async* classes
from followthemoney_neomodel import AsyncPerson
async def main():
me = Person(name='me')
await me.save()
car = Vehicle(name='honda')
await car.save()
await me.owns.connect(car, {'role': 'lease'})
Output
Generates a simple graph
Then you can query the graph using traversal syntax from neomodel
Testing
Run these tests on a dev neo4j instance/database as it will create nodes/edges which can pollute your graph.
Set NEOMODEL_DATABASE_URL env var to define destination db for testing
git clone ...
cd followthemoney-neomodel
poetry install -G dev
poetry run pytest tests.py
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file followthemoney_neomodel-0.1.0.tar.gz.
File metadata
- Download URL: followthemoney_neomodel-0.1.0.tar.gz
- Upload date:
- Size: 7.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.1.4 CPython/3.10.18 Darwin/25.3.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0050b0f4119c4f208b3ffc61c472033e698b9e094005e1aaf19e773cfbe6078c
|
|
| MD5 |
59b5f9259fc79e0d6cfbd145357788b1
|
|
| BLAKE2b-256 |
eb70cf25fd0d68a7c457b5bee067d3f0711b96f0a1a3e47a5ec9820b3fece2c3
|
File details
Details for the file followthemoney_neomodel-0.1.0-py3-none-any.whl.
File metadata
- Download URL: followthemoney_neomodel-0.1.0-py3-none-any.whl
- Upload date:
- Size: 8.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.1.4 CPython/3.10.18 Darwin/25.3.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d502b3613960276b1aca8d2618c8f738d6e6f0f2f5032da3bd281669299e5865
|
|
| MD5 |
ec3e6b979c90d32f54e31680856340e9
|
|
| BLAKE2b-256 |
42c9386b718da8b4c0eb11206360f7b7676f99ada27075c05de0d11ae0940702
|