ogc-na 0.3.42__tar.gz → 0.3.44__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.42 → ogc_na-0.3.44}/PKG-INFO +1 -1
- {ogc_na-0.3.42 → ogc_na-0.3.44}/ogc/na/_version.py +2 -2
- {ogc_na-0.3.42 → ogc_na-0.3.44}/ogc/na/annotate_schema.py +18 -12
- {ogc_na-0.3.42 → ogc_na-0.3.44}/ogc/na/util.py +27 -1
- {ogc_na-0.3.42 → ogc_na-0.3.44}/ogc_na.egg-info/PKG-INFO +1 -1
- {ogc_na-0.3.42 → ogc_na-0.3.44}/.github/workflows/mkdocs.yml +0 -0
- {ogc_na-0.3.42 → ogc_na-0.3.44}/.github/workflows/python-publish.yml +0 -0
- {ogc_na-0.3.42 → ogc_na-0.3.44}/.gitignore +0 -0
- {ogc_na-0.3.42 → ogc_na-0.3.44}/MANIFEST.in +0 -0
- {ogc_na-0.3.42 → ogc_na-0.3.44}/README.md +0 -0
- {ogc_na-0.3.42 → ogc_na-0.3.44}/docs/examples.md +0 -0
- {ogc_na-0.3.42 → ogc_na-0.3.44}/docs/gen_ref_pages.py +0 -0
- {ogc_na-0.3.42 → ogc_na-0.3.44}/docs/index.md +0 -0
- {ogc_na-0.3.42 → ogc_na-0.3.44}/docs/jsonld-uplift.md +0 -0
- {ogc_na-0.3.42 → ogc_na-0.3.44}/docs/tutorials.md +0 -0
- {ogc_na-0.3.42 → ogc_na-0.3.44}/mkdocs.yml +0 -0
- {ogc_na-0.3.42 → ogc_na-0.3.44}/ogc/na/__init__.py +0 -0
- {ogc_na-0.3.42 → ogc_na-0.3.44}/ogc/na/domain_config.py +0 -0
- {ogc_na-0.3.42 → ogc_na-0.3.44}/ogc/na/download.py +0 -0
- {ogc_na-0.3.42 → ogc_na-0.3.44}/ogc/na/gsp.py +0 -0
- {ogc_na-0.3.42 → ogc_na-0.3.44}/ogc/na/ingest_json.py +0 -0
- {ogc_na-0.3.42 → ogc_na-0.3.44}/ogc/na/input_filters/__init__.py +0 -0
- {ogc_na-0.3.42 → ogc_na-0.3.44}/ogc/na/input_filters/csv.py +0 -0
- {ogc_na-0.3.42 → ogc_na-0.3.44}/ogc/na/input_filters/xml.py +0 -0
- {ogc_na-0.3.42 → ogc_na-0.3.44}/ogc/na/models.py +0 -0
- {ogc_na-0.3.42 → ogc_na-0.3.44}/ogc/na/profile.py +0 -0
- {ogc_na-0.3.42 → ogc_na-0.3.44}/ogc/na/provenance.py +0 -0
- {ogc_na-0.3.42 → ogc_na-0.3.44}/ogc/na/update_vocabs.py +0 -0
- {ogc_na-0.3.42 → ogc_na-0.3.44}/ogc/na/validation.py +0 -0
- {ogc_na-0.3.42 → ogc_na-0.3.44}/ogc_na.egg-info/SOURCES.txt +0 -0
- {ogc_na-0.3.42 → ogc_na-0.3.44}/ogc_na.egg-info/dependency_links.txt +0 -0
- {ogc_na-0.3.42 → ogc_na-0.3.44}/ogc_na.egg-info/requires.txt +0 -0
- {ogc_na-0.3.42 → ogc_na-0.3.44}/ogc_na.egg-info/top_level.txt +0 -0
- {ogc_na-0.3.42 → ogc_na-0.3.44}/pyproject.toml +0 -0
- {ogc_na-0.3.42 → ogc_na-0.3.44}/rdf/catalog-v001.xml +0 -0
- {ogc_na-0.3.42 → ogc_na-0.3.44}/rdf/domaincfg.vocab.ttl +0 -0
- {ogc_na-0.3.42 → ogc_na-0.3.44}/requirements.txt +0 -0
- {ogc_na-0.3.42 → ogc_na-0.3.44}/setup.cfg +0 -0
- {ogc_na-0.3.42 → ogc_na-0.3.44}/setup.py +0 -0
- {ogc_na-0.3.42 → ogc_na-0.3.44}/test/__init__.py +0 -0
- {ogc_na-0.3.42 → ogc_na-0.3.44}/test/data/empty.ttl +0 -0
- {ogc_na-0.3.42 → ogc_na-0.3.44}/test/data/headers.csv +0 -0
- {ogc_na-0.3.42 → ogc_na-0.3.44}/test/data/no-headers.csv +0 -0
- {ogc_na-0.3.42 → ogc_na-0.3.44}/test/data/profile_tree.ttl +0 -0
- {ogc_na-0.3.42 → ogc_na-0.3.44}/test/data/profile_tree_cyclic.ttl +0 -0
- {ogc_na-0.3.42 → ogc_na-0.3.44}/test/data/sample-context.jsonld +0 -0
- {ogc_na-0.3.42 → ogc_na-0.3.44}/test/data/sample-schema-prop-c.yml +0 -0
- {ogc_na-0.3.42 → ogc_na-0.3.44}/test/data/sample-schema.yml +0 -0
- {ogc_na-0.3.42 → ogc_na-0.3.44}/test/data/schema-vocab.yml +0 -0
- {ogc_na-0.3.42 → ogc_na-0.3.44}/test/data/uplift_context_valid.yml +0 -0
- {ogc_na-0.3.42 → ogc_na-0.3.44}/test/test_annotate_schema.py +0 -0
- {ogc_na-0.3.42 → ogc_na-0.3.44}/test/test_ingest_json.py +0 -0
- {ogc_na-0.3.42 → ogc_na-0.3.44}/test/test_input_filters_csv.py +0 -0
- {ogc_na-0.3.42 → ogc_na-0.3.44}/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.44
|
|
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/
|
|
@@ -131,7 +131,8 @@ from urllib.parse import urlparse, urljoin
|
|
|
131
131
|
import jsonschema
|
|
132
132
|
import requests_cache
|
|
133
133
|
|
|
134
|
-
from ogc.na.util import is_url, load_yaml, LRUCache, dump_yaml,
|
|
134
|
+
from ogc.na.util import is_url, load_yaml, LRUCache, dump_yaml, \
|
|
135
|
+
merge_contexts, merge_dicts, dict_contains, JSON_LD_KEYWORDS
|
|
135
136
|
|
|
136
137
|
logger = logging.getLogger(__name__)
|
|
137
138
|
|
|
@@ -340,7 +341,7 @@ def resolve_context(ctx: Path | str | dict | list, expand_uris=True) -> Resolved
|
|
|
340
341
|
prefixes = {}
|
|
341
342
|
|
|
342
343
|
def expand_uri(curie, ctx_stack):
|
|
343
|
-
if not expand_uris or not ctx_stack or not curie or curie
|
|
344
|
+
if not expand_uris or not ctx_stack or not curie or curie in JSON_LD_KEYWORDS:
|
|
344
345
|
return curie
|
|
345
346
|
if ':' in curie:
|
|
346
347
|
prefix, localpart = curie.split(':', 1)
|
|
@@ -486,18 +487,18 @@ class SchemaAnnotator:
|
|
|
486
487
|
if prop in ctx:
|
|
487
488
|
prop_ctx = ctx[prop]
|
|
488
489
|
if isinstance(prop_ctx, str):
|
|
489
|
-
if vocab and ':' not in prop_ctx and prop_ctx
|
|
490
|
+
if vocab and ':' not in prop_ctx and prop_ctx not in JSON_LD_KEYWORDS:
|
|
490
491
|
prop_ctx = f"{vocab}{prop_ctx}"
|
|
491
492
|
return {'@id': prop_ctx}
|
|
492
493
|
elif '@id' not in prop_ctx and not vocab:
|
|
493
494
|
raise ValueError(f'Missing @id for property {prop} in context {json.dumps(ctx, indent=2)}')
|
|
494
495
|
else:
|
|
495
|
-
result = {k: v for k, v in prop_ctx.items() if k
|
|
496
|
+
result = {k: v for k, v in prop_ctx.items() if k in JSON_LD_KEYWORDS}
|
|
496
497
|
if vocab:
|
|
497
498
|
prop_id = result.get('@id')
|
|
498
499
|
if not prop_id:
|
|
499
500
|
result['@id'] = f"{vocab}{prop}"
|
|
500
|
-
elif ':' not in prop_id and prop_id
|
|
501
|
+
elif ':' not in prop_id and prop_id not in JSON_LD_KEYWORDS:
|
|
501
502
|
result['@id'] = f"{vocab}{prop_id}"
|
|
502
503
|
return result
|
|
503
504
|
elif '@vocab' in ctx:
|
|
@@ -514,11 +515,14 @@ class SchemaAnnotator:
|
|
|
514
515
|
|
|
515
516
|
used_terms = set()
|
|
516
517
|
for prop in list(properties.keys()):
|
|
517
|
-
if prop
|
|
518
|
+
if prop in JSON_LD_KEYWORDS:
|
|
518
519
|
# skip JSON-LD keywords
|
|
519
520
|
continue
|
|
520
521
|
prop_value = properties[prop]
|
|
521
522
|
|
|
523
|
+
if not isinstance(prop_value, dict):
|
|
524
|
+
continue
|
|
525
|
+
|
|
522
526
|
for key in list(prop_value.keys()):
|
|
523
527
|
if self.ignore_existing and key.startswith(ANNOTATION_PREFIX):
|
|
524
528
|
prop_value.pop(key, None)
|
|
@@ -528,7 +532,7 @@ class SchemaAnnotator:
|
|
|
528
532
|
used_terms.add(prop)
|
|
529
533
|
prop_schema_ctx = {f"{ANNOTATION_PREFIX}{k[1:]}": v
|
|
530
534
|
for k, v in prop_ctx.items()
|
|
531
|
-
if k
|
|
535
|
+
if k in JSON_LD_KEYWORDS and k != '@context'}
|
|
532
536
|
prop_ctx_base = prop_ctx.get('@context', {}).get('@base')
|
|
533
537
|
if prop_ctx_base:
|
|
534
538
|
prop_schema_ctx[ANNOTATION_BASE] = prop_ctx_base
|
|
@@ -605,12 +609,14 @@ class SchemaAnnotator:
|
|
|
605
609
|
if len(context_stack) == level and context_stack[-1]:
|
|
606
610
|
extra_terms = {}
|
|
607
611
|
for k, v in context_stack[-1].items():
|
|
608
|
-
if k
|
|
612
|
+
if k not in JSON_LD_KEYWORDS and k not in prefixes and k not in used_terms:
|
|
609
613
|
if isinstance(v, dict):
|
|
610
614
|
if len(v) == 1 and '@id' in v:
|
|
611
615
|
v = v['@id']
|
|
612
616
|
else:
|
|
613
|
-
v = {f"{ANNOTATION_PREFIX}{vk[1:]}": vv
|
|
617
|
+
v = {f"{ANNOTATION_PREFIX}{vk[1:]}": vv
|
|
618
|
+
for vk, vv in v.items()
|
|
619
|
+
if vk in JSON_LD_KEYWORDS}
|
|
614
620
|
if isinstance(v, str) and v[-1] in ('#', '/', ':'):
|
|
615
621
|
prefixes[k] = v
|
|
616
622
|
else:
|
|
@@ -803,7 +809,7 @@ class ContextBuilder:
|
|
|
803
809
|
if compact:
|
|
804
810
|
|
|
805
811
|
def compact_uri(uri: str) -> str:
|
|
806
|
-
if uri
|
|
812
|
+
if uri in JSON_LD_KEYWORDS:
|
|
807
813
|
# JSON-LD keyword
|
|
808
814
|
return uri
|
|
809
815
|
|
|
@@ -818,7 +824,7 @@ class ContextBuilder:
|
|
|
818
824
|
|
|
819
825
|
def compact_branch(branch, context_stack=None) -> bool:
|
|
820
826
|
child_context_stack = context_stack + [branch] if context_stack else [branch]
|
|
821
|
-
terms = list(k for k in branch.keys() if k
|
|
827
|
+
terms = list(k for k in branch.keys() if k not in JSON_LD_KEYWORDS)
|
|
822
828
|
|
|
823
829
|
changed = False
|
|
824
830
|
for term in terms:
|
|
@@ -850,7 +856,7 @@ class ContextBuilder:
|
|
|
850
856
|
|
|
851
857
|
def compact_uris(branch, context_stack=None):
|
|
852
858
|
child_context_stack = context_stack + [branch] if context_stack else [branch]
|
|
853
|
-
terms = list(k for k in branch.keys() if k
|
|
859
|
+
terms = list(k for k in branch.keys() if k not in JSON_LD_KEYWORDS)
|
|
854
860
|
for term in terms:
|
|
855
861
|
term_value = branch.get(term)
|
|
856
862
|
if isinstance(term_value, str):
|
|
@@ -28,6 +28,32 @@ try:
|
|
|
28
28
|
except ImportError:
|
|
29
29
|
from yaml import Loader as YamlLoader, SafeLoader as SafeYamlLoader, Dumper as YamlDumper
|
|
30
30
|
|
|
31
|
+
JSON_LD_KEYWORDS = {
|
|
32
|
+
'@base',
|
|
33
|
+
'@container',
|
|
34
|
+
'@context',
|
|
35
|
+
'@direction',
|
|
36
|
+
'@graph',
|
|
37
|
+
'@id',
|
|
38
|
+
'@import',
|
|
39
|
+
'@included',
|
|
40
|
+
'@index',
|
|
41
|
+
'@json',
|
|
42
|
+
'@language',
|
|
43
|
+
'@list',
|
|
44
|
+
'@nest',
|
|
45
|
+
'@none',
|
|
46
|
+
'@prefix',
|
|
47
|
+
'@propagate',
|
|
48
|
+
'@protected',
|
|
49
|
+
'@reverse',
|
|
50
|
+
'@set',
|
|
51
|
+
'@type',
|
|
52
|
+
'@value',
|
|
53
|
+
'@version',
|
|
54
|
+
'@vocab'
|
|
55
|
+
}
|
|
56
|
+
|
|
31
57
|
|
|
32
58
|
class ContextMergeError(Exception):
|
|
33
59
|
pass
|
|
@@ -294,7 +320,7 @@ def merge_contexts(a: dict, b: dict, fix_nest=True) -> dict[str, Any]:
|
|
|
294
320
|
for term in list(a.keys()):
|
|
295
321
|
va = a[term]
|
|
296
322
|
vb = b.get(term)
|
|
297
|
-
if term
|
|
323
|
+
if term not in JSON_LD_KEYWORDS:
|
|
298
324
|
if isinstance(va, str):
|
|
299
325
|
va = {'@id': va}
|
|
300
326
|
a[term] = va
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: ogc_na
|
|
3
|
-
Version: 0.3.
|
|
3
|
+
Version: 0.3.44
|
|
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
|