ogc-na 0.3.48__tar.gz → 0.3.50__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.48 → ogc_na-0.3.50}/PKG-INFO +1 -1
- {ogc_na-0.3.48 → ogc_na-0.3.50}/ogc/na/_version.py +2 -2
- {ogc_na-0.3.48 → ogc_na-0.3.50}/ogc/na/annotate_schema.py +35 -15
- {ogc_na-0.3.48 → ogc_na-0.3.50}/ogc/na/util.py +3 -0
- {ogc_na-0.3.48 → ogc_na-0.3.50}/ogc_na.egg-info/PKG-INFO +1 -1
- {ogc_na-0.3.48 → ogc_na-0.3.50}/.github/workflows/mkdocs.yml +0 -0
- {ogc_na-0.3.48 → ogc_na-0.3.50}/.github/workflows/python-publish.yml +0 -0
- {ogc_na-0.3.48 → ogc_na-0.3.50}/.gitignore +0 -0
- {ogc_na-0.3.48 → ogc_na-0.3.50}/MANIFEST.in +0 -0
- {ogc_na-0.3.48 → ogc_na-0.3.50}/README.md +0 -0
- {ogc_na-0.3.48 → ogc_na-0.3.50}/docs/examples.md +0 -0
- {ogc_na-0.3.48 → ogc_na-0.3.50}/docs/gen_ref_pages.py +0 -0
- {ogc_na-0.3.48 → ogc_na-0.3.50}/docs/index.md +0 -0
- {ogc_na-0.3.48 → ogc_na-0.3.50}/docs/jsonld-uplift.md +0 -0
- {ogc_na-0.3.48 → ogc_na-0.3.50}/docs/tutorials.md +0 -0
- {ogc_na-0.3.48 → ogc_na-0.3.50}/mkdocs.yml +0 -0
- {ogc_na-0.3.48 → ogc_na-0.3.50}/ogc/na/__init__.py +0 -0
- {ogc_na-0.3.48 → ogc_na-0.3.50}/ogc/na/domain_config.py +0 -0
- {ogc_na-0.3.48 → ogc_na-0.3.50}/ogc/na/download.py +0 -0
- {ogc_na-0.3.48 → ogc_na-0.3.50}/ogc/na/gsp.py +0 -0
- {ogc_na-0.3.48 → ogc_na-0.3.50}/ogc/na/ingest_json.py +0 -0
- {ogc_na-0.3.48 → ogc_na-0.3.50}/ogc/na/input_filters/__init__.py +0 -0
- {ogc_na-0.3.48 → ogc_na-0.3.50}/ogc/na/input_filters/csv.py +0 -0
- {ogc_na-0.3.48 → ogc_na-0.3.50}/ogc/na/input_filters/xml.py +0 -0
- {ogc_na-0.3.48 → ogc_na-0.3.50}/ogc/na/models.py +0 -0
- {ogc_na-0.3.48 → ogc_na-0.3.50}/ogc/na/profile.py +0 -0
- {ogc_na-0.3.48 → ogc_na-0.3.50}/ogc/na/provenance.py +0 -0
- {ogc_na-0.3.48 → ogc_na-0.3.50}/ogc/na/update_vocabs.py +0 -0
- {ogc_na-0.3.48 → ogc_na-0.3.50}/ogc/na/validation.py +0 -0
- {ogc_na-0.3.48 → ogc_na-0.3.50}/ogc_na.egg-info/SOURCES.txt +0 -0
- {ogc_na-0.3.48 → ogc_na-0.3.50}/ogc_na.egg-info/dependency_links.txt +0 -0
- {ogc_na-0.3.48 → ogc_na-0.3.50}/ogc_na.egg-info/requires.txt +0 -0
- {ogc_na-0.3.48 → ogc_na-0.3.50}/ogc_na.egg-info/top_level.txt +0 -0
- {ogc_na-0.3.48 → ogc_na-0.3.50}/pyproject.toml +0 -0
- {ogc_na-0.3.48 → ogc_na-0.3.50}/rdf/catalog-v001.xml +0 -0
- {ogc_na-0.3.48 → ogc_na-0.3.50}/rdf/domaincfg.vocab.ttl +0 -0
- {ogc_na-0.3.48 → ogc_na-0.3.50}/requirements.txt +0 -0
- {ogc_na-0.3.48 → ogc_na-0.3.50}/setup.cfg +0 -0
- {ogc_na-0.3.48 → ogc_na-0.3.50}/setup.py +0 -0
- {ogc_na-0.3.48 → ogc_na-0.3.50}/test/__init__.py +0 -0
- {ogc_na-0.3.48 → ogc_na-0.3.50}/test/data/empty.ttl +0 -0
- {ogc_na-0.3.48 → ogc_na-0.3.50}/test/data/headers.csv +0 -0
- {ogc_na-0.3.48 → ogc_na-0.3.50}/test/data/no-headers.csv +0 -0
- {ogc_na-0.3.48 → ogc_na-0.3.50}/test/data/profile_tree.ttl +0 -0
- {ogc_na-0.3.48 → ogc_na-0.3.50}/test/data/profile_tree_cyclic.ttl +0 -0
- {ogc_na-0.3.48 → ogc_na-0.3.50}/test/data/sample-context.jsonld +0 -0
- {ogc_na-0.3.48 → ogc_na-0.3.50}/test/data/sample-schema-prop-c.yml +0 -0
- {ogc_na-0.3.48 → ogc_na-0.3.50}/test/data/sample-schema.yml +0 -0
- {ogc_na-0.3.48 → ogc_na-0.3.50}/test/data/schema-vocab.yml +0 -0
- {ogc_na-0.3.48 → ogc_na-0.3.50}/test/data/uplift_context_valid.yml +0 -0
- {ogc_na-0.3.48 → ogc_na-0.3.50}/test/test_annotate_schema.py +0 -0
- {ogc_na-0.3.48 → ogc_na-0.3.50}/test/test_ingest_json.py +0 -0
- {ogc_na-0.3.48 → ogc_na-0.3.50}/test/test_input_filters_csv.py +0 -0
- {ogc_na-0.3.48 → ogc_na-0.3.50}/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.50
|
|
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/
|
|
@@ -117,6 +117,7 @@ from __future__ import annotations
|
|
|
117
117
|
|
|
118
118
|
import argparse
|
|
119
119
|
import csv
|
|
120
|
+
import copy
|
|
120
121
|
import dataclasses
|
|
121
122
|
import json
|
|
122
123
|
import logging
|
|
@@ -147,7 +148,12 @@ ANNOTATION_IGNORE_EXPAND = [ANNOTATION_CONTEXT, ANNOTATION_EXTRA_TERMS, ANNOTATI
|
|
|
147
148
|
|
|
148
149
|
CURIE_TERMS = '@id', '@type', '@index'
|
|
149
150
|
|
|
150
|
-
|
|
151
|
+
class Undefined:
|
|
152
|
+
|
|
153
|
+
def __bool__(self):
|
|
154
|
+
return False
|
|
155
|
+
|
|
156
|
+
UNDEFINED = Undefined()
|
|
151
157
|
|
|
152
158
|
context_term_cache = LRUCache(maxsize=20)
|
|
153
159
|
requests_session = requests_cache.CachedSession('ogc.na.annotate_schema', backend='memory', expire_after=180)
|
|
@@ -723,24 +729,29 @@ class ContextBuilder:
|
|
|
723
729
|
self.visited_properties[full_property_path_str] = prop_context['@id']
|
|
724
730
|
self._missed_properties[full_property_path_str] = False
|
|
725
731
|
if prop_context['@id'] == '@nest':
|
|
726
|
-
process_subschema(prop_val, from_schema,
|
|
732
|
+
merge_contexts(onto_context, process_subschema(prop_val, from_schema, full_property_path))
|
|
727
733
|
else:
|
|
728
|
-
|
|
734
|
+
merge_contexts(prop_context['@context'],
|
|
735
|
+
process_subschema(prop_val, from_schema, full_property_path))
|
|
729
736
|
if prop not in onto_context or isinstance(onto_context[prop], str):
|
|
730
737
|
onto_context[prop] = prop_context
|
|
731
738
|
else:
|
|
732
739
|
merge_contexts(onto_context[prop], prop_context)
|
|
733
740
|
else:
|
|
734
|
-
process_subschema(prop_val, from_schema,
|
|
741
|
+
merge_contexts(onto_context, process_subschema(prop_val, from_schema, full_property_path))
|
|
735
742
|
|
|
736
743
|
imported_prefixes: dict[str | Path, dict[str, str]] = {}
|
|
737
744
|
imported_extra_terms: dict[str | Path, dict[str, str]] = {}
|
|
738
745
|
|
|
739
|
-
|
|
740
|
-
|
|
746
|
+
cached_schema_contexts = {}
|
|
747
|
+
|
|
748
|
+
def process_subschema(subschema: dict, from_schema: ReferencedSchema,
|
|
749
|
+
schema_path: list[str]) -> dict:
|
|
750
|
+
|
|
751
|
+
onto_context = {}
|
|
741
752
|
|
|
742
753
|
if not isinstance(subschema, dict):
|
|
743
|
-
return
|
|
754
|
+
return {}
|
|
744
755
|
|
|
745
756
|
if subschema.get(ANNOTATION_BASE):
|
|
746
757
|
onto_context['@base'] = subschema[ANNOTATION_BASE]
|
|
@@ -753,24 +764,25 @@ class ContextBuilder:
|
|
|
753
764
|
processed_refs.add(ref_path_str)
|
|
754
765
|
referenced_schema = self.schema_resolver.resolve_schema(ref, from_schema)
|
|
755
766
|
if referenced_schema:
|
|
756
|
-
|
|
757
|
-
|
|
767
|
+
ref_ctx = copy.deepcopy(cached_schema_contexts.get(ref_path_str))
|
|
768
|
+
if ref_ctx is None:
|
|
769
|
+
ref_ctx = process_subschema(referenced_schema.subschema, referenced_schema, schema_path)
|
|
770
|
+
merge_contexts(onto_context, ref_ctx)
|
|
758
771
|
|
|
759
772
|
for i in ('allOf', 'anyOf', 'oneOf'):
|
|
760
773
|
l = subschema.get(i)
|
|
761
774
|
if isinstance(l, list):
|
|
762
775
|
for idx, sub_subschema in enumerate(l):
|
|
763
|
-
process_subschema(sub_subschema, from_schema,
|
|
764
|
-
schema_path)
|
|
776
|
+
merge_contexts(onto_context, process_subschema(sub_subschema, from_schema, schema_path))
|
|
765
777
|
|
|
766
778
|
for i in ('prefixItems', 'items', 'contains', 'then', 'else', 'additionalProperties'):
|
|
767
779
|
l = subschema.get(i)
|
|
768
780
|
if isinstance(l, dict):
|
|
769
|
-
process_subschema(l, from_schema,
|
|
781
|
+
merge_contexts(onto_context, process_subschema(l, from_schema, schema_path))
|
|
770
782
|
|
|
771
783
|
for pp_k, pp in subschema.get('patternProperties', {}).items():
|
|
772
784
|
if isinstance(pp, dict):
|
|
773
|
-
process_subschema(pp, from_schema,
|
|
785
|
+
merge_contexts(onto_context, process_subschema(pp, from_schema, schema_path + [pp_k]))
|
|
774
786
|
|
|
775
787
|
if ANNOTATION_EXTRA_TERMS in subschema:
|
|
776
788
|
for extra_term, extra_term_context in subschema[ANNOTATION_EXTRA_TERMS].items():
|
|
@@ -797,7 +809,10 @@ class ContextBuilder:
|
|
|
797
809
|
if isinstance(sub_prefixes, dict):
|
|
798
810
|
prefixes.update({k: v for k, v in sub_prefixes.items() if k not in prefixes})
|
|
799
811
|
|
|
800
|
-
|
|
812
|
+
cached_schema_contexts[f"{from_schema.location}#{from_schema.fragment}"] = onto_context
|
|
813
|
+
return onto_context
|
|
814
|
+
|
|
815
|
+
merge_contexts(own_context, process_subschema(root_schema.subschema, root_schema, []))
|
|
801
816
|
|
|
802
817
|
for imported_et in imported_extra_terms.values():
|
|
803
818
|
for term, v in imported_et.items():
|
|
@@ -844,10 +859,13 @@ class ContextBuilder:
|
|
|
844
859
|
if isinstance(term_value, dict) and '@context' in term_value:
|
|
845
860
|
if not term_value['@context']:
|
|
846
861
|
del term_value['@context']
|
|
862
|
+
changed = True
|
|
847
863
|
else:
|
|
848
864
|
while True:
|
|
849
865
|
if not compact_branch(term_value['@context'], child_context_stack):
|
|
850
866
|
break
|
|
867
|
+
else:
|
|
868
|
+
changed = True
|
|
851
869
|
|
|
852
870
|
if context_stack:
|
|
853
871
|
for ctx in context_stack:
|
|
@@ -881,7 +899,9 @@ class ContextBuilder:
|
|
|
881
899
|
elif '@context' in term_value:
|
|
882
900
|
compact_uris(term_value['@context'], child_context_stack)
|
|
883
901
|
|
|
884
|
-
|
|
902
|
+
while True:
|
|
903
|
+
if not compact_branch(own_context):
|
|
904
|
+
break
|
|
885
905
|
compact_uris(own_context)
|
|
886
906
|
|
|
887
907
|
self._parsed_schemas[schema_location] = own_context
|
|
@@ -310,6 +310,9 @@ def git_status(repo_path: str | Path = '.'):
|
|
|
310
310
|
|
|
311
311
|
|
|
312
312
|
def merge_contexts(a: dict, b: dict, fix_nest=True) -> dict[str, Any]:
|
|
313
|
+
'''
|
|
314
|
+
Merges two JSON-lD contexts, updating the first one passed to this function (and returning it).
|
|
315
|
+
'''
|
|
313
316
|
if not b:
|
|
314
317
|
return a
|
|
315
318
|
if not a:
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: ogc_na
|
|
3
|
-
Version: 0.3.
|
|
3
|
+
Version: 0.3.50
|
|
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
|