Skip to content

Commit

Permalink
Merge pull request #132 from dice-group/deprecating-manager
Browse files Browse the repository at this point in the history
Deprecating manager & removed GPL-3.0 licensed code
  • Loading branch information
alkidbaci authored Feb 14, 2025
2 parents 46972e2 + e5b05ce commit b96e8b6
Show file tree
Hide file tree
Showing 34 changed files with 346 additions and 878 deletions.
19 changes: 9 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,10 @@ owlapy --path_ontology "KGs/Family/family-benchmark_rich_background.owl" --infer
<details><summary> Click me! </summary>

```python
from owlapy.owl_ontology_manager import SyncOntologyManager
from owlapy.owl_ontology import SyncOntology

ontology_path = "KGs/Family/father.owl"
onto = SyncOntologyManager().load_ontology(ontology_path)
onto = SyncOntology(ontology_path)

print({owl_class.reminder for owl_class in onto.classes_in_signature()})
# {'Thing', 'female', 'male', 'person'}
Expand Down Expand Up @@ -112,10 +112,9 @@ for axiom in onto.get_abox_axioms():
from owlapy.class_expression import OWLClass, OWLObjectIntersectionOf, OWLObjectSomeValuesFrom
from owlapy.owl_property import OWLObjectProperty
from owlapy import owl_expression_to_sparql, owl_expression_to_dl
from owlapy.owl_ontology_manager import OntologyManager
from owlapy.owl_axiom import OWLDeclarationAxiom, OWLClassAssertionAxiom
from owlapy.owl_individual import OWLNamedIndividual, IRI
from owlapy.static_funcs import create_ontology
from owlapy.owl_individual import OWLNamedIndividual
from owlapy.util_owl_static_funcs import create_ontology
# Using owl classes to create a complex class expression
male = OWLClass("http://example.com/society#male")
hasChild = OWLObjectProperty("http://example.com/society#hasChild")
Expand All @@ -127,7 +126,7 @@ teacher_that_hasChild_male = OWLObjectIntersectionOf([hasChild_male, teacher])
print(owl_expression_to_dl(teacher_that_hasChild_male)) # (∃ hasChild.male) ⊓ teacher
print(owl_expression_to_sparql(teacher_that_hasChild_male)) # 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> . } }

# Create an ontology via ontology manager directly
# Create an ontology
ontology = create_ontology("file:/example_ontology.owl",with_owlapi=False)
john = OWLNamedIndividual("http://example.com/society#john")
male_declaration_axiom = OWLDeclarationAxiom(male)
Expand Down Expand Up @@ -155,14 +154,14 @@ OWL objects in [owlapy api](https://dice-group.github.io/owlapy/autoapi/owlapy/i
<details><summary> Click me! </summary>

```python
from owlapy.owl_ontology_manager import OntologyManager
from owlapy.owl_reasoner import SyncReasoner
from owlapy.static_funcs import stopJVM
from owlapy.owl_ontology import Ontology

ontology_path = "KGs/Family/family-benchmark_rich_background.owl"
# Available OWL Reasoners: 'HermiT', 'Pellet', 'JFact', 'Openllet'
sync_reasoner = SyncReasoner(ontology = ontology_path, reasoner="Pellet")
onto = OntologyManager().load_ontology(ontology_path)
onto = Ontology(ontology_path)
# Iterate over defined owl Classes in the signature
for i in onto.classes_in_signature():
# Performing type inference with Pellet
Expand Down Expand Up @@ -206,7 +205,7 @@ Check also the [examples](https://github.com/dice-group/owlapy/tree/develop/exam
<details><summary> Click me! </summary>

```python
from owlapy.owl_ontology_manager import SyncOntologyManager
from owlapy.owl_ontology import SyncOntology
from owlapy.util_owl_static_funcs import csv_to_rdf_kg
import pandas as pd
from sklearn.datasets import load_iris
Expand All @@ -216,7 +215,7 @@ df.to_csv("iris_dataset.csv", index=False)
path_kg = "iris_kg.owl"
# Construct an RDF Knowledge Graph from a CSV file
csv_to_rdf_kg(path_csv="iris_dataset.csv", path_kg=path_kg, namespace="http://owlapy.com/iris")
onto = SyncOntologyManager().load_ontology(path_kg)
onto = SyncOntology(path_kg)
assert len(onto.get_abox_axioms()) == 750

```
Expand Down
53 changes: 26 additions & 27 deletions docs/usage/further_resources.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,47 +17,46 @@ Your commitment is well appreciated!

## Questions

In case you have any question, please contact: `[email protected]`
or open an issue on our [GitHub issues page](https://github.com/dice-group/owlapy/issues).
In case you have any question or suggestion, please open an issue on our [GitHub issues page](https://github.com/dice-group/owlapy/issues).

## Coverage Report
The coverage report is generated using [coverage.py](https://coverage.readthedocs.io/en/7.6.1/).

```
Name Stmts Miss Cover Missing
----------------------------------------------------------------------------------
owlapy/__init__.py 6 0 100%
owlapy/__init__.py 5 0 100%
owlapy/abstracts/__init__.py 3 0 100%
owlapy/abstracts/abstract_owl_ontology.py 16 1 94% 151
owlapy/abstracts/abstract_owl_ontology_manager.py 10 1 90% 24
owlapy/abstracts/abstract_owl_reasoner.py 49 10 80% 409-417, 439, 464
owlapy/abstracts/abstract_owl_ontology.py 14 1 93% 143
owlapy/abstracts/abstract_owl_reasoner.py 49 14 71% 391-394, 409-417, 439, 464
owlapy/class_expression/__init__.py 9 0 100%
owlapy/class_expression/class_expression.py 34 3 91% 58, 62, 103
owlapy/class_expression/class_expression.py 38 3 92% 58, 62, 112
owlapy/class_expression/nary_boolean_expression.py 25 0 100%
owlapy/class_expression/owl_class.py 33 1 97% 44
owlapy/class_expression/restriction.py 313 27 91% 41, 49, 68, 71, 89, 171, 245-246, 303, 336, 342, 345, 419, 430, 439, 456, 502, 505, 582-583, 620, 663, 666, 706, 709, 758, 830
owlapy/class_expression/owl_class.py 33 0 100%
owlapy/class_expression/restriction.py 315 25 92% 41, 49, 68, 89, 173, 248-249, 307, 346, 434, 437, 442, 445, 462, 498, 509, 593-594, 632, 677, 724, 727, 767, 815, 851
owlapy/converter.py 420 174 59% 52-68, 75-76, 79, 82, 152, 157, 169, 176, 184, 277, 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, 621, 625-629
owlapy/iri.py 79 6 92% 54, 69, 82, 97, 128, 133
owlapy/iri.py 72 3 96% 75, 106, 111
owlapy/meta_classes.py 11 0 100%
owlapy/namespaces.py 27 3 89% 36, 40, 43
owlapy/owl_annotation.py 16 4 75% 16, 24, 42, 50
owlapy/owl_axiom.py 519 130 75% 39, 42, 45, 59, 111-113, 116, 136-138, 141, 144, 147-150, 153, 182-184, 187, 190, 193, 196-200, 203, 253-256, 261, 288, 291, 294, 332-335, 338-340, 343, 398-401, 404-406, 409, 536, 561-563, 566, 569, 572, 575, 578-581, 584, 623, 645-648, 652, 656, 674-675, 683, 692, 695-697, 700, 711, 734-738, 746, 754, 762, 765-767, 770, 787-789, 792, 795, 798-801, 804, 823-825, 828, 831, 834-837, 840, 859-861, 864, 867, 870-873, 876, 909, 986, 1019, 1045, 1074, 1077, 1092, 1104, 1117, 1130, 1173, 1186-1188, 1191, 1209
owlapy/owl_data_ranges.py 40 1 98% 46
owlapy/owl_datatype.py 20 2 90% 33-34
owlapy/owl_individual.py 20 1 95% 37
owlapy/owl_literal.py 286 66 77% 49, 77, 86, 90, 99, 103, 112, 116, 125, 129, 138, 142, 151, 155, 164, 169, 173, 203, 208, 217, 221, 244, 247-249, 258, 262, 288, 293, 302, 306, 311, 323, 329, 332-334, 337, 340, 346, 350, 355, 373, 378, 387, 391, 415, 420, 429, 433, 454, 459, 462-464, 467, 473, 477, 489-491, 494, 497-499, 502
owlapy/owl_object.py 29 4 86% 26, 81-83
owlapy/owl_ontology.py 1000 222 78% 99, 110-113, 116, 124, 142-148, 171, 179-182, 283-289, 312-321, 326-347, 367, 437, 440, 445-467, 472-482, 492-498, 510, 513-514, 554, 559-564, 574, 579, 596, 605-616, 621-636, 647, 652, 662, 674, 678, 714, 720, 731, 737, 742-766, 771-778, 807, 822-823, 841-844, 853, 861, 878, 890, 894, 907, 920, 928-929, 936-937, 942, 951-956, 963, 966-968, 971, 988, 992-993, 1017, 1020, 1023, 1026, 1029, 1036, 1074, 1083-1086, 1089-1092, 1097, 1100, 1140, 1150, 1166-1167, 1190-1191, 1270-1271, 1312, 1316, 1320, 1346, 1453, 1459, 1467
owlapy/owl_ontology_manager.py 66 19 71% 26, 37, 41, 54-55, 63, 82, 85-89, 100-103, 112, 129-133
owlapy/owl_property.py 69 11 84% 17, 24, 32, 40, 67, 76, 126, 158, 162, 174, 193
owlapy/owl_reasoner.py 845 131 84% 170, 182-184, 189-195, 202, 251-257, 263-265, 308-315, 341, 376-380, 406-409, 437-439, 441-443, 452, 465-467, 469-471, 478, 483-485, 505, 509-510, 523-525, 546, 591-593, 607-609, 627-628, 639-642, 645, 651, 675-684, 696, 701, 705, 753-756, 861-865, 887, 894, 904-908, 916-920, 961-967, 979, 1100-1102, 1202, 1334, 1349, 1364, 1506-1527, 1558, 1590
owlapy/owlapi_mapper.py 357 62 83% 30, 106, 125-126, 193-200, 206-209, 218, 222, 229, 236, 240, 244, 248, 252, 256, 260, 264, 268, 272, 276, 280, 285, 291, 295, 299, 312, 328, 340, 350, 361, 366, 376, 381, 398, 416, 431, 436, 442, 447, 451, 456, 461, 466, 471-479, 508-509
owlapy/parser.py 371 12 97% 316, 327, 400-401, 416, 656, 667, 751-752, 763, 779-780
owlapy/owl_axiom.py 539 57 89% 39, 42, 45, 59, 113, 150, 153, 193, 201, 204, 254-257, 265, 289, 295, 298, 301, 339-342, 349, 352, 407-410, 417, 420, 539, 542, 555, 591, 594, 601, 604, 643, 668, 676, 717, 731, 787, 790, 821, 824, 857, 860, 893, 896, 929, 1006, 1097, 1100, 1211, 1214, 1276, 1280, 1315
owlapy/owl_data_ranges.py 40 2 95% 46, 107
owlapy/owl_datatype.py 20 0 100%
owlapy/owl_individual.py 23 0 100%
owlapy/owl_literal.py 505 162 68% 101, 133, 135, 144-165, 176, 185-186, 208, 212, 221, 225, 234, 238, 247, 273, 277, 286, 290, 299, 303, 312, 316, 325, 329, 337, 341, 349, 353, 361, 365, 373, 377, 385, 390, 396, 400, 432, 436, 440-443, 450, 455, 460, 465, 470, 473-475, 496, 504, 507, 510, 513-515, 531-533, 541, 544, 547, 561-562, 569-570, 577-578, 584-585, 610, 615, 633, 646, 653, 656-658, 661, 674, 679, 692, 697, 702, 707, 710-712, 715-717, 744, 747-750, 765, 768, 778, 781, 790, 793, 796, 803, 806, 809, 821-837, 843, 846, 849, 855, 858, 861, 867, 870, 873, 879, 882, 885, 891, 894, 897, 904-906, 909, 912-914, 917
owlapy/owl_object.py 29 4 86% 26, 83-85
owlapy/owl_ontology.py 1086 225 79% 99, 110-113, 116, 124, 141-147, 170, 178-181, 282-288, 311-320, 325-346, 366, 436, 439, 444-466, 471-481, 491-497, 509, 512-513, 553, 558-563, 573, 578, 595, 604-615, 620-635, 646, 651, 661, 673, 677, 713, 719, 730, 736, 741-765, 770-777, 797, 809, 824-825, 848-851, 866, 883, 895, 899, 912, 925, 933-934, 941-942, 947, 956-961, 968, 971-973, 976, 986, 1011-1012, 1021, 1024, 1037, 1055, 1058, 1061, 1064, 1067, 1075, 1121, 1124-1127, 1164, 1183-1184, 1198, 1209, 1429, 1439, 1455-1456, 1479-1480, 1559-1560, 1601, 1605, 1609, 1635, 1742, 1748, 1756
owlapy/owl_property.py 72 11 85% 17, 24, 32, 40, 67, 76, 130, 162, 166, 178, 197
owlapy/owl_reasoner.py 843 150 82% 89, 110, 144, 156-158, 163-169, 174-176, 178-179, 183, 232-238, 244-246, 289-296, 322, 357-361, 387-390, 418-420, 422-424, 431-433, 435-436, 440, 453-455, 457-459, 464-466, 468-469, 473, 478-480, 500, 504-505, 518-520, 541, 586-588, 602-604, 622-623, 634-638, 641, 647, 671-680, 692, 697, 701, 749-752, 850-854, 872, 879, 889-893, 901-905, 946-952, 963, 1139, 1271, 1286, 1301, 1446-1470, 1501, 1533, 1554-1557
owlapy/owlapi_mapper.py 368 8 98% 206, 485-493
owlapy/parser.py 371 14 96% 316, 327, 400-401, 416, 656, 667, 751-752, 763, 779-780, 784-785
owlapy/providers.py 38 3 92% 41, 54, 56
owlapy/render.py 289 43 85% 78-113, 142-157, 175, 179, 185, 221, 230, 235, 240, 374, 378, 420, 429, 434, 439
owlapy/static_funcs.py 33 19 42% 21-26, 31-42, 57-59
owlapy/utils.py 794 304 62% 30-31, 54-58, 75-86, 229, 233, 237, 243, 249-253, 257-261, 265, 269, 273, 279, 283, 287, 291, 295, 301, 307, 313, 317, 321, 325, 329-332, 336-339, 343, 350, 365-367, 370-379, 382, 385, 388, 391, 394, 398-404, 408, 419, 423, 427, 431, 435, 439-443, 447-451, 455-459, 463-467, 471, 475, 479-484, 488-493, 497-502, 506, 510, 514-518, 522-526, 530-534, 538-542, 546-550, 554, 558-562, 566, 570-575, 579-584, 588-593, 597, 601-605, 610, 619, 623, 627, 631, 635, 639, 643, 647-652, 656-662, 666, 670, 674, 679, 684, 689, 693, 697, 701, 705, 709-712, 716-719, 723, 727, 731, 736, 741, 746, 750, 799, 801, 803, 805, 807, 811, 813, 816, 818, 835, 861, 917, 931-933, 941-942, 962, 984-985, 1005, 1042-1043, 1058-1059, 1076-1104, 1109, 1114, 1123-1152, 1157, 1162-1164, 1229-1247, 1260-1262, 1267-1271
owlapy/vocab.py 92 3 97% 32, 113-114
owlapy/render.py 305 51 83% 80-115, 144-159, 177, 181, 187, 223, 232, 237, 242, 376, 380, 387, 406, 422, 431, 436, 441, 523, 527, 532, 536, 541, 563
owlapy/scripts/owlapy_serve.py 95 10 89% 52, 58, 120-132
owlapy/static_funcs.py 33 19 42% 22-27, 32-43, 58-60
owlapy/util_owl_static_funcs.py 90 46 49% 50, 144-204, 209-212
owlapy/utils.py 794 340 57% 30-31, 54-58, 75-86, 229, 233, 237, 243, 249-253, 257-261, 265, 269, 273, 279, 283, 287, 291, 295, 301, 307, 313, 317, 321, 325, 329-332, 336-339, 343, 350, 365-367, 370-379, 382, 385, 388, 391, 394, 398-404, 408, 419, 423, 427, 431, 435, 439-443, 447-451, 455-459, 463-467, 471, 475, 479-484, 488-493, 497-502, 506, 510, 514-518, 522-526, 530-534, 538-542, 546-550, 554, 558-562, 566, 570-575, 579-584, 588-593, 597, 601-605, 610, 619, 623, 627, 631, 635, 639, 643, 647-652, 656-662, 666, 670, 674, 679, 684, 689, 693, 697, 701, 705, 709-712, 716-719, 723, 727, 731, 736, 741, 746, 750, 799, 801, 803, 805, 807, 811, 813, 816, 818, 835, 861, 917, 931-933, 941-942, 962, 984-985, 1005, 1042-1043, 1058-1059, 1076-1104, 1109, 1114, 1123-1152, 1157, 1162-1164, 1184-1194, 1197-1203, 1206-1217, 1220-1256, 1260-1262, 1267-1271
owlapy/vocab.py 102 3 97% 32, 123-124
----------------------------------------------------------------------------------
TOTAL 5919 1263 79%
TOTAL 6390 1332 79%
```
22 changes: 10 additions & 12 deletions docs/usage/main.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,23 +6,20 @@

**Publisher and maintainer:** [DICE](https://dice-research.org/) - data science research group of [Paderborn University](https://www.uni-paderborn.de/en/university).

**Contact**: [onto-learn@lists.uni-paderborn.de](mailto:onto-learn@lists.uni-paderborn.de)
**Contact**: [alkid@mail.uni-paderborn.de](mailto:alkid@mail.uni-paderborn.de)

**License:** MIT License

--------------------------------------------------------------------------------------------
## What is owlapy?
Owlapy is an open-source software library in python that is used to represent entities
in OWL 2 Web Ontology Language.

We identified the gap of having a library that will serve as a base structure
for representing OWL entities and for manipulating OWL Ontologies in python, and like that, owlapy was created. Owlapy
is loosely based on its java-counterpart, _owlapi_. Owlapy is currently utilized
by powerful libraries such as [Ontolearn](https://github.com/dice-group/Ontolearn)
and [OntoSample](https://github.com/alkidbaci/OntoSample).

Owlapy is the perfect choice for machine learning projects that are built in python and
focus on knowledge graphs and class expression learnings.
Owlapy is an open-source Python library designed for representing and manipulating OWL 2 ontologies, offering a robust
foundation for knowledge graph and class expression learning projects in machine learning. Inspired by [OWLAPI](https://github.com/owlcs/owlapi)
(which is also available to use in this library via synchronisation), Owlapy enables ontology creation,
modification, and reasoning while supporting OWL 2 Structural Specification, Functional-Style Syntax, and advanced
features such as parsing and rendering to Description Logics and Manchester syntax. With capabilities to convert OWL
expressions into SPARQL queries and interfaces for ontology and reasoning, Owlapy is a powerful tool used in powerful
libraries like [Ontolearn](https://github.com/dice-group/Ontolearn) and [OntoSample](https://github.com/alkidbaci/OntoSample).

---------------------------------------

Expand All @@ -40,10 +37,11 @@ including:
- Axioms
- Annotations
- Construct complex class expressions.
- Provide interfaces for OWL Ontology, Ontology manager and Reasoner.
- Provide interfaces for OWL Ontology and Reasoner.
- Convert owl expression to SPARQL queries.
- Render owl expression to Description Logics or Manchester syntax.
- Parse Description Logics or Manchester expression to owl expression.
- **Makes _OWLAPI_ available to be easily used in Python.**


## How to install?
Expand Down
Loading

0 comments on commit b96e8b6

Please sign in to comment.