ogc-na 0.3.48__tar.gz → 0.3.49__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.49}/PKG-INFO +1 -1
- {ogc_na-0.3.48 → ogc_na-0.3.49}/ogc/na/_version.py +2 -2
- {ogc_na-0.3.48 → ogc_na-0.3.49}/ogc/na/annotate_schema.py +29 -14
- {ogc_na-0.3.48 → ogc_na-0.3.49}/ogc/na/util.py +3 -0
- {ogc_na-0.3.48 → ogc_na-0.3.49}/ogc_na.egg-info/PKG-INFO +1 -1
- {ogc_na-0.3.48 → ogc_na-0.3.49}/.github/workflows/mkdocs.yml +0 -0
- {ogc_na-0.3.48 → ogc_na-0.3.49}/.github/workflows/python-publish.yml +0 -0
- {ogc_na-0.3.48 → ogc_na-0.3.49}/.gitignore +0 -0
- {ogc_na-0.3.48 → ogc_na-0.3.49}/MANIFEST.in +0 -0
- {ogc_na-0.3.48 → ogc_na-0.3.49}/README.md +0 -0
- {ogc_na-0.3.48 → ogc_na-0.3.49}/docs/examples.md +0 -0
- {ogc_na-0.3.48 → ogc_na-0.3.49}/docs/gen_ref_pages.py +0 -0
- {ogc_na-0.3.48 → ogc_na-0.3.49}/docs/index.md +0 -0
- {ogc_na-0.3.48 → ogc_na-0.3.49}/docs/jsonld-uplift.md +0 -0
- {ogc_na-0.3.48 → ogc_na-0.3.49}/docs/tutorials.md +0 -0
- {ogc_na-0.3.48 → ogc_na-0.3.49}/mkdocs.yml +0 -0
- {ogc_na-0.3.48 → ogc_na-0.3.49}/ogc/na/__init__.py +0 -0
- {ogc_na-0.3.48 → ogc_na-0.3.49}/ogc/na/domain_config.py +0 -0
- {ogc_na-0.3.48 → ogc_na-0.3.49}/ogc/na/download.py +0 -0
- {ogc_na-0.3.48 → ogc_na-0.3.49}/ogc/na/gsp.py +0 -0
- {ogc_na-0.3.48 → ogc_na-0.3.49}/ogc/na/ingest_json.py +0 -0
- {ogc_na-0.3.48 → ogc_na-0.3.49}/ogc/na/input_filters/__init__.py +0 -0
- {ogc_na-0.3.48 → ogc_na-0.3.49}/ogc/na/input_filters/csv.py +0 -0
- {ogc_na-0.3.48 → ogc_na-0.3.49}/ogc/na/input_filters/xml.py +0 -0
- {ogc_na-0.3.48 → ogc_na-0.3.49}/ogc/na/models.py +0 -0
- {ogc_na-0.3.48 → ogc_na-0.3.49}/ogc/na/profile.py +0 -0
- {ogc_na-0.3.48 → ogc_na-0.3.49}/ogc/na/provenance.py +0 -0
- {ogc_na-0.3.48 → ogc_na-0.3.49}/ogc/na/update_vocabs.py +0 -0
- {ogc_na-0.3.48 → ogc_na-0.3.49}/ogc/na/validation.py +0 -0
- {ogc_na-0.3.48 → ogc_na-0.3.49}/ogc_na.egg-info/SOURCES.txt +0 -0
- {ogc_na-0.3.48 → ogc_na-0.3.49}/ogc_na.egg-info/dependency_links.txt +0 -0
- {ogc_na-0.3.48 → ogc_na-0.3.49}/ogc_na.egg-info/requires.txt +0 -0
- {ogc_na-0.3.48 → ogc_na-0.3.49}/ogc_na.egg-info/top_level.txt +0 -0
- {ogc_na-0.3.48 → ogc_na-0.3.49}/pyproject.toml +0 -0
- {ogc_na-0.3.48 → ogc_na-0.3.49}/rdf/catalog-v001.xml +0 -0
- {ogc_na-0.3.48 → ogc_na-0.3.49}/rdf/domaincfg.vocab.ttl +0 -0
- {ogc_na-0.3.48 → ogc_na-0.3.49}/requirements.txt +0 -0
- {ogc_na-0.3.48 → ogc_na-0.3.49}/setup.cfg +0 -0
- {ogc_na-0.3.48 → ogc_na-0.3.49}/setup.py +0 -0
- {ogc_na-0.3.48 → ogc_na-0.3.49}/test/__init__.py +0 -0
- {ogc_na-0.3.48 → ogc_na-0.3.49}/test/data/empty.ttl +0 -0
- {ogc_na-0.3.48 → ogc_na-0.3.49}/test/data/headers.csv +0 -0
- {ogc_na-0.3.48 → ogc_na-0.3.49}/test/data/no-headers.csv +0 -0
- {ogc_na-0.3.48 → ogc_na-0.3.49}/test/data/profile_tree.ttl +0 -0
- {ogc_na-0.3.48 → ogc_na-0.3.49}/test/data/profile_tree_cyclic.ttl +0 -0
- {ogc_na-0.3.48 → ogc_na-0.3.49}/test/data/sample-context.jsonld +0 -0
- {ogc_na-0.3.48 → ogc_na-0.3.49}/test/data/sample-schema-prop-c.yml +0 -0
- {ogc_na-0.3.48 → ogc_na-0.3.49}/test/data/sample-schema.yml +0 -0
- {ogc_na-0.3.48 → ogc_na-0.3.49}/test/data/schema-vocab.yml +0 -0
- {ogc_na-0.3.48 → ogc_na-0.3.49}/test/data/uplift_context_valid.yml +0 -0
- {ogc_na-0.3.48 → ogc_na-0.3.49}/test/test_annotate_schema.py +0 -0
- {ogc_na-0.3.48 → ogc_na-0.3.49}/test/test_ingest_json.py +0 -0
- {ogc_na-0.3.48 → ogc_na-0.3.49}/test/test_input_filters_csv.py +0 -0
- {ogc_na-0.3.48 → ogc_na-0.3.49}/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.49
|
|
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
|
|
@@ -723,24 +724,29 @@ class ContextBuilder:
|
|
|
723
724
|
self.visited_properties[full_property_path_str] = prop_context['@id']
|
|
724
725
|
self._missed_properties[full_property_path_str] = False
|
|
725
726
|
if prop_context['@id'] == '@nest':
|
|
726
|
-
process_subschema(prop_val, from_schema,
|
|
727
|
+
merge_contexts(onto_context, process_subschema(prop_val, from_schema, full_property_path))
|
|
727
728
|
else:
|
|
728
|
-
|
|
729
|
+
merge_contexts(prop_context['@context'],
|
|
730
|
+
process_subschema(prop_val, from_schema, full_property_path))
|
|
729
731
|
if prop not in onto_context or isinstance(onto_context[prop], str):
|
|
730
732
|
onto_context[prop] = prop_context
|
|
731
733
|
else:
|
|
732
734
|
merge_contexts(onto_context[prop], prop_context)
|
|
733
735
|
else:
|
|
734
|
-
process_subschema(prop_val, from_schema,
|
|
736
|
+
merge_contexts(onto_context, process_subschema(prop_val, from_schema, full_property_path))
|
|
735
737
|
|
|
736
738
|
imported_prefixes: dict[str | Path, dict[str, str]] = {}
|
|
737
739
|
imported_extra_terms: dict[str | Path, dict[str, str]] = {}
|
|
738
740
|
|
|
739
|
-
|
|
740
|
-
|
|
741
|
+
cached_schema_contexts = {}
|
|
742
|
+
|
|
743
|
+
def process_subschema(subschema: dict, from_schema: ReferencedSchema,
|
|
744
|
+
schema_path: list[str]) -> dict:
|
|
745
|
+
|
|
746
|
+
onto_context = {}
|
|
741
747
|
|
|
742
748
|
if not isinstance(subschema, dict):
|
|
743
|
-
return
|
|
749
|
+
return {}
|
|
744
750
|
|
|
745
751
|
if subschema.get(ANNOTATION_BASE):
|
|
746
752
|
onto_context['@base'] = subschema[ANNOTATION_BASE]
|
|
@@ -753,24 +759,25 @@ class ContextBuilder:
|
|
|
753
759
|
processed_refs.add(ref_path_str)
|
|
754
760
|
referenced_schema = self.schema_resolver.resolve_schema(ref, from_schema)
|
|
755
761
|
if referenced_schema:
|
|
756
|
-
|
|
757
|
-
|
|
762
|
+
ref_ctx = copy.deepcopy(cached_schema_contexts.get(ref_path_str))
|
|
763
|
+
if ref_ctx is None:
|
|
764
|
+
ref_ctx = process_subschema(referenced_schema.subschema, referenced_schema, schema_path)
|
|
765
|
+
merge_contexts(onto_context, ref_ctx)
|
|
758
766
|
|
|
759
767
|
for i in ('allOf', 'anyOf', 'oneOf'):
|
|
760
768
|
l = subschema.get(i)
|
|
761
769
|
if isinstance(l, list):
|
|
762
770
|
for idx, sub_subschema in enumerate(l):
|
|
763
|
-
process_subschema(sub_subschema, from_schema,
|
|
764
|
-
schema_path)
|
|
771
|
+
merge_contexts(onto_context, process_subschema(sub_subschema, from_schema, schema_path))
|
|
765
772
|
|
|
766
773
|
for i in ('prefixItems', 'items', 'contains', 'then', 'else', 'additionalProperties'):
|
|
767
774
|
l = subschema.get(i)
|
|
768
775
|
if isinstance(l, dict):
|
|
769
|
-
process_subschema(l, from_schema,
|
|
776
|
+
merge_contexts(onto_context, process_subschema(l, from_schema, schema_path))
|
|
770
777
|
|
|
771
778
|
for pp_k, pp in subschema.get('patternProperties', {}).items():
|
|
772
779
|
if isinstance(pp, dict):
|
|
773
|
-
process_subschema(pp, from_schema,
|
|
780
|
+
merge_contexts(onto_context, process_subschema(pp, from_schema, schema_path + [pp_k]))
|
|
774
781
|
|
|
775
782
|
if ANNOTATION_EXTRA_TERMS in subschema:
|
|
776
783
|
for extra_term, extra_term_context in subschema[ANNOTATION_EXTRA_TERMS].items():
|
|
@@ -797,7 +804,10 @@ class ContextBuilder:
|
|
|
797
804
|
if isinstance(sub_prefixes, dict):
|
|
798
805
|
prefixes.update({k: v for k, v in sub_prefixes.items() if k not in prefixes})
|
|
799
806
|
|
|
800
|
-
|
|
807
|
+
cached_schema_contexts[f"{from_schema.location}#{from_schema.fragment}"] = onto_context
|
|
808
|
+
return onto_context
|
|
809
|
+
|
|
810
|
+
merge_contexts(own_context, process_subschema(root_schema.subschema, root_schema, []))
|
|
801
811
|
|
|
802
812
|
for imported_et in imported_extra_terms.values():
|
|
803
813
|
for term, v in imported_et.items():
|
|
@@ -844,10 +854,13 @@ class ContextBuilder:
|
|
|
844
854
|
if isinstance(term_value, dict) and '@context' in term_value:
|
|
845
855
|
if not term_value['@context']:
|
|
846
856
|
del term_value['@context']
|
|
857
|
+
changed = True
|
|
847
858
|
else:
|
|
848
859
|
while True:
|
|
849
860
|
if not compact_branch(term_value['@context'], child_context_stack):
|
|
850
861
|
break
|
|
862
|
+
else:
|
|
863
|
+
changed = True
|
|
851
864
|
|
|
852
865
|
if context_stack:
|
|
853
866
|
for ctx in context_stack:
|
|
@@ -881,7 +894,9 @@ class ContextBuilder:
|
|
|
881
894
|
elif '@context' in term_value:
|
|
882
895
|
compact_uris(term_value['@context'], child_context_stack)
|
|
883
896
|
|
|
884
|
-
|
|
897
|
+
while True:
|
|
898
|
+
if not compact_branch(own_context):
|
|
899
|
+
break
|
|
885
900
|
compact_uris(own_context)
|
|
886
901
|
|
|
887
902
|
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.49
|
|
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
|