Skip to main content

Exports from tables to Semantic Knowledge Graphs, with a simple declarative mapping.

Project description

OntoWeaver

OntoWeaver is a tool for transforming tabular data in Semantic Knowledge Graphs (SKG) databases.

OntoWeaver allows writing a simple declarative mapping to express how columns from a table should be converted as typed nodes, edges or properties in an SKG.

Diagram showing that OntoWeaver needs ontologies, tabular data and graph schema to produce a Semantic Knowledge Graph.

SKG databases allows for an easy integration of very heterogeneous data, and OntoWeaver brings a reproducible approach to building them.

With OntoWeaver, you can very easily implement a script that will allow you to automatically reconfigure a new SKG from the input data, each time you need it.

OntoWeaver has been tested on large scale biomedical use cases, and we can guarantee that it is simple to operate by anyone having a basic knowledge of programming.

Basics

OntoWeaver 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"

OntoWeaver can read anything that Pandas can load, which means a lot of tabular formats.

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

Contributing

In case of any questions or improvements feel free to open an issue or a pull request!

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ontoweaver-1.0.0.tar.gz (52.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ontoweaver-1.0.0-py3-none-any.whl (58.9 kB view details)

Uploaded Python 3

File details

Details for the file ontoweaver-1.0.0.tar.gz.

File metadata

  • Download URL: ontoweaver-1.0.0.tar.gz
  • Upload date:
  • Size: 52.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.2 CPython/3.13.3 Darwin/25.1.0

File hashes

Hashes for ontoweaver-1.0.0.tar.gz
Algorithm Hash digest
SHA256 b0f258799c087cb4bc4c8a130cd9f9a21e504c0bfd290b23606d76b13d303494
MD5 f84aa3c2a8cd96a43658cb8b5b1e64d3
BLAKE2b-256 7b54d1344278ea6b0be40ebc42dc5ca60d3798f5120281a07ad6a23adf0a239f

See more details on using hashes here.

File details

Details for the file ontoweaver-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: ontoweaver-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 58.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.2 CPython/3.13.3 Darwin/25.1.0

File hashes

Hashes for ontoweaver-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4269cd596540e9997b55228de9f1d4fe778ef9b64df680c5efeb54f30474e0d2
MD5 1c8a711e837f2eb113cb50f68bfe7424
BLAKE2b-256 f38fff4872b29626db6d1b1ff3b4b9b08cd38be1536487be8167ea2b972b6ea9

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page