Skip to content

Commit 3f6f75e

Browse files
authored
Merge pull request #61 from dice-group/develop
New Release 1.2.1
2 parents f988897 + e3c2663 commit 3f6f75e

27 files changed

+1418
-378
lines changed

.coveragerc

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
[run]
2+
omit =
3+
tests/*
4+
5+
[report]
6+
exclude_lines =
7+
pragma: no cover
8+
def __repr__
9+
if self.debug:
10+
if settings.DEBUG
11+
raise AssertionError
12+
raise NotImplementedError
13+
if 0:
14+
if __name__ == .__main__.:
15+
if TYPE_CHECKING:
16+
class .*\bProtocol\):
17+
@(abc\.)?abstractmethod
18+
pass

.github/workflows/test.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,9 @@ jobs:
2424
wget https://files.dice-research.org/projects/Ontolearn/KGs.zip
2525
unzip KGs.zip
2626
python -m pytest -p no:warnings -x
27+
28+
- name: Coverage report
29+
run: |
30+
pip install coverage
31+
coverage run -m pytest
32+
coverage report -m

README.md

Lines changed: 64 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
11
# OWLAPY
2+
[![Coverage](https://img.shields.io/badge/coverage-78%25-green)](https://dice-group.github.io/owlapy/usage/further_resources.html#coverage-report)
3+
[![Pypi](https://img.shields.io/badge/pypi-1.2.0-blue)](https://pypi.org/project/owlapy/1.2.0/)
4+
[![Docs](https://img.shields.io/badge/documentation-1.2.0-yellow)](https://dice-group.github.io/owlapy/usage/main.html)
5+
6+
![OWLAPY](docs/_static/images/owlapy_logo.png)
27

38
OWLAPY is a Python Framework for creating and manipulating OWL Ontologies.
49

@@ -17,10 +22,17 @@ pip3 install owlapy
1722
```
1823

1924

25+
```shell
26+
# To download RDF knowledge graphs
27+
wget https://files.dice-research.org/projects/Ontolearn/KGs.zip -O ./KGs.zip && unzip KGs.zip
28+
pytest -p no:warnings -x # Running 103 tests takes ~ 30 mins
29+
```
30+
2031
## Usage
2132

22-
In this example we start with a simple atomic class expression and move to some more complex
23-
ones and finally render and print the last of them in description logics syntax.
33+
34+
### Creating OWL Class Expressions
35+
<details><summary> Click me! </summary>
2436

2537
```python
2638
from owlapy.class_expression import OWLClass, OWLObjectIntersectionOf, OWLObjectSomeValuesFrom
@@ -29,17 +41,13 @@ from owlapy import owl_expression_to_sparql, owl_expression_to_dl
2941

3042
# Create the male class
3143
male = OWLClass("http://example.com/society#male")
32-
3344
# Create an object property using the iri as a string for 'hasChild' property.
3445
hasChild = OWLObjectProperty("http://example.com/society#hasChild")
35-
3646
# Create an existential restrictions
3747
hasChild_male = OWLObjectSomeValuesFrom(hasChild, male)
38-
3948
# Let's make it more complex by intersecting with another class
4049
teacher = OWLClass("http://example.com/society#teacher")
4150
teacher_that_hasChild_male = OWLObjectIntersectionOf([hasChild_male, teacher])
42-
4351
# You can render and print owl class expressions in description logics syntax (and vice-versa)
4452
print(owl_expression_to_dl(teacher_that_hasChild_male))
4553
# (∃ hasChild.male) ⊓ teacher
@@ -57,7 +65,56 @@ class. In the above examples we have introduced 3 types of class expressions:
5765
Like we showed in this example, you can create all kinds of class expressions using the
5866
OWL objects in [owlapy api](https://dice-group.github.io/owlapy/autoapi/owlapy/index.html).
5967

60-
Check also the [examples](https://github.com/dice-group/owlapy/tree/develop/examples) folder.
68+
</details>
69+
70+
### Logical Inference
71+
72+
<details><summary> Click me! </summary>
73+
74+
```python
75+
from owlapy.owl_ontology_manager import OntologyManager
76+
from owlapy.owlapi_adaptor import OWLAPIAdaptor
77+
78+
ontology_path = "KGs/Family/family-benchmark_rich_background.owl"
79+
# Available OWL Reasoners: 'HermiT', 'Pellet', 'JFact', 'Openllet'
80+
owlapi_adaptor = OWLAPIAdaptor(path=ontology_path, name_reasoner="Pellet")
81+
onto = OntologyManager().load_ontology(ontology_path)
82+
# Iterate over defined owl Classes in the signature
83+
for i in onto.classes_in_signature():
84+
# Performing type inference with Pellet
85+
instances=owlapi_adaptor.instances(i,direct=False)
86+
print(f"Class:{i}\t Num instances:{len(instances)}")
87+
owlapi_adaptor.stopJVM()
88+
```
89+
90+
</details>
91+
92+
### Ontology Enrichment
93+
94+
<details><summary> Click me! </summary>
95+
96+
An Ontology can be enriched by inferring many different axioms.
97+
```python
98+
from owlapy.owlapi_adaptor import OWLAPIAdaptor
99+
100+
adaptor = OWLAPIAdaptor(path="KGs/Family/family-benchmark_rich_background.owl", name_reasoner="Pellet")
101+
# Infer missing class assertions
102+
adaptor.infer_axioms_and_save(output_path="KGs/Family/inferred_family-benchmark_rich_background.ttl",
103+
output_format="ttl",
104+
inference_types=[
105+
"InferredClassAssertionAxiomGenerator",
106+
"InferredEquivalentClassAxiomGenerator",
107+
"InferredDisjointClassesAxiomGenerator",
108+
"InferredSubClassAxiomGenerator",
109+
"InferredInverseObjectPropertiesAxiomGenerator",
110+
"InferredEquivalentClassAxiomGenerator"])
111+
adaptor.stopJVM()
112+
```
113+
114+
</details>
115+
116+
117+
Check also the [examples](https://github.com/dice-group/owlapy/tree/develop/examples) and [tests](https://github.com/dice-group/owlapy/tree/develop/tests) folders.
61118

62119
## How to cite
63120
Currently, we are working on our manuscript describing our framework.

docs/_static/images/favicon.ico

766 Bytes
Binary file not shown.
17.3 KB
Loading

docs/conf.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
project = 'OWLAPY'
1515
author = 'Ontolearn Team'
16-
release = '1.1.1'
16+
release = '1.2.0'
1717

1818
# -- General configuration ---------------------------------------------------
1919
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration
@@ -66,6 +66,12 @@
6666

6767
html_static_path = ['_static']
6868

69+
html_logo = '_static/images/owlapy_logo.png'
70+
71+
html_favicon = '_static/images/favicon.ico'
72+
73+
html_extra_path = ["googlec4c425077889c69c.html"]
74+
6975
if stanford_theme_mod:
7076
html_theme = 'sphinx_rtd_theme'
7177

docs/googlec4c425077889c69c.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
google-site-verification: googlec4c425077889c69c.html

docs/index.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,6 @@ Welcome to OWLAPY!
1414
usage/usage_examples
1515
usage/ontologies
1616
usage/reasoner
17-
usage/reasoning_details
1817
usage/owlapi_adaptor
18+
usage/further_resources
1919
autoapi/owlapy/index

docs/usage/further_resources.md

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
# Further Resources
2+
3+
Currently, we are working on our manuscript describing our framework.
4+
If you want to attribute our library, please use our
5+
[GitHub page](https://github.com/dice-group/owlapy) for reference.
6+
7+
## More Inside the Project
8+
9+
Examples and test cases provide a good starting point to get to know
10+
the project better. Find them in the folders
11+
[examples](https://github.com/dice-group/owlapy/tree/develop/examples) and [tests](https://github.com/dice-group/owlapy/tree/develop/tests).
12+
13+
## Contribution
14+
15+
Feel free to create a pull request and we will take a look on it.
16+
Your commitment is well appreciated!
17+
18+
## Questions
19+
20+
In case you have any question, please contact: `caglardemir8@gmail.com`
21+
or open an issue on our [GitHub issues page](https://github.com/dice-group/owlapy/issues).
22+
23+
## Coverage Report
24+
The coverage report is generated using [coverage.py](https://coverage.readthedocs.io/en/7.6.1/).
25+
26+
```
27+
Name Stmts Miss Cover Missing
28+
----------------------------------------------------------------------------------
29+
owlapy/__init__.py 4 0 100%
30+
owlapy/class_expression/__init__.py 8 0 100%
31+
owlapy/class_expression/class_expression.py 34 2 94% 58, 62
32+
owlapy/class_expression/nary_boolean_expression.py 24 0 100%
33+
owlapy/class_expression/owl_class.py 33 1 97% 44
34+
owlapy/class_expression/restriction.py 313 26 92% 41, 49, 68, 71, 89, 170, 245-246, 302, 305, 335, 340, 343, 426, 451, 499, 502, 579-580, 616, 659, 662, 700, 703, 751, 823
35+
owlapy/converter.py 397 189 52% 52-68, 75-76, 79, 82, 152, 157, 169, 176, 184, 246-257, 264-282, 294, 304-307, 313-359, 366-387, 394-401, 417-420, 431, 451, 460-481, 489-491, 498-511, 515-521, 525-548, 552-555, 559-560, 564-576, 580-587, 591-592, 620, 624-628
36+
owlapy/iri.py 79 7 91% 54, 69, 82, 97, 128, 133, 150
37+
owlapy/meta_classes.py 11 0 100%
38+
owlapy/namespaces.py 27 3 89% 36, 40, 43
39+
owlapy/owl_annotation.py 17 4 76% 17, 25, 43, 51
40+
owlapy/owl_axiom.py 518 157 70% 36, 39, 42, 45, 59, 111-113, 116, 136-138, 141, 144, 147-150, 153, 182-184, 187, 190, 193, 196-200, 203, 253-256, 259-261, 264, 288, 291, 294, 332-335, 338-340, 343, 398-401, 404-406, 409, 533-536, 539, 561-563, 566, 569, 572, 575, 578-581, 584, 620-623, 626, 645-648, 652, 656, 674-675, 683, 692, 695-697, 700, 711, 733-737, 745, 753, 761, 764-766, 769, 786-788, 791, 794, 797-800, 803, 822-824, 827, 830, 833-836, 839, 858-860, 863, 866, 869-872, 875, 905-908, 911, 982-985, 988, 1018, 1044, 1071-1073, 1076, 1091, 1103, 1116, 1129, 1142, 1157, 1172, 1185-1187, 1190, 1208, 1227-1230, 1233, 1254-1257, 1260
41+
owlapy/owl_data_ranges.py 40 1 98% 46
42+
owlapy/owl_datatype.py 20 2 90% 33-34
43+
owlapy/owl_individual.py 20 1 95% 37
44+
owlapy/owl_literal.py 286 73 74% 49, 77, 86, 90, 99, 103, 112, 116, 125, 129, 138, 142, 151, 155, 164, 169, 173, 203, 208, 217, 221, 244, 247-249, 252, 258, 262, 288, 293, 302, 306, 311, 323, 329, 332-334, 337, 340, 346, 350, 355, 373, 376-378, 381, 387, 391, 415, 418-420, 423, 429, 433, 454, 459, 462-464, 467, 473, 477, 489-491, 494, 497-499, 502
45+
owlapy/owl_object.py 27 4 85% 24, 79-81
46+
owlapy/owl_ontology.py 391 40 90% 86, 97-100, 103, 109-111, 249, 292-295, 304, 312, 329, 341, 345, 358, 371, 376, 379-381, 384, 423, 433, 449-450, 473-474, 553-554, 595, 599, 603, 629, 736, 742, 750
47+
owlapy/owl_ontology_manager.py 568 167 71% 48, 140, 151, 155, 168-169, 177, 200, 208-211, 312-318, 341-350, 355-376, 396, 466, 469, 474-496, 501-511, 521-527, 539, 542-543, 583, 588-593, 603, 608, 625, 634-645, 650-665, 676, 681, 691, 703, 707, 743, 749, 760, 766, 771-795, 800-807, 825-831, 850, 853, 859-862, 888
48+
owlapy/owl_property.py 69 11 84% 17, 24, 32, 40, 67, 76, 126, 158, 162, 174, 193
49+
owlapy/owl_reasoner.py 841 175 79% 452-455, 572, 584-586, 591-597, 604, 653-659, 665-669, 727-734, 760, 795-799, 825-828, 856-858, 860-862, 871, 884-886, 888-890, 897, 902-904, 924, 928-929, 942-944, 965, 1010-1012, 1113, 1121, 1124, 1127, 1130, 1133, 1136, 1139, 1142, 1145, 1160-1162, 1168, 1172, 1175, 1178, 1181, 1184, 1187, 1193, 1196, 1210, 1240-1243, 1251-1290, 1305, 1318-1328, 1353-1356, 1372, 1386, 1456-1460, 1488, 1498-1502, 1510-1514, 1555-1561, 1573, 1632, 1635, 1638, 1641, 1644, 1647, 1650, 1653, 1657, 1661, 1665, 1668, 1671, 1674, 1677, 1680, 1683, 1687, 1691, 1694, 1697
50+
owlapy/owlapi_adaptor.py 130 65 50% 18, 74-76, 91-96, 110-115, 151-152, 164-165, 179-180, 195-196, 214, 232, 251, 271, 287, 305, 320, 333, 346, 361, 376, 390, 404, 419, 434, 450, 454-483, 511
51+
owlapy/owlapi_mapper.py 103 14 86% 35, 51, 72, 76, 80, 84, 88, 133-136, 141, 145, 149
52+
owlapy/parser.py 371 16 96% 316, 327, 400-401, 416, 577, 618, 656, 667, 721, 723, 751-752, 763, 779-780
53+
owlapy/providers.py 38 3 92% 41, 54, 56
54+
owlapy/render.py 290 46 84% 79-114, 143-158, 176, 180, 186, 206, 222, 231, 236, 241, 375, 379, 386, 405, 421, 430, 435, 440
55+
owlapy/utils.py 766 227 70% 164, 168, 172, 178, 184-188, 192-196, 200, 204, 208, 214, 218, 222, 226, 230, 236, 242, 248, 252, 256, 260, 264-267, 271-274, 278, 285, 300-302, 305-314, 317, 320, 323, 326, 329, 333-339, 343, 354, 358, 362, 366, 370, 374-378, 382-386, 390-394, 398-402, 406, 410, 414-419, 423-428, 432-437, 441, 445, 449-453, 457-461, 465-469, 473-477, 481-485, 489, 493-497, 501, 505-510, 514-519, 523-528, 532, 536-540, 545, 554, 558, 562, 566, 570, 574, 578, 582-587, 591-597, 601, 605, 609, 614, 619, 624, 628, 632, 636, 640, 644-647, 651-654, 658, 662, 666, 671, 676, 681, 685, 736, 740, 746, 748, 751, 753, 796, 852, 866-868, 877, 919-920, 940, 1039, 1044, 1049, 1071, 1075, 1083, 1087, 1092, 1164-1182, 1195-1197, 1202-1206
56+
owlapy/vocab.py 92 4 96% 32, 35, 113-114
57+
----------------------------------------------------------------------------------
58+
TOTAL 5517 1238 78%
59+
```

docs/usage/main.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# About owlapy
22

3-
**Version:** owlapy 1.1.1
3+
**Version:** owlapy 1.2.0
44

55
**GitHub repository:** [https://github.com/dice-group/owlapy](https://github.com/dice-group/owlapy)
66

0 commit comments

Comments
 (0)