Exports from tables to Semantic Knowledge Graphs, with a simple declarative mapping.
Project description
OntoWeaver
OntoWeaver is a tool for importing table data in Semantic Knowledge Graphs (SKG) databases.
OntoWeaver allows writing a simple declarative mapping to express how columns from a Pandas table are to be converted as typed nodes or edges in an SKG.
It provides a simple layer of abstraction on top of Biocypher, which remains responsible for doing the ontology alignment, supporting several graph database backends, and allowing reproducible & configurable builds.
With a pure Biocypher approach, you would have to write a whole adapter by hand, with OntoWeaver, you just have to express a mapping in YAML, looking like:
row: # The meaning of an entry in the input table.
map:
column: <column name in your CSV>
to_subject: <ontology node type to use for representing a row>
transformers: # How to map cells to nodes and edges.
- map: # Map a column to a node.
column: <column name>
to_object: <ontology node type to use for representing a column>
via_relation: <edge type for linking subject and object nodes>
- map: # Map a column to a property.
column: <another name>
to_property: <property name>
for_object: <type holding the property>
metadata: # Optional properties added to every node and edge.
- source: "My OntoWeaver adapter"
- version: "v1.2.3"
Installation
The project is written in Python and uses Poetry. You can install the necessary dependencies in a virtual environment like this:
git clone https://github.com/oncodash/ontoweaver.git
cd ontoweaver
poetry install
Poetry will create a virtual environment according to your configuration (either
centrally or in the project folder). You can activate it by running poetry shell inside the project directory.
Theoretically, the graph can be imported in any [graph] database supported by BioCypher (Neo4j, ArangoDB, CSV, RDF, PostgreSQL, SQLite, NetworkX, … see BioCypher's documentation).
Usage Documentation
Detailed documentation with tutorials and a more detailed installation guide is available on the OntoWeaver website.
Tests
Tests are located in the tests/ subdirectory and may be a good starting point
to see OntoWeaver in practice. You may start with tests/test_simplest.py which
shows the simplest example of mapping tabular data through BioCypher.
To run tests, use pytest:
poetry run pytest
or, alternatively:
poetry shell
pytest
Contributing
In case of any questions, or improvements feel free to open an issue or a pull request!
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 ontoweaver-0.2.0.tar.gz.
File metadata
- Download URL: ontoweaver-0.2.0.tar.gz
- Upload date:
- Size: 46.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.5 CPython/3.13.1 Darwin/24.4.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cf4406fa7446591549430fb742c6b32232b8fa2cef87332d08e05dc8202aa883
|
|
| MD5 |
f789054f622d4a45c60d8e1dd07cec85
|
|
| BLAKE2b-256 |
fe0257fdde9daa1404a2b519654775dc7e11591713be75480254f5e298d910fd
|
File details
Details for the file ontoweaver-0.2.0-py3-none-any.whl.
File metadata
- Download URL: ontoweaver-0.2.0-py3-none-any.whl
- Upload date:
- Size: 51.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.5 CPython/3.13.1 Darwin/24.4.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e21070f9880cdb2c056541b9a99813fdfc848e3ef514a9ca078ed7209229fdb4
|
|
| MD5 |
e69ca87854b9c9d44359a0edce89fdc6
|
|
| BLAKE2b-256 |
7dda22b5f37c84e9c0bb319de11968a5bf4a93ea51ccaff0ccae2bd6ad72990f
|