Skip to main content

mOWL: A machine learning library with ontologies

Project description

mOWL: Machine Learning Library with Ontologies

mOWL is a library that provides different machine learning methods in which ontologies are used as background knowledge. mOWL is developed mainly in Python, but we have integrated the functionalities of OWLAPI, which is written in Java, for which we use JPype to bind Python with the Java Virtual Machine (JVM).

Table of contents


PyPi v0.0.30

pip install mowl-borg

From GitHub

Installation can be done with the following commands:

git clone

cd mowl

conda env create -f environment.yml
conda activate mowl


The last line will generate the necessary jar files to bind Python with the code that runs in the JVM

Examples of use

Basic example

In this example we use the training data (which is an OWL ontology) from the built-in dataset PPIYeasSlimDataset to build a graph representation using the subClassOf axioms.

import mowl
from mowl.datasets.ppi_yeast import PPIYeastSlimDataset
from mowl.projection.taxonomy.model import TaxonomyProjector

dataset = PPIYeastSlimDataset()
projector = TaxonomyProjector(bidirectional_taxonomy = True)
edges = projector.project(dataset.ontology)

The projected edges is an edge list of a graph. One use of this may be to generate random walks:

from mowl.walking.deepwalk.model import DeepWalk
walker = DeepWalk(100, # number of walks
		20, # length of each walk
		0.2, # probability of restart
		workers = 4, # number of usable CPUs

walks = walker.walks

Ontology to graph

In the previous example we called the class TaxonomyProjector to perform the graph projection. However, there are more ways to perform the projection. We include the following four:

Instead of instantianting each of them separately, there is the following factory method:

from mowl.projection.factory import projector_factory

projector = projector_factory("taxonomy_rels", bidirectional_taxonomy = True)

Now projector will be an instance of the TaxonomyWithRelsProjector class. The string parameters for each method are listed above.

For the random walks method we have a similar factory method that can be found in mowl.walking.factory and is called walking_factory.

List of contributors


This software library is distributed under the BSD-3-Clause license


Full documentation and API reference can be found in our ReadTheDocs website.


ChangeLog is available in our changelog file and also in the release section.

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

mowl-borg-0.1.0.tar.gz (61.7 MB view hashes)

Uploaded Source

Built Distribution

mowl_borg-0.1.0-py3-none-any.whl (61.8 MB view hashes)

Uploaded Python 3

Supported by

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