fuzzy-dl-owl2 1.0.0__py3-none-any.whl → 1.0.2__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,38 @@
1
+ import ast
2
+ import datetime
3
+ import functools
4
+ import importlib
5
+ import importlib.util
6
+ import inspect
7
+ import os
8
+ import sys
9
+ import time
10
+ import types
11
+ import typing
12
+
13
+ from fuzzy_dl_owl2.fuzzydl.util.config_reader import ConfigReader
14
+ from fuzzy_dl_owl2.fuzzydl.util.util import Util
15
+
16
+ def recursion_unlimited(func: typing.Callable):
17
+ module: types.ModuleType = inspect.getmodule(func)
18
+
19
+ @functools.wraps(func)
20
+ def wrapper(*args, **kwargs):
21
+ orig_n: int = sys.getrecursionlimit()
22
+ while True:
23
+ try:
24
+ result = func(*args, **kwargs)
25
+ break
26
+ except RecursionError:
27
+ # since self.proposition is too long, change the recursion limit
28
+ n: int = sys.getrecursionlimit() * 2
29
+ sys.setrecursionlimit(n)
30
+ if ConfigReader.DEBUG_PRINT:
31
+ Util.debug(
32
+ f"Updating recursion limit for {module.__name__}:{func.__name__}() to {n}"
33
+ )
34
+ # reset recursion limit to its original value
35
+ sys.setrecursionlimit(orig_n)
36
+ return result
37
+
38
+ return wrapper
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
- Name: fuzzy_dl_owl2
3
- Version: 1.0.0
2
+ Name: fuzzy-dl-owl2
3
+ Version: 1.0.2
4
4
  Summary:
5
5
  License: CC-BY-SA-4.0
6
6
  Author: Giuseppe Filippone
@@ -12,10 +12,13 @@ Classifier: Programming Language :: Python :: 3.11
12
12
  Classifier: Programming Language :: Python :: 3.12
13
13
  Classifier: Programming Language :: Python :: 3.13
14
14
  Requires-Dist: gurobipy (>=12.0.0,<13.0.0)
15
+ Requires-Dist: networkx (>=3.3,<4.0)
15
16
  Requires-Dist: owlready2 (>=0.47,<0.48)
16
17
  Requires-Dist: pyowl2 (>=1.0.0,<2.0.0)
17
- Requires-Dist: pyparsing (>=3.1.1,<4.0.0)
18
- Requires-Dist: rdflib (>=7.1.1,<8.0.0)
18
+ Requires-Dist: pyparsing (>=3.2.3,<4.0.0)
19
+ Requires-Dist: rdflib (>=7.1.4,<8.0.0)
20
+ Requires-Dist: sortedcontainers (>=2.4.0,<3.0.0)
21
+ Requires-Dist: trycast (>=1.2.0,<2.0.0)
19
22
  Project-URL: Repository, https://github.com/giuseppefilippone/fuzzy_dl_owl2
20
23
  Description-Content-Type: text/markdown
21
24
 
@@ -38,7 +41,7 @@ Features:
38
41
  # Installation
39
42
 
40
43
  ```python
41
- pip install fuzzy-reasoner
44
+ pip install fuzzy-dl-owl2
42
45
  ```
43
46
 
44
47
 
@@ -53,6 +56,46 @@ Examples of supported Fuzzy Description Logic Constructs
53
56
 
54
57
 
55
58
 
59
+ # Directory dl-examples
60
+
61
+ The directory `dl-examples` contains a few examples of Knowledge Bases written using the Fuzzy Description Logic language.
62
+
63
+
64
+
65
+ # Configuration of the MILP solver
66
+
67
+ Since version 1.0.1 uses `Gurobi Optimizer` (see [gurobipy](https://support.gurobi.com/hc/en-us/articles/360044290292-How-do-I-install-Gurobi-for-Python)= for the Fuzzy DL reasoning, please create a GUROBI license to use this library.
68
+
69
+ For the configuration, create a `CONFIG.ini` file in the same directory used for the execution of the library.
70
+ Example of your execution directory:
71
+ ```text
72
+ your_directory
73
+ ├── CONFIG.ini
74
+ ├── your_file.py
75
+ ```
76
+
77
+ The file `CONFIG.ini` is structured as follows:
78
+ ```text
79
+ [DEFAULT]
80
+ debugPrint = False
81
+ relaxMilp = False
82
+ epsilon = 0.001
83
+ maxIndividuals = -1
84
+ showVersion = False
85
+ author = False
86
+ ```
87
+
88
+ | Configuration Variable | Description |
89
+ |----------------------|-----------------------------------|
90
+ | debugPrint | Enable/disable debugging |
91
+ | relaxMilp | Enable/disable MILP constraint relaxation. Important: The solution may be wrong by enabling this flag |
92
+ | epsilon | Define the precision of the solution. For instance, epsilon = 0.001 means that the solution will be calculated with an accuracy to the third decimal place |
93
+ | maxIndividuals | Define the maximal number of individuals to handle. The value -1 indicate that there is no maximum |
94
+ | showVersion | Enable/disable the version print of the library |
95
+ | author | Enable/disable the author print of the library |
96
+
97
+
98
+
56
99
  # Usage - Reasoning
57
100
 
58
101
  ## Knowledge base in example.fdl
@@ -102,9 +145,8 @@ fdl.translate_owl2ontology() # save example.fdl in the subdirectory "./results"
102
145
  # Project Structure
103
146
 
104
147
  ```text
105
- fuzzy_reasoner
148
+ fuzzy_dl_owl2
106
149
  ├── __init__.py
107
- ├── app.py
108
150
  ├── fuzzydl
109
151
  │   ├── __init__.py
110
152
  │   ├── assertion
@@ -177,7 +219,6 @@ fuzzy_reasoner
177
219
  │   │   ├── fuzzy_ontology_exception.py
178
220
  │   │   └── inconsistent_ontology_exception.py
179
221
  │   ├── feature_function.py
180
- │   ├── fuzzydl_to_owl2_java.py
181
222
  │   ├── fuzzydl_to_owl2.py
182
223
  │   ├── general_concept_inclusion.py
183
224
  │   ├── individual
@@ -253,8 +294,6 @@ fuzzy_reasoner
253
294
  │   └── utils.py
254
295
  └── fuzzyowl2
255
296
  ├── __init__.py
256
- ├── fuzzyowl2_java.py
257
- ├── fuzzyowl2_to_fuzzydl_java.py
258
297
  ├── fuzzyowl2_to_fuzzydl.py
259
298
  ├── fuzzyowl2.py
260
299
  ├── owl_types
@@ -63,7 +63,6 @@ fuzzy_dl_owl2/fuzzydl/exception/fuzzy_ontology_exception.py,sha256=eH1ybBCx1QoZa
63
63
  fuzzy_dl_owl2/fuzzydl/exception/inconsistent_ontology_exception.py,sha256=ez0RQN4KGlNRcfB7IXfPz3bM86CFLl6zo-RRTBRpa_o,129
64
64
  fuzzy_dl_owl2/fuzzydl/feature_function.py,sha256=MXN8rU5moY4dWfXlfEAokEiWl_dpmcyY6OZOSN_-RaI,5898
65
65
  fuzzy_dl_owl2/fuzzydl/fuzzydl_to_owl2.py,sha256=6W8RA5LZ-Y2XOuA_yGlDzP1Xot4WsBprTSBVPOouS14,44978
66
- fuzzy_dl_owl2/fuzzydl/fuzzydl_to_owl2_java.py,sha256=Lo5Jh8NLTyIhzurAczMBxOyQIFCiyDixx7cUDfbTI1Q,45091
67
66
  fuzzy_dl_owl2/fuzzydl/general_concept_inclusion.py,sha256=Noom35WAeJosPrliGd9_gvEtcK4BthazsSuZH-cxfyU,2380
68
67
  fuzzy_dl_owl2/fuzzydl/individual/__init__.py,sha256=zBCa24kE2nv08VgtphjLshpbGNEARUJgCdtyv9r6JGc,110
69
68
  fuzzy_dl_owl2/fuzzydl/individual/created_individual.py,sha256=HOo_UXjPPPtm7B0a7k90kE1veuR9gOCK5hp2f_aaJnY,7653
@@ -83,11 +82,8 @@ fuzzy_dl_owl2/fuzzydl/modifier/__init__.py,sha256=mgJml-9PVs566EYpwBxfmmiw8oPXiS
83
82
  fuzzy_dl_owl2/fuzzydl/modifier/linear_modifier.py,sha256=Rn6q4ytIdTiCI-TRZIK5qjWSA4K3q78fYSrYxlQklVc,2022
84
83
  fuzzy_dl_owl2/fuzzydl/modifier/modifier.py,sha256=K1QG_i0eePq49RqyPsOCYRKonmD1QFzE0WwyxOBnymo,816
85
84
  fuzzy_dl_owl2/fuzzydl/modifier/triangular_modifier.py,sha256=MAfQ0w91tc1fw0FCdxHyt-RHXoRKo8GOfwBqDoCpUVc,2115
86
- fuzzy_dl_owl2/fuzzydl/parser/ParserConstants.py,sha256=bGJjHMvN1w78uhs3M7rDWrIcacUrcK7BOKpQb97trgw,7628
87
85
  fuzzy_dl_owl2/fuzzydl/parser/__init__.py,sha256=vs0cN8a1ATeFx1J4evw6k7mWe4zOvba_xMO2eBXZ_gc,32
88
86
  fuzzy_dl_owl2/fuzzydl/parser/dl_parser.py,sha256=aJ8VfiAyfHLslKZCKtht4nu8izv7tE40v4Nw4C1VWCs,81810
89
- fuzzy_dl_owl2/fuzzydl/parser/ebnf.lark,sha256=4ZIsyczm9Xfx0VvIGWlGbbc0xPN-H1tsN946bhJvfkY,14524
90
- fuzzy_dl_owl2/fuzzydl/parser/larkx.py,sha256=q6opkO8Bqh9_yKSoMY1wfVT-Vcc2v4M-mkQo43qb1kQ,1439
91
87
  fuzzy_dl_owl2/fuzzydl/primitive_concept_definition.py,sha256=jQxEqwqt-VuP58i90gfzcOge-rI3BC9zvqXJgUA7eno,2331
92
88
  fuzzy_dl_owl2/fuzzydl/query/__init__.py,sha256=4952zUtxF3VDI4TWDkpYdayP71DSowCsJzYAc_fOyGY,405
93
89
  fuzzy_dl_owl2/fuzzydl/query/all_instances_query.py,sha256=IgCmHvYMiEW3MWSt-IOr42KXwz-hgCGCC6beSt-lgLM,1867
@@ -125,11 +121,10 @@ fuzzy_dl_owl2/fuzzydl/util/__init__.py,sha256=44tug6cK4CwfOR865-q1FOVN34TEDzfLla
125
121
  fuzzy_dl_owl2/fuzzydl/util/config_reader.py,sha256=TQyWZ1EMqS8WteJfHUqQG-aloyxaZ7TJd32ox1k_0CU,2063
126
122
  fuzzy_dl_owl2/fuzzydl/util/constants.py,sha256=PV6fSOk8rrVJ_7qnZ9xFCcjBxXpMH3mvHN83XpNaH4I,12749
127
123
  fuzzy_dl_owl2/fuzzydl/util/util.py,sha256=5COC79TAJz8fNrRzXLbNpAT9rLd_0KrRI1OU-hob3oU,1903
124
+ fuzzy_dl_owl2/fuzzydl/util/utils.py,sha256=h18QpDSRjitsVPta_zmRvHC8HUdfFwbFqol4oLANITs,1133
128
125
  fuzzy_dl_owl2/fuzzyowl2/__init__.py,sha256=C44P0-Sn35FQdVMqYLzeDWa5qPmokbcs8GPiD_zQaSg,153
129
126
  fuzzy_dl_owl2/fuzzyowl2/fuzzyowl2.py,sha256=xe98T3nowcOK2VJ6gZpJqTxwH0qhLzdQz3yeJbKzdJU,71313
130
- fuzzy_dl_owl2/fuzzyowl2/fuzzyowl2_java.py,sha256=doOKO57CflVr3z2t_H5flZ6pP8rf6AMJ9dsm3DAHBAw,64476
131
127
  fuzzy_dl_owl2/fuzzyowl2/fuzzyowl2_to_fuzzydl.py,sha256=yWMhk3mpAmGfLSg6buEo8pC2G-Jczy1pgiy3riaZsZY,37033
132
- fuzzy_dl_owl2/fuzzyowl2/fuzzyowl2_to_fuzzydl_java.py,sha256=m7jHxW6zi0Nn1apJ8vsoibboFl4wvfDfbxVXC5phvM4,38171
133
128
  fuzzy_dl_owl2/fuzzyowl2/owl_types/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
134
129
  fuzzy_dl_owl2/fuzzyowl2/owl_types/choquet_concept.py,sha256=ymnyNfvkvWA3y2UMXyPviD0U98vJ6jrX6zddj09SUoI,671
135
130
  fuzzy_dl_owl2/fuzzyowl2/owl_types/concept_definition.py,sha256=d5ZsEX8NN-aYJohXGzeJFhrnufCJ6AZ1YLGiclwysDc,324
@@ -161,7 +156,7 @@ fuzzy_dl_owl2/fuzzyowl2/parser/__init__.py,sha256=fKaME_uuWyG5UB7VKD-nMV-j95lC1j
161
156
  fuzzy_dl_owl2/fuzzyowl2/parser/owl2_parser.py,sha256=5eGyRbYUQNH5ZTKCjsOYOsw9Ode4lUl8eUNK4jQGZSs,19683
162
157
  fuzzy_dl_owl2/fuzzyowl2/util/__init__.py,sha256=81quoggCuIypZjZs3bbf1Ty70KHdva5RGEJxi0oC57E,25
163
158
  fuzzy_dl_owl2/fuzzyowl2/util/constants.py,sha256=05eQLYTB4CxxUZ_T-sNG9FsH8hkrBMAh2y24oiQN8xY,3904
164
- fuzzy_dl_owl2-1.0.0.dist-info/LICENSE,sha256=er4Z7Ju3OzYUG5mbhh0krYVegIuv4PgehMzihVb2wpc,20131
165
- fuzzy_dl_owl2-1.0.0.dist-info/METADATA,sha256=xz5Hw6uwVNJh-7hb4_xq1VOxUbUFJNT1agINRn5ImIc,11235
166
- fuzzy_dl_owl2-1.0.0.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
167
- fuzzy_dl_owl2-1.0.0.dist-info/RECORD,,
159
+ fuzzy_dl_owl2-1.0.2.dist-info/LICENSE,sha256=er4Z7Ju3OzYUG5mbhh0krYVegIuv4PgehMzihVb2wpc,20131
160
+ fuzzy_dl_owl2-1.0.2.dist-info/METADATA,sha256=UT7XY4U9-ZDxqYAB2NKl4hw7sBhFjKipW95ADW5d7pY,12777
161
+ fuzzy_dl_owl2-1.0.2.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
162
+ fuzzy_dl_owl2-1.0.2.dist-info/RECORD,,