Skip to content

Commit

Permalink
added more description
Browse files Browse the repository at this point in the history
  • Loading branch information
alkidbaci committed Nov 15, 2023
1 parent 7136955 commit 6a63386
Showing 1 changed file with 49 additions and 0 deletions.
49 changes: 49 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,52 @@ easier due to the well documented code.
```shell
pip install owlapy
```

## Usage

```python
from owlapy.render import DLSyntaxObjectRenderer
from owlapy.namespaces import Namespaces
from owlapy.model import IRI, OWLClass, OWLObjectProperty, OWLObjectSomeValuesFrom, \
OWLObjectIntersectionOf

# defining the ontology namespace with prefix 'ex'
NS = Namespaces("ex", "http://example.com/society#")

# create the iri referring to 'male' class
male_iri = IRI.create(NS,'male')

# create the male class
male = OWLClass(male_iri)

# create an object property
hasChild = OWLObjectProperty(IRI.create(NS,'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(NS ,'teacher'))
male_teachers_with_children = OWLObjectIntersectionOf([males_with_children, teacher])

# This can be printed in description logics
print(DLSyntaxObjectRenderer().render(male_teachers_with_children))
```
The following will be printed:

```commandline
(∃ hasChild.male) ⊓ teacher
```

Like we showed in this example, you can create more complex class expressions, and there
are a lot of other OWL objects in owlapy model that you can use.

### 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](https://github.com/dice-group/Ontolearn/tree/develop), 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.

0 comments on commit 6a63386

Please sign in to comment.