From 6a6338665a6df0845e67eda577327ca4c62f446b Mon Sep 17 00:00:00 2001 From: Alkid Date: Wed, 15 Nov 2023 15:06:40 +0100 Subject: [PATCH] added more description --- README.md | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) diff --git a/README.md b/README.md index 8739925c..f08fa0a8 100644 --- a/README.md +++ b/README.md @@ -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. \ No newline at end of file