ogc-na 0.3.44__tar.gz → 0.3.45__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.
Potentially problematic release.
This version of ogc-na might be problematic. Click here for more details.
- {ogc_na-0.3.44 → ogc_na-0.3.45}/PKG-INFO +1 -1
- {ogc_na-0.3.44 → ogc_na-0.3.45}/ogc/na/_version.py +2 -2
- {ogc_na-0.3.44 → ogc_na-0.3.45}/ogc/na/annotate_schema.py +21 -9
- {ogc_na-0.3.44 → ogc_na-0.3.45}/ogc_na.egg-info/PKG-INFO +1 -1
- {ogc_na-0.3.44 → ogc_na-0.3.45}/.github/workflows/mkdocs.yml +0 -0
- {ogc_na-0.3.44 → ogc_na-0.3.45}/.github/workflows/python-publish.yml +0 -0
- {ogc_na-0.3.44 → ogc_na-0.3.45}/.gitignore +0 -0
- {ogc_na-0.3.44 → ogc_na-0.3.45}/MANIFEST.in +0 -0
- {ogc_na-0.3.44 → ogc_na-0.3.45}/README.md +0 -0
- {ogc_na-0.3.44 → ogc_na-0.3.45}/docs/examples.md +0 -0
- {ogc_na-0.3.44 → ogc_na-0.3.45}/docs/gen_ref_pages.py +0 -0
- {ogc_na-0.3.44 → ogc_na-0.3.45}/docs/index.md +0 -0
- {ogc_na-0.3.44 → ogc_na-0.3.45}/docs/jsonld-uplift.md +0 -0
- {ogc_na-0.3.44 → ogc_na-0.3.45}/docs/tutorials.md +0 -0
- {ogc_na-0.3.44 → ogc_na-0.3.45}/mkdocs.yml +0 -0
- {ogc_na-0.3.44 → ogc_na-0.3.45}/ogc/na/__init__.py +0 -0
- {ogc_na-0.3.44 → ogc_na-0.3.45}/ogc/na/domain_config.py +0 -0
- {ogc_na-0.3.44 → ogc_na-0.3.45}/ogc/na/download.py +0 -0
- {ogc_na-0.3.44 → ogc_na-0.3.45}/ogc/na/gsp.py +0 -0
- {ogc_na-0.3.44 → ogc_na-0.3.45}/ogc/na/ingest_json.py +0 -0
- {ogc_na-0.3.44 → ogc_na-0.3.45}/ogc/na/input_filters/__init__.py +0 -0
- {ogc_na-0.3.44 → ogc_na-0.3.45}/ogc/na/input_filters/csv.py +0 -0
- {ogc_na-0.3.44 → ogc_na-0.3.45}/ogc/na/input_filters/xml.py +0 -0
- {ogc_na-0.3.44 → ogc_na-0.3.45}/ogc/na/models.py +0 -0
- {ogc_na-0.3.44 → ogc_na-0.3.45}/ogc/na/profile.py +0 -0
- {ogc_na-0.3.44 → ogc_na-0.3.45}/ogc/na/provenance.py +0 -0
- {ogc_na-0.3.44 → ogc_na-0.3.45}/ogc/na/update_vocabs.py +0 -0
- {ogc_na-0.3.44 → ogc_na-0.3.45}/ogc/na/util.py +0 -0
- {ogc_na-0.3.44 → ogc_na-0.3.45}/ogc/na/validation.py +0 -0
- {ogc_na-0.3.44 → ogc_na-0.3.45}/ogc_na.egg-info/SOURCES.txt +0 -0
- {ogc_na-0.3.44 → ogc_na-0.3.45}/ogc_na.egg-info/dependency_links.txt +0 -0
- {ogc_na-0.3.44 → ogc_na-0.3.45}/ogc_na.egg-info/requires.txt +0 -0
- {ogc_na-0.3.44 → ogc_na-0.3.45}/ogc_na.egg-info/top_level.txt +0 -0
- {ogc_na-0.3.44 → ogc_na-0.3.45}/pyproject.toml +0 -0
- {ogc_na-0.3.44 → ogc_na-0.3.45}/rdf/catalog-v001.xml +0 -0
- {ogc_na-0.3.44 → ogc_na-0.3.45}/rdf/domaincfg.vocab.ttl +0 -0
- {ogc_na-0.3.44 → ogc_na-0.3.45}/requirements.txt +0 -0
- {ogc_na-0.3.44 → ogc_na-0.3.45}/setup.cfg +0 -0
- {ogc_na-0.3.44 → ogc_na-0.3.45}/setup.py +0 -0
- {ogc_na-0.3.44 → ogc_na-0.3.45}/test/__init__.py +0 -0
- {ogc_na-0.3.44 → ogc_na-0.3.45}/test/data/empty.ttl +0 -0
- {ogc_na-0.3.44 → ogc_na-0.3.45}/test/data/headers.csv +0 -0
- {ogc_na-0.3.44 → ogc_na-0.3.45}/test/data/no-headers.csv +0 -0
- {ogc_na-0.3.44 → ogc_na-0.3.45}/test/data/profile_tree.ttl +0 -0
- {ogc_na-0.3.44 → ogc_na-0.3.45}/test/data/profile_tree_cyclic.ttl +0 -0
- {ogc_na-0.3.44 → ogc_na-0.3.45}/test/data/sample-context.jsonld +0 -0
- {ogc_na-0.3.44 → ogc_na-0.3.45}/test/data/sample-schema-prop-c.yml +0 -0
- {ogc_na-0.3.44 → ogc_na-0.3.45}/test/data/sample-schema.yml +0 -0
- {ogc_na-0.3.44 → ogc_na-0.3.45}/test/data/schema-vocab.yml +0 -0
- {ogc_na-0.3.44 → ogc_na-0.3.45}/test/data/uplift_context_valid.yml +0 -0
- {ogc_na-0.3.44 → ogc_na-0.3.45}/test/test_annotate_schema.py +0 -0
- {ogc_na-0.3.44 → ogc_na-0.3.45}/test/test_ingest_json.py +0 -0
- {ogc_na-0.3.44 → ogc_na-0.3.45}/test/test_input_filters_csv.py +0 -0
- {ogc_na-0.3.44 → ogc_na-0.3.45}/test/test_profile.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: ogc_na
|
|
3
|
-
Version: 0.3.
|
|
3
|
+
Version: 0.3.45
|
|
4
4
|
Summary: OGC Naming Authority tools
|
|
5
5
|
Author-email: Rob Atkinson <ratkinson@ogc.org>, Piotr Zaborowski <pzaborowski@ogc.org>, Alejandro Villar <avillar@ogc.org>
|
|
6
6
|
Project-URL: Homepage, https://github.com/opengeospatial/ogc-na-tools/
|
|
@@ -122,7 +122,6 @@ import json
|
|
|
122
122
|
import logging
|
|
123
123
|
import re
|
|
124
124
|
import sys
|
|
125
|
-
from collections import deque
|
|
126
125
|
from operator import attrgetter
|
|
127
126
|
from pathlib import Path
|
|
128
127
|
from typing import Any, AnyStr, Callable, Sequence, Iterable
|
|
@@ -147,6 +146,8 @@ ANNOTATION_IGNORE_EXPAND = [ANNOTATION_CONTEXT, ANNOTATION_EXTRA_TERMS, ANNOTATI
|
|
|
147
146
|
|
|
148
147
|
CURIE_TERMS = '@id', '@type', '@index'
|
|
149
148
|
|
|
149
|
+
UNDEFINED = object()
|
|
150
|
+
|
|
150
151
|
context_term_cache = LRUCache(maxsize=20)
|
|
151
152
|
requests_session = requests_cache.CachedSession('ogc.na.annotate_schema', backend='memory', expire_after=180)
|
|
152
153
|
|
|
@@ -347,6 +348,8 @@ def resolve_context(ctx: Path | str | dict | list, expand_uris=True) -> Resolved
|
|
|
347
348
|
prefix, localpart = curie.split(':', 1)
|
|
348
349
|
else:
|
|
349
350
|
prefix, localpart = None, None
|
|
351
|
+
|
|
352
|
+
vocab = UNDEFINED
|
|
350
353
|
for c in reversed(ctx_stack):
|
|
351
354
|
if localpart:
|
|
352
355
|
# prefix:localpart format
|
|
@@ -355,9 +358,11 @@ def resolve_context(ctx: Path | str | dict | list, expand_uris=True) -> Resolved
|
|
|
355
358
|
prefix_uri = term_val if isinstance(term_val, str) else term_val.get('@id')
|
|
356
359
|
prefixes[prefix] = prefix_uri
|
|
357
360
|
return f"{prefix_uri}{localpart}"
|
|
358
|
-
elif '@vocab' in c:
|
|
359
|
-
# look for @vocab
|
|
360
|
-
|
|
361
|
+
elif '@vocab' in c and vocab is UNDEFINED:
|
|
362
|
+
# look for @vocab unless it has been overridden (e.g. set to null) somewhere down the chain
|
|
363
|
+
vocab = c['@vocab']
|
|
364
|
+
if isinstance(vocab, str):
|
|
365
|
+
return f"{c['@vocab']}{curie}"
|
|
361
366
|
|
|
362
367
|
return curie
|
|
363
368
|
|
|
@@ -389,7 +394,11 @@ def resolve_context(ctx: Path | str | dict | list, expand_uris=True) -> Resolved
|
|
|
389
394
|
resolved_ctx = {}
|
|
390
395
|
inner_prefixes = {}
|
|
391
396
|
for ctx_entry in inner_ctx:
|
|
392
|
-
|
|
397
|
+
if isinstance(ctx_entry, dict):
|
|
398
|
+
# Array entries must be wrapped with @context
|
|
399
|
+
resolved_entry = resolve_context({'@context': ctx_entry})
|
|
400
|
+
else:
|
|
401
|
+
resolved_entry = resolve_context(ctx_entry)
|
|
393
402
|
inner_prefixes.update(resolved_entry.prefixes)
|
|
394
403
|
resolved = ResolvedContext(merge_dicts(resolved_entry.context, resolved_ctx), inner_prefixes)
|
|
395
404
|
else:
|
|
@@ -482,8 +491,10 @@ class SchemaAnnotator:
|
|
|
482
491
|
updated_refs: set[int] = set()
|
|
483
492
|
|
|
484
493
|
def find_prop_context(prop, context_stack) -> dict | None:
|
|
494
|
+
vocab = UNDEFINED
|
|
485
495
|
for ctx in reversed(context_stack):
|
|
486
|
-
vocab
|
|
496
|
+
if vocab is UNDEFINED and '@vocab' in ctx:
|
|
497
|
+
vocab = ctx.get('@vocab')
|
|
487
498
|
if prop in ctx:
|
|
488
499
|
prop_ctx = ctx[prop]
|
|
489
500
|
if isinstance(prop_ctx, str):
|
|
@@ -501,7 +512,7 @@ class SchemaAnnotator:
|
|
|
501
512
|
elif ':' not in prop_id and prop_id not in JSON_LD_KEYWORDS:
|
|
502
513
|
result['@id'] = f"{vocab}{prop_id}"
|
|
503
514
|
return result
|
|
504
|
-
elif
|
|
515
|
+
elif isinstance(vocab, str):
|
|
505
516
|
return {'@id': f"{ctx['@vocab']}{prop}"}
|
|
506
517
|
|
|
507
518
|
def process_properties(obj: dict, context_stack: list[dict[str, Any]],
|
|
@@ -862,8 +873,9 @@ class ContextBuilder:
|
|
|
862
873
|
if isinstance(term_value, str):
|
|
863
874
|
branch[term] = compact_uri(term_value)
|
|
864
875
|
elif isinstance(term_value, dict):
|
|
865
|
-
|
|
866
|
-
|
|
876
|
+
for k in CURIE_TERMS:
|
|
877
|
+
if k in term_value:
|
|
878
|
+
term_value[k] = compact_uri(term_value[k])
|
|
867
879
|
if len(term_value) == 1 and '@id' in term_value:
|
|
868
880
|
branch[term] = term_value['@id']
|
|
869
881
|
elif '@context' in term_value:
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: ogc_na
|
|
3
|
-
Version: 0.3.
|
|
3
|
+
Version: 0.3.45
|
|
4
4
|
Summary: OGC Naming Authority tools
|
|
5
5
|
Author-email: Rob Atkinson <ratkinson@ogc.org>, Piotr Zaborowski <pzaborowski@ogc.org>, Alejandro Villar <avillar@ogc.org>
|
|
6
6
|
Project-URL: Homepage, https://github.com/opengeospatial/ogc-na-tools/
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|