Skip to content

Commit

Permalink
refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
alkidbaci committed Apr 8, 2024
1 parent 0ed85e1 commit 8531c4d
Show file tree
Hide file tree
Showing 32 changed files with 4,071 additions and 3,834 deletions.
148 changes: 148 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,148 @@
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.json
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/
cover/

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/
docs/_static_gen/
# managed by sphinx autosummary in api.rst
docs/source/

# PyBuilder
.pybuilder/
target/

# Jupyter Notebook
.ipynb_checkpoints

# IPython
profile_default/
ipython_config.py

# pyenv
# For a library or package, you might want to ignore these files since the code is
# intended to run in multiple environments; otherwise, check them in:
# .python-version

# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
#Pipfile.lock

# PEP 582; used by e.g. github.com/David-OConnor/pyflow
__pypackages__/

# Celery stuff
celerybeat-schedule
celerybeat.pid

# SageMath parsed files
*.sage.py

# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# mkdocs documentation
/site

# mypy
.mypy_cache/
.dmypy.json
dmypy.json

# Pyre type checker
.pyre/

# pytype static type analyzer
.pytype/

# Cython debug symbols
cython_debug/

# Pycharm IDE
.idea/

# VS Code
.vscode/
8 changes: 3 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,8 @@ In this example we start with a simple atomic class expression and move to some
ones and finally render and print the last of them in description logics syntax.

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

# Create an IRI object using the iri as a string for 'male' class.
male_iri = IRI.create('http://example.com/society#male')
Expand All @@ -43,7 +41,7 @@ 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 (and vice-versa)
print(owl_expression_to_dl(male_teachers_with_children))
print(owl_expression_to_dl(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> . } }
Expand Down
16 changes: 16 additions & 0 deletions owlapy/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1,17 @@
from owlapy.converter import owl_expression_to_sparql
from owlapy.parser import manchester_to_owl_expression, dl_to_owl_expression
from owlapy.render import owl_expression_to_manchester, owl_expression_to_dl
from owlapy.owl.iri import *
from owlapy.owl.expressions import *
from owlapy.owl.base import *
from owlapy.owl.data_ranges import *
from owlapy.owl.general_abstract_classes import *
from owlapy.owl.propositional_connectives_and_enumeration_of_individuals import *
from owlapy.owl.axioms import *
from owlapy.owl.data_property_cardinality_restrictions import *
from owlapy.owl.data_property_restrictions import *
from owlapy.owl.object_property_cardinality_restrictions import *
from owlapy.owl.object_property_restrictions import *
from owlapy.owl.ontology import *
from owlapy.owl.reasoner import *
__version__ = '0.1.3'
2 changes: 1 addition & 1 deletion owlapy/owl2sparql/converter.py → owlapy/converter.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

from rdflib.plugins.sparql.parser import parseQuery

from owlapy.model import OWLClassExpression, OWLClass, OWLEntity, OWLObjectProperty, \
from owlapy import OWLClassExpression, OWLClass, OWLEntity, OWLObjectProperty, \
OWLObjectUnionOf, OWLObjectComplementOf, OWLObjectSomeValuesFrom, OWLObjectAllValuesFrom, OWLObjectHasValue, \
OWLNamedIndividual, OWLObjectCardinalityRestriction, OWLObjectMinCardinality, OWLObjectExactCardinality, \
OWLObjectMaxCardinality, OWLDataCardinalityRestriction, OWLDataProperty, OWLObjectHasSelf, OWLObjectOneOf, \
Expand Down
2 changes: 1 addition & 1 deletion owlapy/io.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""Abstract renderer and parser classes."""
from abc import abstractmethod, ABCMeta

from owlapy.model import OWLObject
from owlapy import OWLObject


class OWLObjectRenderer(metaclass=ABCMeta):
Expand Down
Loading

0 comments on commit 8531c4d

Please sign in to comment.