ogc-na 0.3.54__py3-none-any.whl → 0.3.55__py3-none-any.whl

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/_version.py CHANGED
@@ -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.54'
16
- __version_tuple__ = version_tuple = (0, 3, 54)
15
+ __version__ = version = '0.3.55'
16
+ __version_tuple__ = version_tuple = (0, 3, 55)
ogc/na/update_vocabs.py CHANGED
@@ -79,7 +79,8 @@ def setup_logging(debug: bool = False):
79
79
 
80
80
 
81
81
  def load_vocab(vocab: Union[Graph, str, Path], graph_uri: str,
82
- graph_store: str, auth_details: tuple[str] = None) -> None:
82
+ graph_store: str, auth_details: tuple[str] = None,
83
+ append = False) -> None:
83
84
  """
84
85
  Loads a vocabulary onto a triplestore using the [SPARQL Graph Store
85
86
  protocol](https://www.w3.org/TR/sparql11-http-rdf-update/).
@@ -88,6 +89,7 @@ def load_vocab(vocab: Union[Graph, str, Path], graph_uri: str,
88
89
  :param graph_uri: a target graph URI
89
90
  :param graph_store: the target SPARQL Graph Store protocol URL
90
91
  :param auth_details: a `(username, password)` tuple for authentication
92
+ :param append: whether to append the data to the graph (otherwise the graph data will be replaced)
91
93
  :return:
92
94
  """
93
95
  # PUT is equivalent to DROP GRAPH + INSERT DATA
@@ -99,8 +101,9 @@ def load_vocab(vocab: Union[Graph, str, Path], graph_uri: str,
99
101
  with open(vocab, 'rb') as f:
100
102
  content = f.read()
101
103
 
102
- r = requests.put(
103
- graph_store,
104
+ r = requests.request(
105
+ method='POST' if append else 'PUT',
106
+ url=graph_store,
104
107
  params={
105
108
  'graph': graph_uri,
106
109
  },
@@ -436,6 +439,7 @@ def _main():
436
439
  report = {}
437
440
  activity_id = str(uuid.uuid4())
438
441
  cmdline = 'python ogc.na.update_vocabs ' + " ".join(sys.argv[1:])
442
+ uploaded_graphs = set()
439
443
  for collection in (modified, added):
440
444
  report_cat = 'modified' if collection == modified else 'added'
441
445
  for doc, cfg in collection.items():
@@ -498,15 +502,21 @@ def _main():
498
502
  # path components relative to the working directory
499
503
  urnpart = ':'.join(p for p in docrelpath.parts if p and p != '..')
500
504
  graphname = "x-urn:{}".format(urnpart)
505
+ append_data = graphname in uploaded_graphs
501
506
  logger.info("Using graph name %s for %s", graphname, str(doc))
502
507
 
503
508
  versioned_gname = graphname
504
509
  for n, (path, loadable) in enumerate(loadables.items()):
505
510
  try:
506
511
  load_vocab(loadable, versioned_gname,
507
- args.graph_store, authdetails)
508
- logging.info("Uploaded %s for %s to SPARQL graph store",
509
- str(path), str(doc))
512
+ args.graph_store, authdetails, append=append_data)
513
+ if append_data:
514
+ logging.info("Uploaded %s for %s to SPARQL graph store (with append)",
515
+ str(path), str(doc))
516
+ else:
517
+ logging.info("Uploaded %s for %s to SPARQL graph store (with replace)",
518
+ str(path), str(doc))
519
+ uploaded_graphs.add(versioned_gname)
510
520
  except Exception as e:
511
521
  logging.error("Failed to upload %s for %s: %s",
512
522
  str(path), str(doc), str(e))
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: ogc_na
3
- Version: 0.3.54
3
+ Version: 0.3.55
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/
@@ -1,5 +1,5 @@
1
1
  ogc/na/__init__.py,sha256=uzcNiJ3uKFNJ1HBfKxIwgAy2HMUFsLAe5RkrUg8ncac,464
2
- ogc/na/_version.py,sha256=SIFfx0lgwTvAnd4cHgyIUN7PZREZhiGdTDRtpq4_MAM,413
2
+ ogc/na/_version.py,sha256=vA6gPTjPSdC1gxj6eZa79wc5Se9JVwdnhpHXCsZkLbU,413
3
3
  ogc/na/annotate_schema.py,sha256=cjKZPKNOEUSghcQH9qCOiE2-Evr0VFyYMN2NkUMz5wo,42647
4
4
  ogc/na/domain_config.py,sha256=ORzITa1rTrD1MQdpWYrIVW5SwSa9lJd3hnyHIxNgiIU,13947
5
5
  ogc/na/download.py,sha256=2afrLyl4WsAlxkCgXsl47fs9mNKfDmhVpeT2iwNSoq0,3354
@@ -9,13 +9,13 @@ ogc/na/ingest_json.py,sha256=OUA9IfSpBbwE6bNE2od64iMzdEg-Q4h5iyowgJsn2M4,35659
9
9
  ogc/na/models.py,sha256=nGV8EALtXvmBtkUbu0FA4KOgwNUqQGWIDuMo7UGOKP8,652
10
10
  ogc/na/profile.py,sha256=T7nesbm7azF2ijF60UenJnQQKjIgJlnJ3pUbGT5nYgM,16511
11
11
  ogc/na/provenance.py,sha256=h7UtUb1wW_9MfEim0fjcqkHd0BYmpXqyE1ADzL9AH7I,5551
12
- ogc/na/update_vocabs.py,sha256=m9Nd90Aplsm3m7cvNdiemPbnfq6Xq6rUDXGT1GBwDT4,18898
12
+ ogc/na/update_vocabs.py,sha256=GWzWhIvZiCbioyIl3Ln8DHSW_olu5oG17kWGOgxad48,19506
13
13
  ogc/na/util.py,sha256=Ztju3g1YuguUDbk4n2RJfCrl_IIzNAj7linfy24T6VA,12067
14
14
  ogc/na/validation.py,sha256=5xjHH55NZKM8HtUk8XgVzm8W5ZlZY00u_qsWfXK_8dM,3732
15
15
  ogc/na/input_filters/__init__.py,sha256=AhE7n_yECwxFKwOM3Jc0ft96TtF5i_Z-fHrS4HYOjaE,1179
16
16
  ogc/na/input_filters/csv.py,sha256=nFfB1XQF_QApcGGzMqEvzD_b3pBtCtsfUECsZ9UGE6s,2616
17
17
  ogc/na/input_filters/xml.py,sha256=9qYjp_w5JLInFM48zB15IYH9eTafjp1Aqd_8kfuW3aA,2074
18
- ogc_na-0.3.54.dist-info/METADATA,sha256=udHRdqATRi60hCfDejn_rgBXVpp5z76Ln_yJWFto_3s,3829
19
- ogc_na-0.3.54.dist-info/WHEEL,sha256=GV9aMThwP_4oNCtvEC2ec3qUYutgWeAzklro_0m4WJQ,91
20
- ogc_na-0.3.54.dist-info/top_level.txt,sha256=Kvy3KhzcIhNPT4_nZuJCmS946ptRr_MDyU4IIhZJhCY,4
21
- ogc_na-0.3.54.dist-info/RECORD,,
18
+ ogc_na-0.3.55.dist-info/METADATA,sha256=FPql5ZiyEyfGR0_tSciYAakCV0BkLfWdHJMmzPZaJME,3829
19
+ ogc_na-0.3.55.dist-info/WHEEL,sha256=P9jw-gEje8ByB7_hXoICnHtVCrEwMQh-630tKvQWehc,91
20
+ ogc_na-0.3.55.dist-info/top_level.txt,sha256=Kvy3KhzcIhNPT4_nZuJCmS946ptRr_MDyU4IIhZJhCY,4
21
+ ogc_na-0.3.55.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (75.1.0)
2
+ Generator: setuptools (75.3.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5