dsp-tools 17.0.0.post23__py3-none-any.whl → 17.0.0.post25__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 dsp-tools might be problematic. Click here for more details.

@@ -4,6 +4,7 @@ import regex
4
4
 
5
5
  from dsp_tools.commands.create.constants import KNORA_API_STR
6
6
  from dsp_tools.commands.create.constants import UNIVERSAL_PREFIXES
7
+ from dsp_tools.utils.data_formats.iri_util import make_dsp_ontology_prefix
7
8
  from dsp_tools.utils.data_formats.uri_util import is_uri
8
9
 
9
10
 
@@ -27,7 +28,7 @@ def create_prefix_lookup(project_json: dict[str, Any], api_url: str) -> dict[str
27
28
  shortcode = project_json["project"]["shortcode"]
28
29
  for onto in project_json["project"]["ontologies"]:
29
30
  onto_name = onto["name"]
30
- defined_prefixes[onto_name] = _make_dsp_ontology_prefix(api_url, shortcode, onto_name)
31
+ defined_prefixes[onto_name] = make_dsp_ontology_prefix(api_url, shortcode, onto_name)
31
32
  return defined_prefixes
32
33
 
33
34
 
@@ -37,7 +38,3 @@ def _correct_external_prefix(prefixes: dict[str, str]) -> dict[str, str]:
37
38
  continue
38
39
  prefixes[prfx] = f"{namespace}/"
39
40
  return prefixes
40
-
41
-
42
- def _make_dsp_ontology_prefix(api_url: str, shortcode: str, onto_name: str) -> str:
43
- return f"{api_url}/ontology/{shortcode}/{onto_name}/v2#"
@@ -19,3 +19,12 @@ def from_dsp_iri_to_prefixed_iri(iri: str) -> str:
19
19
  if not (found := regex.search(dsp_iri_re, iri)):
20
20
  return iri
21
21
  return f"{found.group(1)}:{found.group(2)}"
22
+
23
+
24
+ def make_dsp_ontology_prefix(api_url: str, shortcode: str, onto_name: str) -> str:
25
+ api_fixed = convert_api_url_for_correct_iri_namespace_construction(api_url)
26
+ return f"{api_fixed}/ontology/{shortcode}/{onto_name}/v2#"
27
+
28
+
29
+ def convert_api_url_for_correct_iri_namespace_construction(api_url: str) -> str:
30
+ return regex.sub(r"^https", "http", api_url)
@@ -5,6 +5,7 @@ from lxml import etree
5
5
 
6
6
  from dsp_tools.commands.validate_data.mappers import XML_TAG_TO_VALUE_TYPE_MAPPER
7
7
  from dsp_tools.error.exceptions import InputError
8
+ from dsp_tools.utils.data_formats.iri_util import convert_api_url_for_correct_iri_namespace_construction
8
9
  from dsp_tools.utils.rdflib_constants import KNORA_API_STR
9
10
  from dsp_tools.utils.xml_parsing.models.parsed_resource import KnoraValueType
10
11
  from dsp_tools.utils.xml_parsing.models.parsed_resource import ParsedFileValue
@@ -15,7 +16,7 @@ from dsp_tools.utils.xml_parsing.models.parsed_resource import ParsedValue
15
16
 
16
17
 
17
18
  def get_parsed_resources(root: etree._Element, api_url: str) -> list[ParsedResource]:
18
- api_url = _convert_api_url_for_correct_iri_namespace_construction(api_url)
19
+ api_url = convert_api_url_for_correct_iri_namespace_construction(api_url)
19
20
  iri_lookup = _create_from_local_name_to_absolute_iri_lookup(root, api_url)
20
21
  all_res: list[ParsedResource] = []
21
22
  for res in root.iterdescendants(tag="resource"):
@@ -34,10 +35,6 @@ def get_parsed_resources(root: etree._Element, api_url: str) -> list[ParsedResou
34
35
  return all_res
35
36
 
36
37
 
37
- def _convert_api_url_for_correct_iri_namespace_construction(api_url: str) -> str:
38
- return regex.sub(r"^https", "http", api_url)
39
-
40
-
41
38
  def _create_from_local_name_to_absolute_iri_lookup(root: etree._Element, api_url: str) -> dict[str, str]:
42
39
  shortcode = root.attrib["shortcode"]
43
40
  default_ontology = root.attrib["default-ontology"]
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: dsp-tools
3
- Version: 17.0.0.post23
3
+ Version: 17.0.0.post25
4
4
  Summary: DSP-TOOLS is a Python package with a command line interface that helps you interact with a DaSCH service platform (DSP) server.
5
5
  Author: DaSCH - Swiss National Data and Service Center for the Humanities
6
6
  Author-email: DaSCH - Swiss National Data and Service Center for the Humanities <info@dasch.swiss>
@@ -32,7 +32,7 @@ dsp_tools/commands/create/models/server_project_info.py,sha256=k5EVYo8ZJhMMB5XKj
32
32
  dsp_tools/commands/create/parsing/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
33
33
  dsp_tools/commands/create/parsing/parse_ontology.py,sha256=4cqo2wa9wcLBszWXgPrixQgaHYPHfENQbF6dkeBVNiU,4268
34
34
  dsp_tools/commands/create/parsing/parse_project.py,sha256=CghB-pJ6RcllOP0jn8Hs50kRcxS2Q0iS8A_QNGbjzZU,4005
35
- dsp_tools/commands/create/parsing/parsing_utils.py,sha256=-kr9ulha4T6reaQsQ2lImuqKEp2w4tQi66tjm2lDa9w,1636
35
+ dsp_tools/commands/create/parsing/parsing_utils.py,sha256=X-ALTAwcQE8dBRiagb_O9D89d7WGvwnq77cNkNZDNpc,1563
36
36
  dsp_tools/commands/create/serialisation/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
37
37
  dsp_tools/commands/create/serialisation/ontology.py,sha256=NK4kjriHs7dt5fXNiIBc1z_mE9szI4YemJ--hkYYeCk,1581
38
38
  dsp_tools/commands/excel2json/CLAUDE.md,sha256=y7ZcmrHbewN48sV0wyZhNfXDXdERG4PRvdz02Mqh0gg,3399
@@ -215,7 +215,7 @@ dsp_tools/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
215
215
  dsp_tools/utils/ansi_colors.py,sha256=p2vq-wzfmE-wdDddvC26UcOA6Z1qhFTdzP0dPoW4sy0,1691
216
216
  dsp_tools/utils/data_formats/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
217
217
  dsp_tools/utils/data_formats/date_util.py,sha256=VLNQnSsUX6NB1IY3Ry5KCxCLgHHYN0TSSBRn8hyXN-4,4714
218
- dsp_tools/utils/data_formats/iri_util.py,sha256=O_TQb104ukjVsaqgkstz54QvjgqFPLSxVvqH6HVNjQc,670
218
+ dsp_tools/utils/data_formats/iri_util.py,sha256=oFcc3gcikmgJOf7iMhT4tfdUQg9wE7lUW5aysfHjylM,1030
219
219
  dsp_tools/utils/data_formats/shared.py,sha256=9AybXCAboojvRULZPud5e6B7UkjQOuN6f5fiVxwuZe8,2618
220
220
  dsp_tools/utils/data_formats/uri_util.py,sha256=9UGrbtxHVI0Ka0ttxd39KDhGeeP0xOdVLjt6HyV-Ic8,3257
221
221
  dsp_tools/utils/fuseki_bloating.py,sha256=yUCSijVf_Ne9iWUK_IzbPAkOMkN8Xt9ttPcWWRSIgMI,2381
@@ -226,7 +226,7 @@ dsp_tools/utils/replace_id_with_iri.py,sha256=5M5vXWJIQ0oO4ELwIt_5QeYBvyGESBc2sm
226
226
  dsp_tools/utils/request_utils.py,sha256=KxiFpQ_IH1ZCIF-SknPjRMP5-ZtLP3wWzwSrEZDB2fk,6902
227
227
  dsp_tools/utils/xml_parsing/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
228
228
  dsp_tools/utils/xml_parsing/get_lookups.py,sha256=RaBX_wWTmhxpvP1Ow5lbzNxekSyZ4SbuGZTFc18H1jQ,1386
229
- dsp_tools/utils/xml_parsing/get_parsed_resources.py,sha256=hlqNCo7McIYL9RiAUPNnvj4O6TuNq6xz_bFYs4KA9OI,13525
229
+ dsp_tools/utils/xml_parsing/get_parsed_resources.py,sha256=H3lLmWcBjuW5oN2fYV_Sv71brnH6E-ZsmwsceZ2l1yw,13496
230
230
  dsp_tools/utils/xml_parsing/models/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
231
231
  dsp_tools/utils/xml_parsing/models/parsed_resource.py,sha256=Fmw--ehXNgnndgqCrl7rsjncSoAZAvuaPyGL8RtZuz8,1640
232
232
  dsp_tools/utils/xml_parsing/parse_clean_validate_xml.py,sha256=EAWRrEAnSYmX056toIzPXBzAUcqJ7IDC1Bcwdy33Bqk,6565
@@ -260,7 +260,7 @@ dsp_tools/xmllib/models/res.py,sha256=c3edvilYZVDmv2O6Z36sSkHXcuKPAJLfWVpStDTMuJ
260
260
  dsp_tools/xmllib/models/root.py,sha256=x8_vrDSJ1pZUJUL8LR460dZe4Cg57G_Hy-Zfr2S29dw,13562
261
261
  dsp_tools/xmllib/value_checkers.py,sha256=Yx3r6_WoZ5Lev8Orp8yDzd03JvP2GBmFNSFT2dzrycM,10712
262
262
  dsp_tools/xmllib/value_converters.py,sha256=WMYS5hd1VlrLLBXnf6pv9yYoPBsv_2MxOO6xv-QsRW4,29218
263
- dsp_tools-17.0.0.post23.dist-info/WHEEL,sha256=M6du7VZflc4UPsGphmOXHANdgk8zessdJG0DBUuoA-U,78
264
- dsp_tools-17.0.0.post23.dist-info/entry_points.txt,sha256=qjRfEbkeAwLU_AE2Q-l4Y9irPNmu4Wna-3bfRp1bqV4,62
265
- dsp_tools-17.0.0.post23.dist-info/METADATA,sha256=xGTjapRxArzlKCmB7ia2yKNgLskGhfZtGNddQhR5iHM,4285
266
- dsp_tools-17.0.0.post23.dist-info/RECORD,,
263
+ dsp_tools-17.0.0.post25.dist-info/WHEEL,sha256=M6du7VZflc4UPsGphmOXHANdgk8zessdJG0DBUuoA-U,78
264
+ dsp_tools-17.0.0.post25.dist-info/entry_points.txt,sha256=qjRfEbkeAwLU_AE2Q-l4Y9irPNmu4Wna-3bfRp1bqV4,62
265
+ dsp_tools-17.0.0.post25.dist-info/METADATA,sha256=5P4ptenAkzZ86S1o7Uza-FbGFjpMl1nJQScnoipR_1s,4285
266
+ dsp_tools-17.0.0.post25.dist-info/RECORD,,