Skip to main content

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

Project description

owlapy

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

Other than that, Owlapy also offers some extra functionalities:

  • Owl2SparqlConverter to convert owl class expressions to SPARQL syntax.
  • DLSyntaxObjectRenderer to render owl objects to description logics.
  • ManchesterOWLSyntaxParser to parse strings of manchester syntax to owl class expression.

For more, you can check the API documentation.

Installation

pip install owlapy

Usage

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

# 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))

The following will be printed:

(∃ hasChild.male) ⊓ teacher

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.

Are you looking for more?

The java owlapi library also offers classes for OWL ontology, manager and reasoner. We have also implemented those classes in python, but for the time being we are not including them in owlapy. You can find all of those classes in Ontolearn, which is a python library that offers more than just that.

In case you have any question or request please don't hesitate to open an issue.

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.1.tar.gz (50.6 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.1-py3-none-any.whl (44.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: owlapy-0.1.1.tar.gz
  • Upload date:
  • Size: 50.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.13

File hashes

Hashes for owlapy-0.1.1.tar.gz
Algorithm Hash digest
SHA256 77e77ef0fcc9175bc4fb69aa4749a76f569f4e1803c21951892a5d3659114411
MD5 62fbfa06755d139cf1d3d37b71ff4e7e
BLAKE2b-256 38604d631fada7a6b10c07ab233ac65147c73bcd5d9df8d967886591a0a806e1

See more details on using hashes here.

File details

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

File metadata

  • Download URL: owlapy-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 44.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.13

File hashes

Hashes for owlapy-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 92e173ef694d6d2390bc3fe103ab534a18f3a7c95eda7524d7f6a3976c603b0b
MD5 8c3288eda9c0be729336c60963f9c309
BLAKE2b-256 4f0ed1c6dac487417b58298c9e818f710b84094210dd18331cfcce99d9195b86

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