dsp-tools 9.1.0.post11__py3-none-any.whl → 18.3.0.post13__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.
- dsp_tools/__init__.py +4 -0
- dsp_tools/cli/args.py +36 -0
- dsp_tools/cli/call_action.py +51 -231
- dsp_tools/cli/call_action_files_only.py +101 -0
- dsp_tools/cli/call_action_with_network.py +207 -0
- dsp_tools/cli/create_parsers.py +156 -58
- dsp_tools/cli/entry_point.py +56 -26
- dsp_tools/cli/utils.py +87 -0
- dsp_tools/clients/CLAUDE.md +420 -0
- dsp_tools/clients/authentication_client.py +14 -0
- dsp_tools/clients/authentication_client_live.py +66 -0
- dsp_tools/{utils → clients}/connection.py +2 -18
- dsp_tools/clients/connection_live.py +233 -0
- dsp_tools/clients/fuseki_metrics.py +60 -0
- dsp_tools/clients/group_user_clients.py +35 -0
- dsp_tools/clients/group_user_clients_live.py +181 -0
- dsp_tools/clients/legal_info_client.py +23 -0
- dsp_tools/clients/legal_info_client_live.py +132 -0
- dsp_tools/clients/list_client.py +49 -0
- dsp_tools/clients/list_client_live.py +166 -0
- dsp_tools/clients/metadata_client.py +24 -0
- dsp_tools/clients/metadata_client_live.py +47 -0
- dsp_tools/clients/ontology_clients.py +49 -0
- dsp_tools/clients/ontology_create_client_live.py +166 -0
- dsp_tools/clients/ontology_get_client_live.py +80 -0
- dsp_tools/clients/permissions_client.py +68 -0
- dsp_tools/clients/project_client.py +16 -0
- dsp_tools/clients/project_client_live.py +66 -0
- dsp_tools/commands/create/communicate_problems.py +24 -0
- dsp_tools/commands/create/create.py +134 -0
- dsp_tools/commands/create/create_on_server/cardinalities.py +111 -0
- dsp_tools/commands/create/create_on_server/classes.py +99 -0
- dsp_tools/commands/create/create_on_server/complete_ontologies.py +116 -0
- dsp_tools/commands/create/create_on_server/default_permissions.py +134 -0
- dsp_tools/commands/create/create_on_server/group_users.py +165 -0
- dsp_tools/commands/create/create_on_server/lists.py +163 -0
- dsp_tools/commands/create/create_on_server/mappers.py +12 -0
- dsp_tools/commands/create/create_on_server/onto_utils.py +74 -0
- dsp_tools/commands/create/create_on_server/ontology.py +52 -0
- dsp_tools/commands/create/create_on_server/project.py +68 -0
- dsp_tools/commands/create/create_on_server/properties.py +119 -0
- dsp_tools/commands/create/exceptions.py +29 -0
- dsp_tools/commands/create/lists_only.py +66 -0
- dsp_tools/commands/create/models/create_problems.py +87 -0
- dsp_tools/commands/create/models/parsed_ontology.py +88 -0
- dsp_tools/commands/create/models/parsed_project.py +81 -0
- dsp_tools/commands/create/models/rdf_ontology.py +12 -0
- dsp_tools/commands/create/models/server_project_info.py +100 -0
- dsp_tools/commands/create/parsing/parse_lists.py +45 -0
- dsp_tools/commands/create/parsing/parse_ontology.py +243 -0
- dsp_tools/commands/create/parsing/parse_project.py +149 -0
- dsp_tools/commands/create/parsing/parsing_utils.py +40 -0
- dsp_tools/commands/create/project_validate.py +595 -0
- dsp_tools/commands/create/serialisation/ontology.py +119 -0
- dsp_tools/commands/create/serialisation/project.py +44 -0
- dsp_tools/commands/excel2json/CLAUDE.md +101 -0
- dsp_tools/commands/excel2json/json_header.py +57 -23
- dsp_tools/commands/excel2json/{new_lists → lists}/compliance_checks.py +26 -26
- dsp_tools/commands/excel2json/{new_lists/make_new_lists.py → lists/make_lists.py} +19 -18
- dsp_tools/commands/excel2json/{new_lists → lists}/models/input_error.py +1 -12
- dsp_tools/commands/excel2json/{new_lists → lists}/models/serialise.py +9 -5
- dsp_tools/commands/excel2json/{new_lists → lists}/utils.py +4 -4
- dsp_tools/commands/excel2json/models/input_error.py +31 -11
- dsp_tools/commands/excel2json/models/json_header.py +53 -15
- dsp_tools/commands/excel2json/models/ontology.py +4 -3
- dsp_tools/commands/excel2json/{lists.py → old_lists.py} +26 -112
- dsp_tools/commands/excel2json/project.py +78 -34
- dsp_tools/commands/excel2json/properties.py +57 -36
- dsp_tools/commands/excel2json/resources.py +32 -12
- dsp_tools/commands/excel2json/utils.py +20 -1
- dsp_tools/commands/excel2xml/__init__.py +2 -2
- dsp_tools/commands/excel2xml/excel2xml_cli.py +7 -15
- dsp_tools/commands/excel2xml/excel2xml_lib.py +138 -493
- dsp_tools/commands/excel2xml/propertyelement.py +5 -5
- dsp_tools/commands/{project → get}/get.py +29 -13
- dsp_tools/commands/get/get_permissions.py +257 -0
- dsp_tools/commands/get/get_permissions_legacy.py +89 -0
- dsp_tools/commands/{project/models → get/legacy_models}/context.py +6 -6
- dsp_tools/commands/{project/models → get/legacy_models}/group.py +5 -10
- dsp_tools/commands/{project/models → get/legacy_models}/listnode.py +5 -35
- dsp_tools/commands/{project/models → get/legacy_models}/model.py +1 -1
- dsp_tools/commands/{project/models → get/legacy_models}/ontology.py +9 -14
- dsp_tools/commands/{project/models → get/legacy_models}/project.py +13 -6
- dsp_tools/commands/{project/models → get/legacy_models}/propertyclass.py +9 -16
- dsp_tools/commands/{project/models → get/legacy_models}/resourceclass.py +8 -46
- dsp_tools/commands/{project/models → get/legacy_models}/user.py +19 -60
- dsp_tools/commands/get/models/permissions_models.py +10 -0
- dsp_tools/commands/id2iri.py +20 -10
- dsp_tools/commands/ingest_xmlupload/bulk_ingest_client.py +81 -56
- dsp_tools/commands/ingest_xmlupload/create_resources/apply_ingest_id.py +4 -10
- dsp_tools/commands/ingest_xmlupload/create_resources/upload_xml.py +97 -37
- dsp_tools/commands/ingest_xmlupload/create_resources/user_information.py +2 -2
- dsp_tools/commands/ingest_xmlupload/ingest_files/ingest_files.py +9 -10
- dsp_tools/commands/ingest_xmlupload/upload_files/filechecker.py +3 -3
- dsp_tools/commands/ingest_xmlupload/upload_files/input_error.py +2 -10
- dsp_tools/commands/ingest_xmlupload/upload_files/upload_failures.py +12 -2
- dsp_tools/commands/ingest_xmlupload/upload_files/upload_files.py +8 -9
- dsp_tools/commands/resume_xmlupload/resume_xmlupload.py +18 -18
- dsp_tools/commands/start_stack.py +126 -77
- dsp_tools/commands/update_legal/CLAUDE.md +344 -0
- dsp_tools/commands/update_legal/__init__.py +0 -0
- dsp_tools/commands/update_legal/core.py +182 -0
- dsp_tools/commands/update_legal/csv_operations.py +135 -0
- dsp_tools/commands/update_legal/models.py +87 -0
- dsp_tools/commands/update_legal/xml_operations.py +247 -0
- dsp_tools/commands/validate_data/CLAUDE.md +159 -0
- dsp_tools/commands/validate_data/__init__.py +0 -0
- dsp_tools/commands/validate_data/constants.py +59 -0
- dsp_tools/commands/validate_data/mappers.py +143 -0
- dsp_tools/commands/validate_data/models/__init__.py +0 -0
- dsp_tools/commands/validate_data/models/api_responses.py +45 -0
- dsp_tools/commands/validate_data/models/input_problems.py +119 -0
- dsp_tools/commands/validate_data/models/rdf_like_data.py +117 -0
- dsp_tools/commands/validate_data/models/validation.py +106 -0
- dsp_tools/commands/validate_data/prepare_data/__init__.py +0 -0
- dsp_tools/commands/validate_data/prepare_data/get_rdf_like_data.py +296 -0
- dsp_tools/commands/validate_data/prepare_data/make_data_graph.py +91 -0
- dsp_tools/commands/validate_data/prepare_data/prepare_data.py +184 -0
- dsp_tools/commands/validate_data/process_validation_report/__init__.py +0 -0
- dsp_tools/commands/validate_data/process_validation_report/get_user_validation_message.py +358 -0
- dsp_tools/commands/validate_data/process_validation_report/query_validation_result.py +507 -0
- dsp_tools/commands/validate_data/process_validation_report/reformat_validation_results.py +150 -0
- dsp_tools/commands/validate_data/shacl_cli_validator.py +70 -0
- dsp_tools/commands/validate_data/sparql/__init__.py +0 -0
- dsp_tools/commands/{xml_validate/sparql/resource_shacl.py → validate_data/sparql/cardinality_shacl.py} +45 -47
- dsp_tools/commands/validate_data/sparql/construct_shacl.py +92 -0
- dsp_tools/commands/validate_data/sparql/legal_info_shacl.py +36 -0
- dsp_tools/commands/validate_data/sparql/value_shacl.py +357 -0
- dsp_tools/commands/validate_data/utils.py +59 -0
- dsp_tools/commands/validate_data/validate_data.py +283 -0
- dsp_tools/commands/validate_data/validation/__init__.py +0 -0
- dsp_tools/commands/validate_data/validation/check_duplicate_files.py +55 -0
- dsp_tools/commands/validate_data/validation/check_for_unknown_classes.py +67 -0
- dsp_tools/commands/validate_data/validation/get_validation_report.py +94 -0
- dsp_tools/commands/validate_data/validation/validate_ontology.py +107 -0
- dsp_tools/commands/xmlupload/CLAUDE.md +292 -0
- dsp_tools/commands/xmlupload/make_rdf_graph/__init__.py +0 -0
- dsp_tools/commands/xmlupload/make_rdf_graph/constants.py +63 -0
- dsp_tools/commands/xmlupload/make_rdf_graph/jsonld_utils.py +44 -0
- dsp_tools/commands/xmlupload/make_rdf_graph/make_file_value.py +77 -0
- dsp_tools/commands/xmlupload/make_rdf_graph/make_resource_and_values.py +114 -0
- dsp_tools/commands/xmlupload/make_rdf_graph/make_values.py +262 -0
- dsp_tools/commands/xmlupload/models/bitstream_info.py +18 -0
- dsp_tools/commands/xmlupload/models/formatted_text_value.py +0 -25
- dsp_tools/commands/xmlupload/models/ingest.py +56 -70
- dsp_tools/commands/xmlupload/models/input_problems.py +6 -14
- dsp_tools/commands/xmlupload/models/lookup_models.py +21 -0
- dsp_tools/commands/xmlupload/models/permission.py +0 -39
- dsp_tools/commands/xmlupload/models/{deserialise/xmlpermission.py → permissions_parsed.py} +2 -2
- dsp_tools/commands/xmlupload/models/processed/__init__.py +0 -0
- dsp_tools/commands/xmlupload/models/processed/file_values.py +29 -0
- dsp_tools/commands/xmlupload/models/processed/res.py +27 -0
- dsp_tools/commands/xmlupload/models/processed/values.py +101 -0
- dsp_tools/commands/xmlupload/models/rdf_models.py +26 -0
- dsp_tools/commands/xmlupload/models/upload_clients.py +3 -3
- dsp_tools/commands/xmlupload/models/upload_state.py +2 -4
- dsp_tools/commands/xmlupload/prepare_xml_input/__init__.py +0 -0
- dsp_tools/commands/xmlupload/{ark2iri.py → prepare_xml_input/ark2iri.py} +1 -1
- dsp_tools/commands/xmlupload/prepare_xml_input/get_processed_resources.py +252 -0
- dsp_tools/commands/xmlupload/{iiif_uri_validator.py → prepare_xml_input/iiif_uri_validator.py} +2 -14
- dsp_tools/commands/xmlupload/{list_client.py → prepare_xml_input/list_client.py} +15 -10
- dsp_tools/commands/xmlupload/prepare_xml_input/prepare_xml_input.py +67 -0
- dsp_tools/commands/xmlupload/prepare_xml_input/read_validate_xml_file.py +58 -0
- dsp_tools/commands/xmlupload/prepare_xml_input/transform_input_values.py +118 -0
- dsp_tools/commands/xmlupload/resource_create_client.py +7 -468
- dsp_tools/commands/xmlupload/richtext_id2iri.py +37 -0
- dsp_tools/commands/xmlupload/stash/{construct_and_analyze_graph.py → analyse_circular_reference_graph.py} +64 -157
- dsp_tools/commands/xmlupload/stash/create_info_for_graph.py +53 -0
- dsp_tools/commands/xmlupload/stash/graph_models.py +13 -8
- dsp_tools/commands/xmlupload/stash/stash_circular_references.py +48 -115
- dsp_tools/commands/xmlupload/stash/stash_models.py +4 -9
- dsp_tools/commands/xmlupload/stash/upload_stashed_resptr_props.py +34 -40
- dsp_tools/commands/xmlupload/stash/upload_stashed_xml_texts.py +98 -108
- dsp_tools/commands/xmlupload/upload_config.py +8 -0
- dsp_tools/commands/xmlupload/write_diagnostic_info.py +14 -9
- dsp_tools/commands/xmlupload/xmlupload.py +214 -192
- dsp_tools/config/__init__.py +0 -0
- dsp_tools/config/logger_config.py +69 -0
- dsp_tools/{utils → config}/warnings_config.py +4 -1
- dsp_tools/error/__init__.py +0 -0
- dsp_tools/error/custom_warnings.py +39 -0
- dsp_tools/error/exceptions.py +204 -0
- dsp_tools/error/problems.py +10 -0
- dsp_tools/error/xmllib_errors.py +20 -0
- dsp_tools/error/xmllib_warnings.py +54 -0
- dsp_tools/error/xmllib_warnings_util.py +159 -0
- dsp_tools/error/xsd_validation_error_msg.py +19 -0
- dsp_tools/legacy_models/__init__.py +0 -0
- dsp_tools/{models → legacy_models}/datetimestamp.py +7 -7
- dsp_tools/{models → legacy_models}/langstring.py +1 -1
- dsp_tools/{models → legacy_models}/projectContext.py +4 -4
- dsp_tools/resources/schema/data.xsd +108 -83
- dsp_tools/resources/schema/lists-only.json +4 -23
- dsp_tools/resources/schema/project.json +80 -35
- dsp_tools/resources/schema/properties-only.json +1 -4
- dsp_tools/resources/start-stack/docker-compose.override-host.j2 +11 -0
- dsp_tools/resources/start-stack/docker-compose.yml +34 -30
- dsp_tools/resources/start-stack/dsp-app-config.json +45 -0
- dsp_tools/resources/start-stack/dsp-app-config.override-host.j2 +26 -0
- dsp_tools/resources/validate_data/api-shapes-resource-cardinalities.ttl +191 -0
- dsp_tools/resources/validate_data/api-shapes.ttl +804 -0
- dsp_tools/resources/validate_data/shacl-cli-image.yml +4 -0
- dsp_tools/resources/validate_data/validate-ontology.ttl +99 -0
- dsp_tools/utils/ansi_colors.py +32 -0
- dsp_tools/utils/data_formats/__init__.py +0 -0
- dsp_tools/utils/{date_util.py → data_formats/date_util.py} +13 -1
- dsp_tools/utils/data_formats/iri_util.py +30 -0
- dsp_tools/utils/{shared.py → data_formats/shared.py} +1 -35
- dsp_tools/utils/{uri_util.py → data_formats/uri_util.py} +12 -2
- dsp_tools/utils/fuseki_bloating.py +63 -0
- dsp_tools/utils/json_parsing.py +22 -0
- dsp_tools/utils/rdf_constants.py +42 -0
- dsp_tools/utils/rdflib_utils.py +10 -0
- dsp_tools/utils/replace_id_with_iri.py +66 -0
- dsp_tools/utils/request_utils.py +238 -0
- dsp_tools/utils/xml_parsing/__init__.py +0 -0
- dsp_tools/utils/xml_parsing/get_lookups.py +32 -0
- dsp_tools/utils/xml_parsing/get_parsed_resources.py +325 -0
- dsp_tools/utils/xml_parsing/models/__init__.py +0 -0
- dsp_tools/utils/xml_parsing/models/parsed_resource.py +76 -0
- dsp_tools/utils/xml_parsing/parse_clean_validate_xml.py +137 -0
- dsp_tools/xmllib/CLAUDE.md +302 -0
- dsp_tools/xmllib/__init__.py +49 -0
- dsp_tools/xmllib/general_functions.py +877 -0
- dsp_tools/xmllib/internal/__init__.py +0 -0
- dsp_tools/xmllib/internal/checkers.py +162 -0
- dsp_tools/xmllib/internal/circumvent_circular_imports.py +36 -0
- dsp_tools/xmllib/internal/constants.py +46 -0
- dsp_tools/xmllib/internal/input_converters.py +155 -0
- dsp_tools/xmllib/internal/serialise_file_value.py +57 -0
- dsp_tools/xmllib/internal/serialise_resource.py +177 -0
- dsp_tools/xmllib/internal/serialise_values.py +152 -0
- dsp_tools/xmllib/internal/type_aliases.py +11 -0
- dsp_tools/xmllib/models/config_options.py +28 -0
- dsp_tools/xmllib/models/date_formats.py +48 -0
- dsp_tools/xmllib/models/dsp_base_resources.py +1380 -400
- dsp_tools/xmllib/models/internal/__init__.py +0 -0
- dsp_tools/xmllib/models/internal/file_values.py +172 -0
- dsp_tools/xmllib/models/internal/geometry.py +162 -0
- dsp_tools/xmllib/models/{migration_metadata.py → internal/migration_metadata.py} +14 -10
- dsp_tools/xmllib/models/internal/serialise_permissions.py +66 -0
- dsp_tools/xmllib/models/internal/values.py +342 -0
- dsp_tools/xmllib/models/licenses/__init__.py +0 -0
- dsp_tools/xmllib/models/licenses/other.py +59 -0
- dsp_tools/xmllib/models/licenses/recommended.py +107 -0
- dsp_tools/xmllib/models/permissions.py +41 -0
- dsp_tools/xmllib/models/res.py +1782 -0
- dsp_tools/xmllib/models/root.py +313 -26
- dsp_tools/xmllib/value_checkers.py +310 -47
- dsp_tools/xmllib/value_converters.py +765 -8
- dsp_tools-18.3.0.post13.dist-info/METADATA +90 -0
- dsp_tools-18.3.0.post13.dist-info/RECORD +286 -0
- dsp_tools-18.3.0.post13.dist-info/WHEEL +4 -0
- {dsp_tools-9.1.0.post11.dist-info → dsp_tools-18.3.0.post13.dist-info}/entry_points.txt +1 -0
- dsp_tools/commands/project/create/project_create.py +0 -1107
- dsp_tools/commands/project/create/project_create_lists.py +0 -204
- dsp_tools/commands/project/create/project_validate.py +0 -453
- dsp_tools/commands/project/models/project_definition.py +0 -12
- dsp_tools/commands/rosetta.py +0 -124
- dsp_tools/commands/template.py +0 -30
- dsp_tools/commands/xml_validate/api_connection.py +0 -122
- dsp_tools/commands/xml_validate/deserialise_input.py +0 -135
- dsp_tools/commands/xml_validate/make_data_rdf.py +0 -193
- dsp_tools/commands/xml_validate/models/data_deserialised.py +0 -108
- dsp_tools/commands/xml_validate/models/data_rdf.py +0 -214
- dsp_tools/commands/xml_validate/models/input_problems.py +0 -191
- dsp_tools/commands/xml_validate/models/validation.py +0 -29
- dsp_tools/commands/xml_validate/reformat_validaton_result.py +0 -89
- dsp_tools/commands/xml_validate/sparql/construct_shapes.py +0 -16
- dsp_tools/commands/xml_validate/xml_validate.py +0 -151
- dsp_tools/commands/xmlupload/check_consistency_with_ontology.py +0 -253
- dsp_tools/commands/xmlupload/models/deserialise/deserialise_value.py +0 -236
- dsp_tools/commands/xmlupload/models/deserialise/xmlresource.py +0 -171
- dsp_tools/commands/xmlupload/models/namespace_context.py +0 -39
- dsp_tools/commands/xmlupload/models/ontology_lookup_models.py +0 -161
- dsp_tools/commands/xmlupload/models/ontology_problem_models.py +0 -178
- dsp_tools/commands/xmlupload/models/serialise/jsonld_serialiser.py +0 -40
- dsp_tools/commands/xmlupload/models/serialise/serialise_value.py +0 -51
- dsp_tools/commands/xmlupload/ontology_client.py +0 -92
- dsp_tools/commands/xmlupload/project_client.py +0 -91
- dsp_tools/commands/xmlupload/read_validate_xml_file.py +0 -99
- dsp_tools/models/custom_warnings.py +0 -31
- dsp_tools/models/exceptions.py +0 -90
- dsp_tools/resources/0100-template-repo/template.json +0 -45
- dsp_tools/resources/0100-template-repo/template.xml +0 -27
- dsp_tools/resources/start-stack/docker-compose-validation.yml +0 -5
- dsp_tools/resources/start-stack/start-stack-config.yml +0 -4
- dsp_tools/resources/xml_validate/api-shapes.ttl +0 -411
- dsp_tools/resources/xml_validate/replace_namespace.xslt +0 -61
- dsp_tools/utils/connection_live.py +0 -383
- dsp_tools/utils/iri_util.py +0 -14
- dsp_tools/utils/logger_config.py +0 -41
- dsp_tools/utils/set_encoder.py +0 -20
- dsp_tools/utils/xml_utils.py +0 -145
- dsp_tools/utils/xml_validation.py +0 -197
- dsp_tools/utils/xml_validation_models.py +0 -68
- dsp_tools/xmllib/models/file_values.py +0 -78
- dsp_tools/xmllib/models/resource.py +0 -415
- dsp_tools/xmllib/models/values.py +0 -428
- dsp_tools-9.1.0.post11.dist-info/METADATA +0 -130
- dsp_tools-9.1.0.post11.dist-info/RECORD +0 -167
- dsp_tools-9.1.0.post11.dist-info/WHEEL +0 -4
- dsp_tools-9.1.0.post11.dist-info/licenses/LICENSE +0 -674
- /dsp_tools/{commands/excel2json/new_lists → clients}/__init__.py +0 -0
- /dsp_tools/commands/{excel2json/new_lists/models → create}/__init__.py +0 -0
- /dsp_tools/commands/{project → create/create_on_server}/__init__.py +0 -0
- /dsp_tools/commands/{project/create → create/models}/__init__.py +0 -0
- /dsp_tools/commands/{project/models → create/parsing}/__init__.py +0 -0
- /dsp_tools/commands/{xml_validate → create/serialisation}/__init__.py +0 -0
- /dsp_tools/commands/{xml_validate/models → excel2json/lists}/__init__.py +0 -0
- /dsp_tools/commands/{xml_validate/sparql → excel2json/lists/models}/__init__.py +0 -0
- /dsp_tools/commands/excel2json/{new_lists → lists}/models/deserialise.py +0 -0
- /dsp_tools/commands/{xmlupload/models/deserialise → get}/__init__.py +0 -0
- /dsp_tools/commands/{xmlupload/models/serialise → get/legacy_models}/__init__.py +0 -0
- /dsp_tools/commands/{project/models → get/legacy_models}/helpers.py +0 -0
- /dsp_tools/{models → commands/get/models}/__init__.py +0 -0
|
@@ -1,428 +0,0 @@
|
|
|
1
|
-
from __future__ import annotations
|
|
2
|
-
|
|
3
|
-
import warnings
|
|
4
|
-
from dataclasses import dataclass
|
|
5
|
-
from typing import Any
|
|
6
|
-
from typing import Protocol
|
|
7
|
-
|
|
8
|
-
from lxml import etree
|
|
9
|
-
|
|
10
|
-
from dsp_tools.models.custom_warnings import DspToolsUserWarning
|
|
11
|
-
from dsp_tools.utils.uri_util import is_uri
|
|
12
|
-
from dsp_tools.xmllib.value_checkers import is_bool_like
|
|
13
|
-
from dsp_tools.xmllib.value_checkers import is_color
|
|
14
|
-
from dsp_tools.xmllib.value_checkers import is_date
|
|
15
|
-
from dsp_tools.xmllib.value_checkers import is_decimal
|
|
16
|
-
from dsp_tools.xmllib.value_checkers import is_geoname
|
|
17
|
-
from dsp_tools.xmllib.value_checkers import is_integer
|
|
18
|
-
from dsp_tools.xmllib.value_checkers import is_string_like
|
|
19
|
-
from dsp_tools.xmllib.value_checkers import is_timestamp
|
|
20
|
-
from dsp_tools.xmllib.value_converters import convert_to_bool_string
|
|
21
|
-
|
|
22
|
-
XML_NAMESPACE_MAP = {None: "https://dasch.swiss/schema", "xsi": "http://www.w3.org/2001/XMLSchema-instance"}
|
|
23
|
-
DASCH_SCHEMA = "{https://dasch.swiss/schema}"
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
class Value(Protocol):
|
|
27
|
-
value: Any
|
|
28
|
-
prop_name: str
|
|
29
|
-
permissions: str | None
|
|
30
|
-
comment: str | None
|
|
31
|
-
resource_id: str | None
|
|
32
|
-
|
|
33
|
-
def serialise(self) -> etree._Element:
|
|
34
|
-
raise NotImplementedError
|
|
35
|
-
|
|
36
|
-
def make_prop(self) -> etree._Element:
|
|
37
|
-
raise NotImplementedError
|
|
38
|
-
|
|
39
|
-
def make_element(self) -> etree._Element:
|
|
40
|
-
raise NotImplementedError
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
@dataclass
|
|
44
|
-
class BooleanValue:
|
|
45
|
-
value: Any
|
|
46
|
-
prop_name: str
|
|
47
|
-
permissions: str | None = "prop-default"
|
|
48
|
-
comment: str | None = None
|
|
49
|
-
resource_id: str | None = None
|
|
50
|
-
|
|
51
|
-
def __post_init__(self) -> None:
|
|
52
|
-
if not is_bool_like(self.value):
|
|
53
|
-
_warn_type_mismatch(
|
|
54
|
-
expected_type="bool", value=self.value, prop_name=self.prop_name, res_id=self.resource_id
|
|
55
|
-
)
|
|
56
|
-
self.value = convert_to_bool_string(self.value)
|
|
57
|
-
|
|
58
|
-
def serialise(self) -> etree._Element:
|
|
59
|
-
ele = self.make_prop()
|
|
60
|
-
ele.append(self.make_element())
|
|
61
|
-
return ele
|
|
62
|
-
|
|
63
|
-
def make_prop(self) -> etree._Element:
|
|
64
|
-
return etree.Element(f"{DASCH_SCHEMA}boolean-prop", name=self.prop_name, nsmap=XML_NAMESPACE_MAP)
|
|
65
|
-
|
|
66
|
-
def make_element(self) -> etree._Element:
|
|
67
|
-
attribs = {"permissions": self.permissions} if self.permissions else {}
|
|
68
|
-
if self.comment:
|
|
69
|
-
attribs["comment"] = self.comment
|
|
70
|
-
ele = etree.Element(f"{DASCH_SCHEMA}boolean", attrib=attribs, nsmap=XML_NAMESPACE_MAP)
|
|
71
|
-
ele.text = str(self.value)
|
|
72
|
-
return ele
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
@dataclass
|
|
76
|
-
class ColorValue:
|
|
77
|
-
value: Any
|
|
78
|
-
prop_name: str
|
|
79
|
-
permissions: str | None = "prop-default"
|
|
80
|
-
comment: str | None = None
|
|
81
|
-
resource_id: str | None = None
|
|
82
|
-
|
|
83
|
-
def __post_init__(self) -> None:
|
|
84
|
-
if not is_color(self.value):
|
|
85
|
-
_warn_type_mismatch(
|
|
86
|
-
expected_type="color", value=self.value, prop_name=self.prop_name, res_id=self.resource_id
|
|
87
|
-
)
|
|
88
|
-
|
|
89
|
-
def serialise(self) -> etree._Element:
|
|
90
|
-
ele = self.make_prop()
|
|
91
|
-
ele.append(self.make_element())
|
|
92
|
-
return ele
|
|
93
|
-
|
|
94
|
-
def make_prop(self) -> etree._Element:
|
|
95
|
-
return etree.Element(f"{DASCH_SCHEMA}color-prop", name=self.prop_name, nsmap=XML_NAMESPACE_MAP)
|
|
96
|
-
|
|
97
|
-
def make_element(self) -> etree._Element:
|
|
98
|
-
attribs = {"permissions": self.permissions} if self.permissions else {}
|
|
99
|
-
if self.comment:
|
|
100
|
-
attribs["comment"] = self.comment
|
|
101
|
-
ele = etree.Element(f"{DASCH_SCHEMA}color", attrib=attribs, nsmap=XML_NAMESPACE_MAP)
|
|
102
|
-
ele.text = str(self.value)
|
|
103
|
-
return ele
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
@dataclass
|
|
107
|
-
class DateValue:
|
|
108
|
-
value: str
|
|
109
|
-
prop_name: str
|
|
110
|
-
permissions: str | None = "prop-default"
|
|
111
|
-
comment: str | None = None
|
|
112
|
-
resource_id: str | None = None
|
|
113
|
-
|
|
114
|
-
def __post_init__(self) -> None:
|
|
115
|
-
if not is_date(self.value):
|
|
116
|
-
_warn_type_mismatch(
|
|
117
|
-
expected_type="date", value=self.value, prop_name=self.prop_name, res_id=self.resource_id
|
|
118
|
-
)
|
|
119
|
-
|
|
120
|
-
def serialise(self) -> etree._Element:
|
|
121
|
-
ele = self.make_prop()
|
|
122
|
-
ele.append(self.make_element())
|
|
123
|
-
return ele
|
|
124
|
-
|
|
125
|
-
def make_prop(self) -> etree._Element:
|
|
126
|
-
return etree.Element(f"{DASCH_SCHEMA}date-prop", name=self.prop_name, nsmap=XML_NAMESPACE_MAP)
|
|
127
|
-
|
|
128
|
-
def make_element(self) -> etree._Element:
|
|
129
|
-
attribs = {"permissions": self.permissions} if self.permissions else {}
|
|
130
|
-
if self.comment:
|
|
131
|
-
attribs["comment"] = self.comment
|
|
132
|
-
ele = etree.Element(f"{DASCH_SCHEMA}date", attrib=attribs, nsmap=XML_NAMESPACE_MAP)
|
|
133
|
-
ele.text = str(self.value)
|
|
134
|
-
return ele
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
@dataclass
|
|
138
|
-
class DecimalValue:
|
|
139
|
-
value: Any
|
|
140
|
-
prop_name: str
|
|
141
|
-
permissions: str | None = "prop-default"
|
|
142
|
-
comment: str | None = None
|
|
143
|
-
resource_id: str | None = None
|
|
144
|
-
|
|
145
|
-
def __post_init__(self) -> None:
|
|
146
|
-
if not is_decimal(self.value):
|
|
147
|
-
_warn_type_mismatch(
|
|
148
|
-
expected_type="decimal", value=self.value, prop_name=self.prop_name, res_id=self.resource_id
|
|
149
|
-
)
|
|
150
|
-
|
|
151
|
-
def serialise(self) -> etree._Element:
|
|
152
|
-
ele = self.make_prop()
|
|
153
|
-
ele.append(self.make_element())
|
|
154
|
-
return ele
|
|
155
|
-
|
|
156
|
-
def make_prop(self) -> etree._Element:
|
|
157
|
-
return etree.Element(f"{DASCH_SCHEMA}decimal-prop", name=self.prop_name, nsmap=XML_NAMESPACE_MAP)
|
|
158
|
-
|
|
159
|
-
def make_element(self) -> etree._Element:
|
|
160
|
-
attribs = {"permissions": self.permissions} if self.permissions else {}
|
|
161
|
-
if self.comment:
|
|
162
|
-
attribs["comment"] = self.comment
|
|
163
|
-
ele = etree.Element(f"{DASCH_SCHEMA}decimal", attrib=attribs, nsmap=XML_NAMESPACE_MAP)
|
|
164
|
-
ele.text = str(self.value)
|
|
165
|
-
return ele
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
@dataclass
|
|
169
|
-
class GeonameValue:
|
|
170
|
-
value: Any
|
|
171
|
-
prop_name: str
|
|
172
|
-
permissions: str | None = "prop-default"
|
|
173
|
-
comment: str | None = None
|
|
174
|
-
resource_id: str | None = None
|
|
175
|
-
|
|
176
|
-
def __post_init__(self) -> None:
|
|
177
|
-
if not is_geoname(self.value):
|
|
178
|
-
_warn_type_mismatch(
|
|
179
|
-
expected_type="geoname", value=self.value, prop_name=self.prop_name, res_id=self.resource_id
|
|
180
|
-
)
|
|
181
|
-
|
|
182
|
-
def serialise(self) -> etree._Element:
|
|
183
|
-
ele = self.make_prop()
|
|
184
|
-
ele.append(self.make_element())
|
|
185
|
-
return ele
|
|
186
|
-
|
|
187
|
-
def make_prop(self) -> etree._Element:
|
|
188
|
-
return etree.Element(f"{DASCH_SCHEMA}geoname-prop", name=self.prop_name, nsmap=XML_NAMESPACE_MAP)
|
|
189
|
-
|
|
190
|
-
def make_element(self) -> etree._Element:
|
|
191
|
-
attribs = {"permissions": self.permissions} if self.permissions else {}
|
|
192
|
-
if self.comment:
|
|
193
|
-
attribs["comment"] = self.comment
|
|
194
|
-
ele = etree.Element(f"{DASCH_SCHEMA}geoname", attrib=attribs, nsmap=XML_NAMESPACE_MAP)
|
|
195
|
-
ele.text = str(self.value)
|
|
196
|
-
return ele
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
@dataclass
|
|
200
|
-
class IntValue:
|
|
201
|
-
value: int | str
|
|
202
|
-
prop_name: str
|
|
203
|
-
permissions: str | None = "prop-default"
|
|
204
|
-
comment: str | None = None
|
|
205
|
-
resource_id: str | None = None
|
|
206
|
-
|
|
207
|
-
def __post_init__(self) -> None:
|
|
208
|
-
if not is_integer(self.value):
|
|
209
|
-
_warn_type_mismatch(
|
|
210
|
-
expected_type="integer", value=self.value, prop_name=self.prop_name, res_id=self.resource_id
|
|
211
|
-
)
|
|
212
|
-
|
|
213
|
-
def serialise(self) -> etree._Element:
|
|
214
|
-
ele = self.make_prop()
|
|
215
|
-
ele.append(self.make_element())
|
|
216
|
-
return ele
|
|
217
|
-
|
|
218
|
-
def make_prop(self) -> etree._Element:
|
|
219
|
-
return etree.Element(f"{DASCH_SCHEMA}integer-prop", name=self.prop_name, nsmap=XML_NAMESPACE_MAP)
|
|
220
|
-
|
|
221
|
-
def make_element(self) -> etree._Element:
|
|
222
|
-
attribs = {"permissions": self.permissions} if self.permissions else {}
|
|
223
|
-
if self.comment:
|
|
224
|
-
attribs["comment"] = self.comment
|
|
225
|
-
ele = etree.Element(f"{DASCH_SCHEMA}integer", attrib=attribs, nsmap=XML_NAMESPACE_MAP)
|
|
226
|
-
ele.text = str(self.value)
|
|
227
|
-
return ele
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
@dataclass
|
|
231
|
-
class LinkValue:
|
|
232
|
-
value: str
|
|
233
|
-
prop_name: str
|
|
234
|
-
permissions: str | None = "prop-default"
|
|
235
|
-
comment: str | None = None
|
|
236
|
-
resource_id: str | None = None
|
|
237
|
-
|
|
238
|
-
def __post_init__(self) -> None:
|
|
239
|
-
if not is_string_like(self.value):
|
|
240
|
-
_warn_type_mismatch(
|
|
241
|
-
expected_type="string", value=self.value, prop_name=self.prop_name, res_id=self.resource_id
|
|
242
|
-
)
|
|
243
|
-
|
|
244
|
-
def serialise(self) -> etree._Element:
|
|
245
|
-
ele = self.make_prop()
|
|
246
|
-
ele.append(self.make_element())
|
|
247
|
-
return ele
|
|
248
|
-
|
|
249
|
-
def make_prop(self) -> etree._Element:
|
|
250
|
-
return etree.Element(f"{DASCH_SCHEMA}resptr-prop", name=self.prop_name, nsmap=XML_NAMESPACE_MAP)
|
|
251
|
-
|
|
252
|
-
def make_element(self) -> etree._Element:
|
|
253
|
-
attribs = {"permissions": self.permissions} if self.permissions else {}
|
|
254
|
-
if self.comment:
|
|
255
|
-
attribs["comment"] = self.comment
|
|
256
|
-
ele = etree.Element(f"{DASCH_SCHEMA}resptr", attrib=attribs, nsmap=XML_NAMESPACE_MAP)
|
|
257
|
-
ele.text = self.value
|
|
258
|
-
return ele
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
@dataclass
|
|
262
|
-
class ListValue:
|
|
263
|
-
value: Any
|
|
264
|
-
list_name: Any
|
|
265
|
-
prop_name: str
|
|
266
|
-
permissions: str | None = "prop-default"
|
|
267
|
-
comment: str | None = None
|
|
268
|
-
resource_id: str | None = None
|
|
269
|
-
|
|
270
|
-
def __post_init__(self) -> None:
|
|
271
|
-
if not is_string_like(self.value) or not is_string_like(self.list_name):
|
|
272
|
-
_warn_type_mismatch(
|
|
273
|
-
expected_type="list", value=self.value, prop_name=self.prop_name, res_id=self.resource_id
|
|
274
|
-
)
|
|
275
|
-
|
|
276
|
-
def serialise(self) -> etree._Element:
|
|
277
|
-
ele = self.make_prop()
|
|
278
|
-
ele.append(self.make_element())
|
|
279
|
-
return ele
|
|
280
|
-
|
|
281
|
-
def make_prop(self) -> etree._Element:
|
|
282
|
-
return etree.Element(
|
|
283
|
-
f"{DASCH_SCHEMA}list-prop", name=self.prop_name, list=self.list_name, nsmap=XML_NAMESPACE_MAP
|
|
284
|
-
)
|
|
285
|
-
|
|
286
|
-
def make_element(self) -> etree._Element:
|
|
287
|
-
attribs = {"permissions": self.permissions} if self.permissions else {}
|
|
288
|
-
if self.comment:
|
|
289
|
-
attribs["comment"] = self.comment
|
|
290
|
-
ele = etree.Element(f"{DASCH_SCHEMA}list", attrib=attribs, nsmap=XML_NAMESPACE_MAP)
|
|
291
|
-
ele.text = self.value
|
|
292
|
-
return ele
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
@dataclass
|
|
296
|
-
class SimpleText:
|
|
297
|
-
value: str
|
|
298
|
-
prop_name: str
|
|
299
|
-
permissions: str | None = "prop-default"
|
|
300
|
-
comment: str | None = None
|
|
301
|
-
resource_id: str | None = None
|
|
302
|
-
|
|
303
|
-
def __post_init__(self) -> None:
|
|
304
|
-
if not is_string_like(self.value):
|
|
305
|
-
_warn_type_mismatch(
|
|
306
|
-
expected_type="string", value=self.value, prop_name=self.prop_name, res_id=self.resource_id
|
|
307
|
-
)
|
|
308
|
-
|
|
309
|
-
def serialise(self) -> etree._Element:
|
|
310
|
-
ele = self.make_prop()
|
|
311
|
-
ele.append(self.make_element())
|
|
312
|
-
return ele
|
|
313
|
-
|
|
314
|
-
def make_prop(self) -> etree._Element:
|
|
315
|
-
return etree.Element(f"{DASCH_SCHEMA}text-prop", name=self.prop_name, nsmap=XML_NAMESPACE_MAP)
|
|
316
|
-
|
|
317
|
-
def make_element(self) -> etree._Element:
|
|
318
|
-
attribs = {"encoding": "utf8"}
|
|
319
|
-
if self.permissions:
|
|
320
|
-
attribs["permissions"] = self.permissions
|
|
321
|
-
if self.comment:
|
|
322
|
-
attribs["comment"] = self.comment
|
|
323
|
-
ele = etree.Element(f"{DASCH_SCHEMA}text", attrib=attribs, nsmap=XML_NAMESPACE_MAP)
|
|
324
|
-
ele.text = self.value
|
|
325
|
-
return ele
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
@dataclass
|
|
329
|
-
class Richtext:
|
|
330
|
-
value: str
|
|
331
|
-
prop_name: str
|
|
332
|
-
permissions: str | None = "prop-default"
|
|
333
|
-
comment: str | None = None
|
|
334
|
-
resource_id: str | None = None
|
|
335
|
-
|
|
336
|
-
def __post_init__(self) -> None:
|
|
337
|
-
if not is_string_like(self.value):
|
|
338
|
-
_warn_type_mismatch(
|
|
339
|
-
expected_type="string", value=self.value, prop_name=self.prop_name, res_id=self.resource_id
|
|
340
|
-
)
|
|
341
|
-
|
|
342
|
-
def serialise(self) -> etree._Element:
|
|
343
|
-
ele = self.make_prop()
|
|
344
|
-
ele.append(self.make_element())
|
|
345
|
-
return ele
|
|
346
|
-
|
|
347
|
-
def make_prop(self) -> etree._Element:
|
|
348
|
-
return etree.Element(f"{DASCH_SCHEMA}text-prop", name=self.prop_name, nsmap=XML_NAMESPACE_MAP)
|
|
349
|
-
|
|
350
|
-
def make_element(self) -> etree._Element:
|
|
351
|
-
attribs = {"encoding": "xml"}
|
|
352
|
-
if self.permissions:
|
|
353
|
-
attribs["permissions"] = self.permissions
|
|
354
|
-
if self.comment:
|
|
355
|
-
attribs["comment"] = self.comment
|
|
356
|
-
ele = etree.Element(f"{DASCH_SCHEMA}text", attrib=attribs, nsmap=XML_NAMESPACE_MAP)
|
|
357
|
-
ele.text = self.value
|
|
358
|
-
return ele
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
@dataclass
|
|
362
|
-
class TimeValue:
|
|
363
|
-
value: str
|
|
364
|
-
prop_name: str
|
|
365
|
-
permissions: str | None = "prop-default"
|
|
366
|
-
comment: str | None = None
|
|
367
|
-
resource_id: str | None = None
|
|
368
|
-
|
|
369
|
-
def __post_init__(self) -> None:
|
|
370
|
-
if not is_timestamp(self.value):
|
|
371
|
-
_warn_type_mismatch(
|
|
372
|
-
expected_type="timestamp", value=self.value, prop_name=self.prop_name, res_id=self.resource_id
|
|
373
|
-
)
|
|
374
|
-
|
|
375
|
-
def serialise(self) -> etree._Element:
|
|
376
|
-
ele = self.make_prop()
|
|
377
|
-
ele.append(self.make_element())
|
|
378
|
-
return ele
|
|
379
|
-
|
|
380
|
-
def make_prop(self) -> etree._Element:
|
|
381
|
-
return etree.Element(f"{DASCH_SCHEMA}time-prop", name=self.prop_name, nsmap=XML_NAMESPACE_MAP)
|
|
382
|
-
|
|
383
|
-
def make_element(self) -> etree._Element:
|
|
384
|
-
attribs = {"permissions": self.permissions} if self.permissions else {}
|
|
385
|
-
if self.comment:
|
|
386
|
-
attribs["comment"] = self.comment
|
|
387
|
-
ele = etree.Element(f"{DASCH_SCHEMA}time", attrib=attribs, nsmap=XML_NAMESPACE_MAP)
|
|
388
|
-
ele.text = self.value
|
|
389
|
-
return ele
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
@dataclass
|
|
393
|
-
class UriValue:
|
|
394
|
-
value: str
|
|
395
|
-
prop_name: str
|
|
396
|
-
permissions: str | None = "prop-default"
|
|
397
|
-
comment: str | None = None
|
|
398
|
-
resource_id: str | None = None
|
|
399
|
-
|
|
400
|
-
def __post_init__(self) -> None:
|
|
401
|
-
if not is_uri(self.value):
|
|
402
|
-
_warn_type_mismatch(
|
|
403
|
-
expected_type="uri", value=self.value, prop_name=self.prop_name, res_id=self.resource_id
|
|
404
|
-
)
|
|
405
|
-
|
|
406
|
-
def serialise(self) -> etree._Element:
|
|
407
|
-
ele = self.make_prop()
|
|
408
|
-
ele.append(self.make_element())
|
|
409
|
-
return ele
|
|
410
|
-
|
|
411
|
-
def make_prop(self) -> etree._Element:
|
|
412
|
-
return etree.Element(f"{DASCH_SCHEMA}uri-prop", name=self.prop_name, nsmap=XML_NAMESPACE_MAP)
|
|
413
|
-
|
|
414
|
-
def make_element(self) -> etree._Element:
|
|
415
|
-
attribs = {"permissions": self.permissions} if self.permissions else {}
|
|
416
|
-
if self.comment:
|
|
417
|
-
attribs["comment"] = self.comment
|
|
418
|
-
ele = etree.Element(f"{DASCH_SCHEMA}uri", attrib=attribs, nsmap=XML_NAMESPACE_MAP)
|
|
419
|
-
ele.text = self.value
|
|
420
|
-
return ele
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
def _warn_type_mismatch(expected_type: str, value: Any, prop_name: str, res_id: str | None) -> None:
|
|
424
|
-
"""Emits a warning if a values is not in the expected format."""
|
|
425
|
-
msg = f"At the following location a '{expected_type}' does not conform to the expected format.\n"
|
|
426
|
-
msg += f"Resource: {res_id} | " if res_id else ""
|
|
427
|
-
msg += f"Value: {value} | Property: {prop_name}"
|
|
428
|
-
warnings.warn(DspToolsUserWarning(msg))
|
|
@@ -1,130 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.3
|
|
2
|
-
Name: dsp-tools
|
|
3
|
-
Version: 9.1.0.post11
|
|
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
|
-
Project-URL: Homepage, https://www.dasch.swiss/
|
|
6
|
-
Project-URL: Documentation, https://docs.dasch.swiss/latest/DSP-TOOLS/
|
|
7
|
-
Project-URL: Repository, https://github.com/dasch-swiss/dsp-tools.git
|
|
8
|
-
Author-email: DaSCH - Swiss National Data and Service Center for the Humanities <info@dasch.swiss>
|
|
9
|
-
License-File: LICENSE
|
|
10
|
-
Classifier: License :: OSI Approved :: GNU General Public License v3 (GPLv3)
|
|
11
|
-
Classifier: Operating System :: OS Independent
|
|
12
|
-
Classifier: Programming Language :: Python :: 3
|
|
13
|
-
Requires-Python: >=3.12
|
|
14
|
-
Requires-Dist: argparse>=1.4.0
|
|
15
|
-
Requires-Dist: jsonpath-ng>=1.6.1
|
|
16
|
-
Requires-Dist: jsonschema>=4.23.0
|
|
17
|
-
Requires-Dist: loguru>=0.7.2
|
|
18
|
-
Requires-Dist: lxml>=5.3.0
|
|
19
|
-
Requires-Dist: namedentities>=1.9.4
|
|
20
|
-
Requires-Dist: networkx>=3.3
|
|
21
|
-
Requires-Dist: openpyxl>=3.1.5
|
|
22
|
-
Requires-Dist: packaging>=24.1
|
|
23
|
-
Requires-Dist: pandas[excel]>=2.2.2
|
|
24
|
-
Requires-Dist: pyld>=2.0.4
|
|
25
|
-
Requires-Dist: pyyaml>=6.0.2
|
|
26
|
-
Requires-Dist: rdflib>=7.0.0
|
|
27
|
-
Requires-Dist: regex>=2024.9.11
|
|
28
|
-
Requires-Dist: requests>=2.32.3
|
|
29
|
-
Requires-Dist: rustworkx>=0.15.1
|
|
30
|
-
Requires-Dist: termcolor>=2.4.0
|
|
31
|
-
Requires-Dist: tqdm>=4.66.5
|
|
32
|
-
Description-Content-Type: text/markdown
|
|
33
|
-
|
|
34
|
-
[](https://pypi.org/project/dsp-tools/)
|
|
35
|
-
[](https://pypi.org/project/dsp-tools/)
|
|
36
|
-
[](https://github.com/astral-sh/ruff)
|
|
37
|
-
[](https://github.com/python/mypy)
|
|
38
|
-
[](https://github.com/igorshubovych/markdownlint-cli)
|
|
39
|
-
[](https://www.npmjs.com/package/markdown-link-validator)
|
|
40
|
-
|
|
41
|
-
# DSP-TOOLS Documentation
|
|
42
|
-
|
|
43
|
-
DSP-TOOLS is a Python package with a command line interface
|
|
44
|
-
that helps you interact with a DSP server.
|
|
45
|
-
A DSP server is a remote server or a local machine
|
|
46
|
-
where the [DSP-API](https://github.com/dasch-swiss/dsp-api) is running on.
|
|
47
|
-
|
|
48
|
-
To install the latest version, run:
|
|
49
|
-
|
|
50
|
-
```bash
|
|
51
|
-
pip3 install dsp-tools
|
|
52
|
-
```
|
|
53
|
-
|
|
54
|
-
To update to the latest version run:
|
|
55
|
-
|
|
56
|
-
```bash
|
|
57
|
-
pip3 install --upgrade dsp-tools
|
|
58
|
-
```
|
|
59
|
-
|
|
60
|
-
The two main tasks that DSP-TOOLS serves for are:
|
|
61
|
-
|
|
62
|
-
- **Create a project with its data model(s), described in a JSON file, on a DSP server**
|
|
63
|
-
In order to archive your data on the DaSCH Service Platform,
|
|
64
|
-
you need a data model that describes your data.
|
|
65
|
-
The data model is defined in a JSON project definition file
|
|
66
|
-
which has to be transmitted to the DSP server.
|
|
67
|
-
If the DSP server is aware of the data model for your project,
|
|
68
|
-
conforming data can be uploaded into the DSP repository.
|
|
69
|
-
- **Upload data, described in an XML file, to a DSP server that has a project with a matching data model**
|
|
70
|
-
Sometimes, data is added in large quantities.
|
|
71
|
-
Therefore, DSP-TOOLS allows you to perform bulk imports of your data.
|
|
72
|
-
In order to do so, the data has to be described in an XML file.
|
|
73
|
-
DSP-TOOLS is able to read the XML file
|
|
74
|
-
and upload all data to the DSP server.
|
|
75
|
-
|
|
76
|
-
All functionalities of DSP-TOOLS revolve around these two basic tasks.
|
|
77
|
-
|
|
78
|
-
DSP-TOOLS provides the following functionalities:
|
|
79
|
-
|
|
80
|
-
- [`dsp-tools create`](https://docs.dasch.swiss/latest/DSP-TOOLS/cli-commands/#create)
|
|
81
|
-
creates the project with its data model(s) on a DSP server from a JSON file.
|
|
82
|
-
- [`dsp-tools get`](https://docs.dasch.swiss/latest/DSP-TOOLS/cli-commands#get)
|
|
83
|
-
reads a project with its data model(s) from
|
|
84
|
-
a DSP server and writes it into a JSON file.
|
|
85
|
-
- [`dsp-tools xmlupload`](https://docs.dasch.swiss/latest/DSP-TOOLS/cli-commands/#xmlupload)
|
|
86
|
-
uploads data from an XML file (bulk data import)
|
|
87
|
-
and writes the mapping from internal IDs to IRIs into a local file.
|
|
88
|
-
- New workflow for `xmlupload`:
|
|
89
|
-
- [`dsp-tools upload-files`](https://docs.dasch.swiss/latest/DSP-TOOLS/cli-commands/#upload-files)
|
|
90
|
-
uploads all files that are referenced in an XML file to a DSP server.
|
|
91
|
-
- [`dsp-tools ingest-files`](https://docs.dasch.swiss/latest/DSP-TOOLS/cli-commands/#ingest-files)
|
|
92
|
-
kicks off the ingest process, and retrieves the mapping CSV when it is finished.
|
|
93
|
-
- [`dsp-tools ingest-xmlupload`](https://docs.dasch.swiss/latest/DSP-TOOLS/cli-commands/#ingest-xmlupload)
|
|
94
|
-
creates the resources contained in the XML file, using the mapping CSV
|
|
95
|
-
- [`dsp-tools resume-xmlupload`](https://docs.dasch.swiss/latest/DSP-TOOLS/cli-commands/#resume-xmlupload)
|
|
96
|
-
resumes a previously interrupted `xmlupload` or `ingest-xmlupload`.
|
|
97
|
-
- [`dsp-tools excel2json`](https://docs.dasch.swiss/latest/DSP-TOOLS/cli-commands/#excel2json)
|
|
98
|
-
creates an entire JSON project file from a folder with Excel files in it.
|
|
99
|
-
- [`dsp-tools excel2lists`](https://docs.dasch.swiss/latest/DSP-TOOLS/cli-commands/#excel2lists)
|
|
100
|
-
creates the "lists" section of a JSON project file from one or several Excel files.
|
|
101
|
-
The resulting section can be integrated into a JSON project file
|
|
102
|
-
and then be uploaded to a DSP server with `dsp-tools create`.
|
|
103
|
-
- [`dsp-tools excel2resources`](https://docs.dasch.swiss/latest/DSP-TOOLS/cli-commands/#excel2resources)
|
|
104
|
-
creates the "resources" section of a JSON project file from an Excel file.
|
|
105
|
-
The resulting section can be integrated into a JSON project file
|
|
106
|
-
and then be uploaded to a DSP server with `dsp-tools create`.
|
|
107
|
-
- [`dsp-tools excel2properties`](https://docs.dasch.swiss/latest/DSP-TOOLS/cli-commands/#excel2properties)
|
|
108
|
-
creates the "properties" section of a JSON project file from an Excel file.
|
|
109
|
-
The resulting section can be integrated into a JSON project file
|
|
110
|
-
and then be uploaded to a DSP server with `dsp-tools create`.
|
|
111
|
-
- [`dsp-tools new-excel2json`](https://docs.dasch.swiss/latest/DSP-TOOLS/cli-commands/#new-excel2json)
|
|
112
|
-
does the same as the old `excel2json` command, but the Excel format for the `lists` section has been adapted.
|
|
113
|
-
- [`dsp-tools new-excel2lists`](https://docs.dasch.swiss/latest/DSP-TOOLS/cli-commands/#new-excel2lists)
|
|
114
|
-
does the same as the old `excel2lists` command, but the Excel format has been adapted.
|
|
115
|
-
- [`dsp-tools excel2xml`](https://docs.dasch.swiss/latest/DSP-TOOLS/cli-commands/#excel2xml)
|
|
116
|
-
transforms a data source to XML
|
|
117
|
-
if it is already structured according to the DSP specifications.
|
|
118
|
-
- [The module `excel2xml`](https://docs.dasch.swiss/latest/DSP-TOOLS/excel2xml-module)
|
|
119
|
-
provides helper methods that can be used in a Python script
|
|
120
|
-
to convert data from a tabular format into XML.
|
|
121
|
-
- [`dsp-tools id2iri`](https://docs.dasch.swiss/latest/DSP-TOOLS/cli-commands/#id2iri)
|
|
122
|
-
takes an XML file for bulk data import and replaces referenced internal IDs with IRIs.
|
|
123
|
-
The mapping has to be provided with a JSON file.
|
|
124
|
-
- [`dsp-tools start-stack / stop-stack`](https://docs.dasch.swiss/latest/DSP-TOOLS/cli-commands/#start-stack)
|
|
125
|
-
assist you in running a DSP stack on your local machine.
|
|
126
|
-
- [`dsp-tools template`](https://docs.dasch.swiss/latest/DSP-TOOLS/cli-commands/#template)
|
|
127
|
-
creates a template repository with a minimal JSON and XML file.
|
|
128
|
-
- [`dsp-tools rosetta`](https://docs.dasch.swiss/latest/DSP-TOOLS/cli-commands/#rosetta)
|
|
129
|
-
clones the most up to date rosetta repository,
|
|
130
|
-
creates the data model and uploads the data.
|