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.

Files changed (54) hide show
  1. {ogc_na-0.3.44 → ogc_na-0.3.45}/PKG-INFO +1 -1
  2. {ogc_na-0.3.44 → ogc_na-0.3.45}/ogc/na/_version.py +2 -2
  3. {ogc_na-0.3.44 → ogc_na-0.3.45}/ogc/na/annotate_schema.py +21 -9
  4. {ogc_na-0.3.44 → ogc_na-0.3.45}/ogc_na.egg-info/PKG-INFO +1 -1
  5. {ogc_na-0.3.44 → ogc_na-0.3.45}/.github/workflows/mkdocs.yml +0 -0
  6. {ogc_na-0.3.44 → ogc_na-0.3.45}/.github/workflows/python-publish.yml +0 -0
  7. {ogc_na-0.3.44 → ogc_na-0.3.45}/.gitignore +0 -0
  8. {ogc_na-0.3.44 → ogc_na-0.3.45}/MANIFEST.in +0 -0
  9. {ogc_na-0.3.44 → ogc_na-0.3.45}/README.md +0 -0
  10. {ogc_na-0.3.44 → ogc_na-0.3.45}/docs/examples.md +0 -0
  11. {ogc_na-0.3.44 → ogc_na-0.3.45}/docs/gen_ref_pages.py +0 -0
  12. {ogc_na-0.3.44 → ogc_na-0.3.45}/docs/index.md +0 -0
  13. {ogc_na-0.3.44 → ogc_na-0.3.45}/docs/jsonld-uplift.md +0 -0
  14. {ogc_na-0.3.44 → ogc_na-0.3.45}/docs/tutorials.md +0 -0
  15. {ogc_na-0.3.44 → ogc_na-0.3.45}/mkdocs.yml +0 -0
  16. {ogc_na-0.3.44 → ogc_na-0.3.45}/ogc/na/__init__.py +0 -0
  17. {ogc_na-0.3.44 → ogc_na-0.3.45}/ogc/na/domain_config.py +0 -0
  18. {ogc_na-0.3.44 → ogc_na-0.3.45}/ogc/na/download.py +0 -0
  19. {ogc_na-0.3.44 → ogc_na-0.3.45}/ogc/na/gsp.py +0 -0
  20. {ogc_na-0.3.44 → ogc_na-0.3.45}/ogc/na/ingest_json.py +0 -0
  21. {ogc_na-0.3.44 → ogc_na-0.3.45}/ogc/na/input_filters/__init__.py +0 -0
  22. {ogc_na-0.3.44 → ogc_na-0.3.45}/ogc/na/input_filters/csv.py +0 -0
  23. {ogc_na-0.3.44 → ogc_na-0.3.45}/ogc/na/input_filters/xml.py +0 -0
  24. {ogc_na-0.3.44 → ogc_na-0.3.45}/ogc/na/models.py +0 -0
  25. {ogc_na-0.3.44 → ogc_na-0.3.45}/ogc/na/profile.py +0 -0
  26. {ogc_na-0.3.44 → ogc_na-0.3.45}/ogc/na/provenance.py +0 -0
  27. {ogc_na-0.3.44 → ogc_na-0.3.45}/ogc/na/update_vocabs.py +0 -0
  28. {ogc_na-0.3.44 → ogc_na-0.3.45}/ogc/na/util.py +0 -0
  29. {ogc_na-0.3.44 → ogc_na-0.3.45}/ogc/na/validation.py +0 -0
  30. {ogc_na-0.3.44 → ogc_na-0.3.45}/ogc_na.egg-info/SOURCES.txt +0 -0
  31. {ogc_na-0.3.44 → ogc_na-0.3.45}/ogc_na.egg-info/dependency_links.txt +0 -0
  32. {ogc_na-0.3.44 → ogc_na-0.3.45}/ogc_na.egg-info/requires.txt +0 -0
  33. {ogc_na-0.3.44 → ogc_na-0.3.45}/ogc_na.egg-info/top_level.txt +0 -0
  34. {ogc_na-0.3.44 → ogc_na-0.3.45}/pyproject.toml +0 -0
  35. {ogc_na-0.3.44 → ogc_na-0.3.45}/rdf/catalog-v001.xml +0 -0
  36. {ogc_na-0.3.44 → ogc_na-0.3.45}/rdf/domaincfg.vocab.ttl +0 -0
  37. {ogc_na-0.3.44 → ogc_na-0.3.45}/requirements.txt +0 -0
  38. {ogc_na-0.3.44 → ogc_na-0.3.45}/setup.cfg +0 -0
  39. {ogc_na-0.3.44 → ogc_na-0.3.45}/setup.py +0 -0
  40. {ogc_na-0.3.44 → ogc_na-0.3.45}/test/__init__.py +0 -0
  41. {ogc_na-0.3.44 → ogc_na-0.3.45}/test/data/empty.ttl +0 -0
  42. {ogc_na-0.3.44 → ogc_na-0.3.45}/test/data/headers.csv +0 -0
  43. {ogc_na-0.3.44 → ogc_na-0.3.45}/test/data/no-headers.csv +0 -0
  44. {ogc_na-0.3.44 → ogc_na-0.3.45}/test/data/profile_tree.ttl +0 -0
  45. {ogc_na-0.3.44 → ogc_na-0.3.45}/test/data/profile_tree_cyclic.ttl +0 -0
  46. {ogc_na-0.3.44 → ogc_na-0.3.45}/test/data/sample-context.jsonld +0 -0
  47. {ogc_na-0.3.44 → ogc_na-0.3.45}/test/data/sample-schema-prop-c.yml +0 -0
  48. {ogc_na-0.3.44 → ogc_na-0.3.45}/test/data/sample-schema.yml +0 -0
  49. {ogc_na-0.3.44 → ogc_na-0.3.45}/test/data/schema-vocab.yml +0 -0
  50. {ogc_na-0.3.44 → ogc_na-0.3.45}/test/data/uplift_context_valid.yml +0 -0
  51. {ogc_na-0.3.44 → ogc_na-0.3.45}/test/test_annotate_schema.py +0 -0
  52. {ogc_na-0.3.44 → ogc_na-0.3.45}/test/test_ingest_json.py +0 -0
  53. {ogc_na-0.3.44 → ogc_na-0.3.45}/test/test_input_filters_csv.py +0 -0
  54. {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.44
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/
@@ -12,5 +12,5 @@ __version__: str
12
12
  __version_tuple__: VERSION_TUPLE
13
13
  version_tuple: VERSION_TUPLE
14
14
 
15
- __version__ = version = '0.3.44'
16
- __version_tuple__ = version_tuple = (0, 3, 44)
15
+ __version__ = version = '0.3.45'
16
+ __version_tuple__ = version_tuple = (0, 3, 45)
@@ -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
- return f"{c['@vocab']}{curie}"
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
- resolved_entry = resolve_context(ctx_entry)
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 = ctx.get('@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 '@vocab' in ctx:
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
- if '@id' in term_value:
866
- term_value['@id'] = compact_uri(term_value['@id'])
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.44
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