Skip to main content

Owlapy is loosely based on owlapi - the java counterpart, successfully representing the main owl objects in python.

Project description

OWLAPY

Installation

Click me!

Installation from Source

git clone https://github.com/dice-group/owlapy
conda create -n temp_owlapy python=3.10.13 --no-default-packages && conda activate temp_owlapy && pip3 install -e .

or

pip3 install owlapy

Usage

Click me!

In this example we start with a simple atomic class expression and move to some more complex ones and finally render and print the last of them in description logics syntax.

from owlapy.render import DLSyntaxObjectRenderer
from owlapy.model import IRI, OWLClass, OWLObjectProperty, OWLObjectSomeValuesFrom, \
                         OWLObjectIntersectionOf
from owlapy.owl2sparql.converter import owl_expression_to_sparql

# Create an IRI object using the iri as a string for 'male' class.
male_iri = IRI.create('http://example.com/society#male')

# Create the male class
male = OWLClass(male_iri)

# Create an object property using the iri as a string for 'hasChild' property.
hasChild = OWLObjectProperty(IRI.create('http://example.com/society#hasChild'))

# Create an existential restrictions
males_with_children = OWLObjectSomeValuesFrom(hasChild, male)

# Let's make it more complex by intersecting with another class
teacher = OWLClass(IRI.create('http://example.com/society#teacher'))
male_teachers_with_children = OWLObjectIntersectionOf([males_with_children, teacher])

# You can render and print owl class expressions in description logics syntax
print(DLSyntaxObjectRenderer().render(male_teachers_with_children)) 
# (∃ hasChild.male) ⊓ teacher
print(owl_expression_to_sparql("?x", male_teachers_with_children))
#  SELECT DISTINCT ?x WHERE {  ?x <http://example.com/society#hasChild> ?s_1 . ?s_1 a <http://example.com/society#male> . ?x a <http://example.com/society#teacher> .  } }

For more, you can check the API documentation.

Every OWL object that can be used to classify individuals, is considered a class expression and inherits from OWLClassExpression class. In the above examples we have introduced 3 types of class expressions:

Like we showed in this example, you can create all kinds of class expressions using the OWL objects in owlapy model.

How to cite

Currently, we are working on our manuscript describing our framework.

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

owlapy-0.1.2.tar.gz (49.9 kB view details)

Uploaded Source

Built Distribution

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

owlapy-0.1.2-py3-none-any.whl (44.4 kB view details)

Uploaded Python 3

File details

Details for the file owlapy-0.1.2.tar.gz.

File metadata

  • Download URL: owlapy-0.1.2.tar.gz
  • Upload date:
  • Size: 49.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 colorama/0.4.4 importlib-metadata/4.6.4 keyring/23.5.0 pkginfo/1.8.2 readme-renderer/34.0 requests-toolbelt/0.9.1 requests/2.25.1 rfc3986/1.5.0 tqdm/4.57.0 urllib3/1.26.5 CPython/3.10.12

File hashes

Hashes for owlapy-0.1.2.tar.gz
Algorithm Hash digest
SHA256 11a8a96769574ad31f9cffe7912beb154402ba814418a0b98a8ba62df0051dfb
MD5 ddfc306572dac26516a6a2756acd41b2
BLAKE2b-256 0c8bc95cc0912609c5a288a143d37977f74bd786b4038605569c4b52fd3a3b79

See more details on using hashes here.

File details

Details for the file owlapy-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: owlapy-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 44.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 colorama/0.4.4 importlib-metadata/4.6.4 keyring/23.5.0 pkginfo/1.8.2 readme-renderer/34.0 requests-toolbelt/0.9.1 requests/2.25.1 rfc3986/1.5.0 tqdm/4.57.0 urllib3/1.26.5 CPython/3.10.12

File hashes

Hashes for owlapy-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 adc90c1a5473015517848dc9a07d61cc3d50bc6f42a676ef469d517ca6849725
MD5 4296b74ec446f5adcfebdf52d22bdc87
BLAKE2b-256 09397c6f5d4dc8328bab5195b877c2c4f822c8c0be8b4023c98ef88070ff9edf

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