ontolutils 0.2.17__tar.gz → 0.2.18__tar.gz
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.
- {ontolutils-0.2.17 → ontolutils-0.2.18}/PKG-INFO +1 -1
- {ontolutils-0.2.17 → ontolutils-0.2.18}/ontolutils/namespacelib/__dev.py +37 -29
- ontolutils-0.2.18/ontolutils/namespacelib/__init__.py +23 -0
- {ontolutils-0.2.17 → ontolutils-0.2.18}/ontolutils/namespacelib/m4i.py +2 -2
- {ontolutils-0.2.17 → ontolutils-0.2.18}/ontolutils/namespacelib/obo.py +2 -2
- {ontolutils-0.2.17 → ontolutils-0.2.18}/ontolutils/namespacelib/qudt_kind.py +1083 -1083
- {ontolutils-0.2.17 → ontolutils-0.2.18}/ontolutils/namespacelib/qudt_unit.py +2423 -2423
- {ontolutils-0.2.17 → ontolutils-0.2.18}/ontolutils/namespacelib/schema.py +2760 -2760
- {ontolutils-0.2.17 → ontolutils-0.2.18}/ontolutils/namespacelib/ssno.py +2 -2
- {ontolutils-0.2.17 → ontolutils-0.2.18}/ontolutils.egg-info/PKG-INFO +1 -1
- {ontolutils-0.2.17 → ontolutils-0.2.18}/ontolutils.egg-info/SOURCES.txt +0 -1
- {ontolutils-0.2.17 → ontolutils-0.2.18}/setup.cfg +1 -1
- ontolutils-0.2.17/ontolutils/namespacelib/__init__.py +0 -10
- ontolutils-0.2.17/ontolutils/namespacelib/pivmeta.py +0 -289
- {ontolutils-0.2.17 → ontolutils-0.2.18}/LICENSE +0 -0
- {ontolutils-0.2.17 → ontolutils-0.2.18}/README.md +0 -0
- {ontolutils-0.2.17 → ontolutils-0.2.18}/ontolutils/__init__.py +0 -0
- {ontolutils-0.2.17 → ontolutils-0.2.18}/ontolutils/_version.py +0 -0
- {ontolutils-0.2.17 → ontolutils-0.2.18}/ontolutils/cache.py +0 -0
- {ontolutils-0.2.17 → ontolutils-0.2.18}/ontolutils/classes/__init__.py +0 -0
- {ontolutils-0.2.17 → ontolutils-0.2.18}/ontolutils/classes/decorator.py +0 -0
- {ontolutils-0.2.17 → ontolutils-0.2.18}/ontolutils/classes/query_util.py +0 -0
- {ontolutils-0.2.17 → ontolutils-0.2.18}/ontolutils/classes/thing.py +0 -0
- {ontolutils-0.2.17 → ontolutils-0.2.18}/ontolutils/classes/typing.py +0 -0
- {ontolutils-0.2.17 → ontolutils-0.2.18}/ontolutils/classes/utils.py +0 -0
- {ontolutils-0.2.17 → ontolutils-0.2.18}/ontolutils/namespacelib/_iana_utils.py +0 -0
- {ontolutils-0.2.17 → ontolutils-0.2.18}/ontolutils/namespacelib/codemeta.py +0 -0
- {ontolutils-0.2.17 → ontolutils-0.2.18}/ontolutils.egg-info/dependency_links.txt +0 -0
- {ontolutils-0.2.17 → ontolutils-0.2.18}/ontolutils.egg-info/requires.txt +0 -0
- {ontolutils-0.2.17 → ontolutils-0.2.18}/ontolutils.egg-info/top_level.txt +0 -0
- {ontolutils-0.2.17 → ontolutils-0.2.18}/pyproject.toml +0 -0
- {ontolutils-0.2.17 → ontolutils-0.2.18}/setup.py +0 -0
- {ontolutils-0.2.17 → ontolutils-0.2.18}/tests/test_classes.py +0 -0
- {ontolutils-0.2.17 → ontolutils-0.2.18}/tests/test_decorator.py +0 -0
- {ontolutils-0.2.17 → ontolutils-0.2.18}/tests/test_namespaces.py +0 -0
- {ontolutils-0.2.17 → ontolutils-0.2.18}/tests/test_query.py +0 -0
- {ontolutils-0.2.17 → ontolutils-0.2.18}/tests/test_readme.py +0 -0
- {ontolutils-0.2.17 → ontolutils-0.2.18}/tests/test_typing.py +0 -0
- {ontolutils-0.2.17 → ontolutils-0.2.18}/tests/test_utils.py +0 -0
- {ontolutils-0.2.17 → ontolutils-0.2.18}/tests/test_version.py +0 -0
|
@@ -12,7 +12,7 @@ import pathlib
|
|
|
12
12
|
import requests
|
|
13
13
|
import warnings
|
|
14
14
|
from rdflib import Graph
|
|
15
|
-
from typing import Iterable, Dict, Union
|
|
15
|
+
from typing import Iterable, Dict, Union, Optional
|
|
16
16
|
|
|
17
17
|
from ontolutils import __version__
|
|
18
18
|
|
|
@@ -21,10 +21,11 @@ __package_dir__ = __this_dir__.parent / 'namespacelib'
|
|
|
21
21
|
|
|
22
22
|
FORCE_DOWNLOAD = True
|
|
23
23
|
|
|
24
|
+
|
|
24
25
|
def generate_namespace_file_from_ttl(namespace: str,
|
|
25
26
|
source: str,
|
|
26
27
|
ns: str,
|
|
27
|
-
target_dir: Union[str, pathlib.Path
|
|
28
|
+
target_dir: Optional[Union[str, pathlib.Path]] = None,
|
|
28
29
|
fail=True):
|
|
29
30
|
"""Generate M4I_NAMESPACE.py file from m4i_context.jsonld
|
|
30
31
|
"""
|
|
@@ -68,9 +69,10 @@ def generate_namespace_file_from_ttl(namespace: str,
|
|
|
68
69
|
|
|
69
70
|
def generate_namespace_file_from_context(namespace: str,
|
|
70
71
|
context_ld: str,
|
|
71
|
-
languages: Dict[str, Iterable[str]] = None,
|
|
72
|
-
target_dir: Union[str, pathlib.Path
|
|
73
|
-
fail=True
|
|
72
|
+
languages: Optional[Dict[str, Iterable[str]]] = None,
|
|
73
|
+
target_dir: Optional[Union[str, pathlib.Path]] = None,
|
|
74
|
+
fail: bool = True,
|
|
75
|
+
filename: Optional[Union[str, pathlib.Path]] = None):
|
|
74
76
|
"""Generate M4I_NAMESPACE.py file from m4i_context.jsonld"""
|
|
75
77
|
languages = languages or {}
|
|
76
78
|
assert isinstance(languages, dict)
|
|
@@ -110,13 +112,18 @@ def generate_namespace_file_from_context(namespace: str,
|
|
|
110
112
|
target_dir = pathlib.Path(target_dir)
|
|
111
113
|
|
|
112
114
|
fields = []
|
|
113
|
-
|
|
115
|
+
|
|
116
|
+
if filename is None:
|
|
117
|
+
filename = target_dir / f'{namespace}.py'
|
|
118
|
+
else:
|
|
119
|
+
filename = pathlib.Path(filename)
|
|
120
|
+
with open(filename, 'w',
|
|
114
121
|
encoding='UTF8') as f:
|
|
115
122
|
f.write('from rdflib.namespace import DefinedNamespace, Namespace\n')
|
|
116
123
|
f.write('from rdflib.term import URIRef\n')
|
|
117
124
|
f.write('\n\nclass LanguageExtension:\n pass')
|
|
118
125
|
f.write(f'\n\nclass {namespace.upper()}(DefinedNamespace):')
|
|
119
|
-
f.write('\n # uri = "
|
|
126
|
+
f.write(f'\n # uri = "{url}"')
|
|
120
127
|
f.write(f'\n # Generated with {__package__} version {__version__}')
|
|
121
128
|
f.write(f'\n # Date: {datetime.datetime.now()}')
|
|
122
129
|
f.write(f'\n _fail = {fail}')
|
|
@@ -148,7 +155,7 @@ def generate_namespace_file_from_context(namespace: str,
|
|
|
148
155
|
|
|
149
156
|
for lang in languages:
|
|
150
157
|
f.write(f'\n\nsetattr({namespace.upper()}, "{lang}", {lang})')
|
|
151
|
-
|
|
158
|
+
context_file.unlink(missing_ok=True)
|
|
152
159
|
|
|
153
160
|
|
|
154
161
|
def m4i():
|
|
@@ -284,10 +291,11 @@ def schema():
|
|
|
284
291
|
)
|
|
285
292
|
|
|
286
293
|
|
|
287
|
-
def pivmeta():
|
|
294
|
+
def pivmeta(filename: Union[str, pathlib.Path] = None):
|
|
288
295
|
generate_namespace_file_from_context(
|
|
289
296
|
namespace='pivmeta',
|
|
290
297
|
context_ld='https://raw.githubusercontent.com/matthiasprobst/pivmeta/main/pivmeta_context.jsonld',
|
|
298
|
+
filename=filename
|
|
291
299
|
)
|
|
292
300
|
|
|
293
301
|
|
|
@@ -307,35 +315,35 @@ def codemeta():
|
|
|
307
315
|
|
|
308
316
|
def build_namespace_files():
|
|
309
317
|
"""Call this only if you are a developer and want to build the namespace files"""
|
|
310
|
-
with open(__package_dir__ / '__init__.py', 'w') as f:
|
|
311
|
-
|
|
318
|
+
# with open(__package_dir__ / '__init__.py', 'w') as f:
|
|
319
|
+
# f.write('"""Auto-generated file. Do not edit!"""\n')
|
|
312
320
|
# f.write('from ._version import __version__\n')
|
|
313
321
|
|
|
314
|
-
|
|
315
|
-
m4i()
|
|
322
|
+
m4i()
|
|
316
323
|
|
|
317
|
-
|
|
324
|
+
obo()
|
|
318
325
|
|
|
319
|
-
|
|
326
|
+
qudt_unit()
|
|
320
327
|
|
|
321
|
-
|
|
328
|
+
qudt_quantitykind()
|
|
322
329
|
|
|
323
|
-
|
|
330
|
+
# pivmeta()
|
|
324
331
|
|
|
325
|
-
|
|
332
|
+
codemeta()
|
|
326
333
|
|
|
327
|
-
|
|
334
|
+
schema()
|
|
328
335
|
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
336
|
+
ssno()
|
|
337
|
+
# with open(__package_dir__ / '__init__.py', 'a') as f:
|
|
338
|
+
# f.write('from .m4i import M4I\n')
|
|
339
|
+
# f.write('from .obo import OBO\n')
|
|
340
|
+
# f.write('from .pivmeta import PIVMETA\n')
|
|
341
|
+
# f.write('from .codemeta import CODEMETA\n')
|
|
342
|
+
# f.write('from .qudt_unit import QUDT_UNIT\n')
|
|
343
|
+
# f.write('from .qudt_kind import QUDT_KIND\n')
|
|
344
|
+
# f.write('from .schema import SCHEMA\n')
|
|
345
|
+
# f.write('from .ssno import SSNO\n')
|
|
346
|
+
# f.write('from ._iana_utils import IANA\n')
|
|
339
347
|
|
|
340
348
|
for jld in __package_dir__.glob('*.jsonld'):
|
|
341
349
|
jld.unlink()
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"""Auto-generated file. Do not edit!"""
|
|
2
|
+
import sys
|
|
3
|
+
|
|
4
|
+
from . import __dev
|
|
5
|
+
from ._iana_utils import IANA
|
|
6
|
+
from .codemeta import CODEMETA
|
|
7
|
+
from .m4i import M4I
|
|
8
|
+
from .obo import OBO
|
|
9
|
+
from .qudt_kind import QUDT_KIND
|
|
10
|
+
from .qudt_unit import QUDT_UNIT
|
|
11
|
+
from .schema import SCHEMA
|
|
12
|
+
from .ssno import SSNO
|
|
13
|
+
from ..cache import package_user_dir
|
|
14
|
+
|
|
15
|
+
# create pivmeta module in local user directory
|
|
16
|
+
__dev.pivmeta(filename=package_user_dir / 'pivmeta.py')
|
|
17
|
+
|
|
18
|
+
sys.path.insert(0, str(package_user_dir))
|
|
19
|
+
|
|
20
|
+
# noinspection PyUnresolvedReferences
|
|
21
|
+
from pivmeta import PIVMETA
|
|
22
|
+
|
|
23
|
+
assert PIVMETA._NS == 'https://matthiasprobst.github.io/pivmeta#'
|
|
@@ -7,8 +7,8 @@ class LanguageExtension:
|
|
|
7
7
|
|
|
8
8
|
class M4I(DefinedNamespace):
|
|
9
9
|
# uri = "https://w3id.org/nfdi4ing/metadata4ing#"
|
|
10
|
-
# Generated with None version 0.2.
|
|
11
|
-
# Date: 2024-
|
|
10
|
+
# Generated with None version 0.2.10
|
|
11
|
+
# Date: 2024-03-24 15:10:44.476048
|
|
12
12
|
_fail = True
|
|
13
13
|
Method: URIRef # ['Methode', 'method']
|
|
14
14
|
NumericalAssignment: URIRef # ['numerical assignment', 'numerische Zuweisung']
|
|
@@ -7,8 +7,8 @@ class LanguageExtension:
|
|
|
7
7
|
|
|
8
8
|
class OBO(DefinedNamespace):
|
|
9
9
|
# uri = "https://w3id.org/nfdi4ing/metadata4ing#"
|
|
10
|
-
# Generated with None version 0.2.
|
|
11
|
-
# Date: 2024-
|
|
10
|
+
# Generated with None version 0.2.10
|
|
11
|
+
# Date: 2024-03-24 15:10:45.600748
|
|
12
12
|
_fail = True
|
|
13
13
|
BFO_0000015: URIRef # ['Prozess', 'process']
|
|
14
14
|
BFO_0000017: URIRef # ['realisierbare Entität', 'realizable entity']
|