dsp-tools 0.9.13__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 +5 -0
- dsp_tools/cli/args.py +47 -0
- dsp_tools/cli/call_action.py +85 -0
- 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 +479 -0
- dsp_tools/cli/entry_point.py +322 -0
- 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/clients/connection.py +35 -0
- 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 +321 -0
- dsp_tools/commands/excel2json/lists/__init__.py +0 -0
- dsp_tools/commands/excel2json/lists/compliance_checks.py +292 -0
- dsp_tools/commands/excel2json/lists/make_lists.py +247 -0
- dsp_tools/commands/excel2json/lists/models/__init__.py +0 -0
- dsp_tools/commands/excel2json/lists/models/deserialise.py +30 -0
- dsp_tools/commands/excel2json/lists/models/input_error.py +216 -0
- dsp_tools/commands/excel2json/lists/models/serialise.py +57 -0
- dsp_tools/commands/excel2json/lists/utils.py +81 -0
- dsp_tools/commands/excel2json/models/__init__.py +0 -0
- dsp_tools/commands/excel2json/models/input_error.py +416 -0
- dsp_tools/commands/excel2json/models/json_header.py +175 -0
- dsp_tools/commands/excel2json/models/list_node_name.py +16 -0
- dsp_tools/commands/excel2json/models/ontology.py +76 -0
- dsp_tools/commands/excel2json/old_lists.py +328 -0
- dsp_tools/commands/excel2json/project.py +280 -0
- dsp_tools/commands/excel2json/properties.py +370 -0
- dsp_tools/commands/excel2json/resources.py +336 -0
- dsp_tools/commands/excel2json/utils.py +352 -0
- dsp_tools/commands/excel2xml/__init__.py +7 -0
- dsp_tools/commands/excel2xml/excel2xml_cli.py +523 -0
- dsp_tools/commands/excel2xml/excel2xml_lib.py +1953 -0
- dsp_tools/commands/excel2xml/propertyelement.py +47 -0
- dsp_tools/commands/get/__init__.py +0 -0
- dsp_tools/commands/get/get.py +166 -0
- dsp_tools/commands/get/get_permissions.py +257 -0
- dsp_tools/commands/get/get_permissions_legacy.py +89 -0
- dsp_tools/commands/get/legacy_models/__init__.py +0 -0
- dsp_tools/commands/get/legacy_models/context.py +318 -0
- dsp_tools/commands/get/legacy_models/group.py +241 -0
- dsp_tools/commands/get/legacy_models/helpers.py +47 -0
- dsp_tools/commands/get/legacy_models/listnode.py +390 -0
- dsp_tools/commands/get/legacy_models/model.py +12 -0
- dsp_tools/commands/get/legacy_models/ontology.py +324 -0
- dsp_tools/commands/get/legacy_models/project.py +366 -0
- dsp_tools/commands/get/legacy_models/propertyclass.py +417 -0
- dsp_tools/commands/get/legacy_models/resourceclass.py +676 -0
- dsp_tools/commands/get/legacy_models/user.py +438 -0
- dsp_tools/commands/get/models/__init__.py +0 -0
- dsp_tools/commands/get/models/permissions_models.py +10 -0
- dsp_tools/commands/id2iri.py +258 -0
- dsp_tools/commands/ingest_xmlupload/__init__.py +0 -0
- dsp_tools/commands/ingest_xmlupload/bulk_ingest_client.py +178 -0
- dsp_tools/commands/ingest_xmlupload/create_resources/__init__.py +0 -0
- dsp_tools/commands/ingest_xmlupload/create_resources/apply_ingest_id.py +69 -0
- dsp_tools/commands/ingest_xmlupload/create_resources/upload_xml.py +166 -0
- dsp_tools/commands/ingest_xmlupload/create_resources/user_information.py +121 -0
- dsp_tools/commands/ingest_xmlupload/ingest_files/__init__.py +0 -0
- dsp_tools/commands/ingest_xmlupload/ingest_files/ingest_files.py +64 -0
- dsp_tools/commands/ingest_xmlupload/upload_files/__init__.py +0 -0
- dsp_tools/commands/ingest_xmlupload/upload_files/filechecker.py +20 -0
- dsp_tools/commands/ingest_xmlupload/upload_files/input_error.py +57 -0
- dsp_tools/commands/ingest_xmlupload/upload_files/upload_failures.py +66 -0
- dsp_tools/commands/ingest_xmlupload/upload_files/upload_files.py +67 -0
- dsp_tools/commands/resume_xmlupload/__init__.py +0 -0
- dsp_tools/commands/resume_xmlupload/resume_xmlupload.py +96 -0
- dsp_tools/commands/start_stack.py +428 -0
- 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/validate_data/sparql/cardinality_shacl.py +209 -0
- 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/__init__.py +0 -0
- dsp_tools/commands/xmlupload/iri_resolver.py +21 -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/__init__.py +0 -0
- dsp_tools/commands/xmlupload/models/bitstream_info.py +18 -0
- dsp_tools/commands/xmlupload/models/formatted_text_value.py +10 -0
- dsp_tools/commands/xmlupload/models/ingest.py +143 -0
- dsp_tools/commands/xmlupload/models/input_problems.py +58 -0
- dsp_tools/commands/xmlupload/models/lookup_models.py +21 -0
- dsp_tools/commands/xmlupload/models/permission.py +45 -0
- dsp_tools/commands/xmlupload/models/permissions_parsed.py +93 -0
- 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 +14 -0
- dsp_tools/commands/xmlupload/models/upload_state.py +20 -0
- dsp_tools/commands/xmlupload/prepare_xml_input/__init__.py +0 -0
- dsp_tools/commands/xmlupload/prepare_xml_input/ark2iri.py +55 -0
- dsp_tools/commands/xmlupload/prepare_xml_input/get_processed_resources.py +252 -0
- dsp_tools/commands/xmlupload/prepare_xml_input/iiif_uri_validator.py +50 -0
- dsp_tools/commands/xmlupload/prepare_xml_input/list_client.py +120 -0
- 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 +25 -0
- dsp_tools/commands/xmlupload/richtext_id2iri.py +37 -0
- dsp_tools/commands/xmlupload/stash/__init__.py +0 -0
- dsp_tools/commands/xmlupload/stash/analyse_circular_reference_graph.py +236 -0
- dsp_tools/commands/xmlupload/stash/create_info_for_graph.py +53 -0
- dsp_tools/commands/xmlupload/stash/graph_models.py +87 -0
- dsp_tools/commands/xmlupload/stash/stash_circular_references.py +68 -0
- dsp_tools/commands/xmlupload/stash/stash_models.py +109 -0
- dsp_tools/commands/xmlupload/stash/upload_stashed_resptr_props.py +106 -0
- dsp_tools/commands/xmlupload/stash/upload_stashed_xml_texts.py +196 -0
- dsp_tools/commands/xmlupload/upload_config.py +76 -0
- dsp_tools/commands/xmlupload/write_diagnostic_info.py +27 -0
- dsp_tools/commands/xmlupload/xmlupload.py +516 -0
- dsp_tools/config/__init__.py +0 -0
- dsp_tools/config/logger_config.py +69 -0
- dsp_tools/config/warnings_config.py +32 -0
- 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/legacy_models/datetimestamp.py +81 -0
- dsp_tools/legacy_models/langstring.py +253 -0
- dsp_tools/legacy_models/projectContext.py +49 -0
- dsp_tools/py.typed +0 -0
- dsp_tools/resources/schema/data.xsd +648 -0
- dsp_tools/resources/schema/lists-only.json +72 -0
- dsp_tools/resources/schema/project.json +1258 -0
- dsp_tools/resources/schema/properties-only.json +874 -0
- dsp_tools/resources/schema/resources-only.json +140 -0
- dsp_tools/resources/start-stack/docker-compose.override-host.j2 +11 -0
- dsp_tools/resources/start-stack/docker-compose.override.yml +11 -0
- dsp_tools/resources/start-stack/docker-compose.yml +88 -0
- 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/__init__.py +0 -0
- dsp_tools/utils/ansi_colors.py +32 -0
- dsp_tools/utils/data_formats/__init__.py +0 -0
- dsp_tools/utils/data_formats/date_util.py +166 -0
- dsp_tools/utils/data_formats/iri_util.py +30 -0
- dsp_tools/utils/data_formats/shared.py +81 -0
- dsp_tools/utils/data_formats/uri_util.py +76 -0
- 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/__init__.py +0 -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 +1542 -0
- 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/internal/migration_metadata.py +55 -0
- 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 +348 -0
- dsp_tools/xmllib/value_checkers.py +434 -0
- dsp_tools/xmllib/value_converters.py +777 -0
- 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-18.3.0.post13.dist-info/entry_points.txt +3 -0
- dsp_tools-0.9.13.dist-info/LICENSE +0 -674
- dsp_tools-0.9.13.dist-info/METADATA +0 -144
- dsp_tools-0.9.13.dist-info/RECORD +0 -71
- dsp_tools-0.9.13.dist-info/WHEEL +0 -5
- dsp_tools-0.9.13.dist-info/entry_points.txt +0 -3
- dsp_tools-0.9.13.dist-info/top_level.txt +0 -1
- dsplib/models/connection.py +0 -272
- dsplib/models/group.py +0 -296
- dsplib/models/helpers.py +0 -505
- dsplib/models/langstring.py +0 -277
- dsplib/models/listnode.py +0 -578
- dsplib/models/model.py +0 -20
- dsplib/models/ontology.py +0 -448
- dsplib/models/permission.py +0 -112
- dsplib/models/project.py +0 -547
- dsplib/models/propertyclass.py +0 -505
- dsplib/models/resource.py +0 -366
- dsplib/models/resourceclass.py +0 -810
- dsplib/models/sipi.py +0 -30
- dsplib/models/user.py +0 -731
- dsplib/models/value.py +0 -1000
- dsplib/utils/knora-data-schema.xsd +0 -454
- dsplib/utils/knora-schema-lists.json +0 -83
- dsplib/utils/knora-schema.json +0 -434
- dsplib/utils/onto_commons.py +0 -24
- dsplib/utils/onto_create_lists.py +0 -73
- dsplib/utils/onto_create_ontology.py +0 -442
- dsplib/utils/onto_get.py +0 -58
- dsplib/utils/onto_validate.py +0 -33
- dsplib/utils/xml_upload.py +0 -539
- dsplib/widgets/doublepassword.py +0 -80
- knora/MLS-import-libraries.py +0 -84
- knora/dsp_tools.py +0 -96
- knora/dsplib/models/connection.py +0 -272
- knora/dsplib/models/group.py +0 -296
- knora/dsplib/models/helpers.py +0 -506
- knora/dsplib/models/langstring.py +0 -277
- knora/dsplib/models/listnode.py +0 -578
- knora/dsplib/models/model.py +0 -20
- knora/dsplib/models/ontology.py +0 -448
- knora/dsplib/models/permission.py +0 -112
- knora/dsplib/models/project.py +0 -583
- knora/dsplib/models/propertyclass.py +0 -505
- knora/dsplib/models/resource.py +0 -416
- knora/dsplib/models/resourceclass.py +0 -811
- knora/dsplib/models/sipi.py +0 -35
- knora/dsplib/models/user.py +0 -731
- knora/dsplib/models/value.py +0 -1000
- knora/dsplib/utils/knora-data-schema.xsd +0 -464
- knora/dsplib/utils/knora-schema-lists.json +0 -83
- knora/dsplib/utils/knora-schema.json +0 -444
- knora/dsplib/utils/onto_commons.py +0 -24
- knora/dsplib/utils/onto_create_lists.py +0 -73
- knora/dsplib/utils/onto_create_ontology.py +0 -451
- knora/dsplib/utils/onto_get.py +0 -58
- knora/dsplib/utils/onto_validate.py +0 -33
- knora/dsplib/utils/xml_upload.py +0 -540
- knora/dsplib/widgets/doublepassword.py +0 -80
- knora/knora.py +0 -2108
- knora/test.py +0 -99
- knora/testit.py +0 -76
- knora/xml2knora.py +0 -633
- {dsplib → dsp_tools/cli}/__init__.py +0 -0
- {dsplib/models → dsp_tools/clients}/__init__.py +0 -0
- {dsplib/utils → dsp_tools/commands}/__init__.py +0 -0
- {dsplib/widgets → dsp_tools/commands/create}/__init__.py +0 -0
- {knora → dsp_tools/commands/create/create_on_server}/__init__.py +0 -0
- {knora/dsplib → dsp_tools/commands/create/models}/__init__.py +0 -0
- {knora/dsplib/models → dsp_tools/commands/create/parsing}/__init__.py +0 -0
- {knora/dsplib/utils → dsp_tools/commands/create/serialisation}/__init__.py +0 -0
- {knora/dsplib/widgets → dsp_tools/commands/excel2json}/__init__.py +0 -0
dsplib/models/project.py
DELETED
|
@@ -1,547 +0,0 @@
|
|
|
1
|
-
import json
|
|
2
|
-
from pystrict import strict
|
|
3
|
-
from typing import List, Set, Dict, Tuple, Optional, Any, Union
|
|
4
|
-
from urllib.parse import quote_plus
|
|
5
|
-
|
|
6
|
-
from .helpers import Actions, BaseError
|
|
7
|
-
from .langstring import Languages, LangStringParam, LangString
|
|
8
|
-
from .connection import Connection
|
|
9
|
-
from .model import Model
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
class SetEncoder(json.JSONEncoder):
|
|
13
|
-
def default(self, obj):
|
|
14
|
-
if isinstance(obj, set):
|
|
15
|
-
return list(obj)
|
|
16
|
-
return json.JSONEncoder.default(self, obj)
|
|
17
|
-
|
|
18
|
-
"""
|
|
19
|
-
This module implements the handling (CRUD) of Knora projects.
|
|
20
|
-
|
|
21
|
-
CREATE:
|
|
22
|
-
* Instantiate a new object of the class Project with all required parameters
|
|
23
|
-
* Call the ``create``-method on the instance
|
|
24
|
-
|
|
25
|
-
READ:
|
|
26
|
-
* Instantiate a new object with ``id``(IRI of project) given
|
|
27
|
-
* Call the ``read``-method on the instance
|
|
28
|
-
* Access the information that has been provided to the instance
|
|
29
|
-
|
|
30
|
-
UPDATE:
|
|
31
|
-
* You need an instance of an existing Project by reading an instance
|
|
32
|
-
* Change the attributes by assigning the new values
|
|
33
|
-
* Call the ``update```method on the instance
|
|
34
|
-
|
|
35
|
-
DELETE
|
|
36
|
-
* Instantiate a new objects with ``id``(IRI of project) given, or use any instance that has the id set
|
|
37
|
-
* Call the ``delete``-method on the instance
|
|
38
|
-
|
|
39
|
-
In addition there is a static methods ``getAllProjects`` which returns a list of all projects
|
|
40
|
-
"""
|
|
41
|
-
|
|
42
|
-
@strict
|
|
43
|
-
class Project(Model):
|
|
44
|
-
"""
|
|
45
|
-
This class represents a project in Knora.
|
|
46
|
-
|
|
47
|
-
Attributes
|
|
48
|
-
----------
|
|
49
|
-
|
|
50
|
-
con : Connection
|
|
51
|
-
A Connection instance to a Knora server
|
|
52
|
-
|
|
53
|
-
id : str
|
|
54
|
-
IRI of the project [readonly, cannot be modified after creation of instance]
|
|
55
|
-
|
|
56
|
-
shortcode : str
|
|
57
|
-
Knora project shortcode [readonly, cannot be modified after creation of instance]
|
|
58
|
-
|
|
59
|
-
shortname : str
|
|
60
|
-
Knora project shortname [read/write]
|
|
61
|
-
|
|
62
|
-
longname : str
|
|
63
|
-
Knora project longname [read/write]
|
|
64
|
-
|
|
65
|
-
description : LangString
|
|
66
|
-
Knora project description in a given language (Languages.EN, Languages.DE, Languages.FR, Languages.IT).
|
|
67
|
-
A desciption can be add/replaced or removed with the methods ``addDescription``and ``rmDescription``.
|
|
68
|
-
|
|
69
|
-
keywords : Set[str]
|
|
70
|
-
Set of keywords describing the project. Keywords can be added/removed by the methods ``addKeyword``
|
|
71
|
-
and ``rmKeyword``
|
|
72
|
-
|
|
73
|
-
ontologies : Set[str]
|
|
74
|
-
Set if IRI's of the ontologies attached to the project [readonly]
|
|
75
|
-
|
|
76
|
-
selfjoin : bool
|
|
77
|
-
Boolean if the project allows selfjoin
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
Methods
|
|
81
|
-
-------
|
|
82
|
-
|
|
83
|
-
create : Knora project information object
|
|
84
|
-
Creates a new project and returns the information from the project as it is in Knora
|
|
85
|
-
|
|
86
|
-
read : Knora project information object
|
|
87
|
-
Read project data from an existing project
|
|
88
|
-
|
|
89
|
-
update : Knora project information object
|
|
90
|
-
Updates the changed attributes and returns the updated information from the project as it is in Knora
|
|
91
|
-
|
|
92
|
-
delete : Knora result code
|
|
93
|
-
Deletes a project and returns the result code
|
|
94
|
-
|
|
95
|
-
getAllprojects [static]: List of all projects
|
|
96
|
-
Returns a list of all projects available
|
|
97
|
-
|
|
98
|
-
print : None
|
|
99
|
-
Prints the project information to stdout
|
|
100
|
-
|
|
101
|
-
"""
|
|
102
|
-
_id: str
|
|
103
|
-
_shortcode: str
|
|
104
|
-
_shortname: str
|
|
105
|
-
_longname: str
|
|
106
|
-
_description: LangString
|
|
107
|
-
_keywords: Set[str]
|
|
108
|
-
_ontologies: Set[str]
|
|
109
|
-
_selfjoin: bool
|
|
110
|
-
_status: bool
|
|
111
|
-
_logo: Optional[str]
|
|
112
|
-
|
|
113
|
-
SYSTEM_PROJECT: str = "http://www.knora.org/ontology/knora-admin#SystemProject"
|
|
114
|
-
|
|
115
|
-
def __init__(self,
|
|
116
|
-
con: Connection,
|
|
117
|
-
id: Optional[str] = None,
|
|
118
|
-
shortcode: Optional[str] = None,
|
|
119
|
-
shortname: Optional[str] = None,
|
|
120
|
-
longname: Optional[str] = None,
|
|
121
|
-
description: LangStringParam = None,
|
|
122
|
-
keywords: Optional[Set[str]] = None,
|
|
123
|
-
ontologies: Optional[Set[str]] = None,
|
|
124
|
-
selfjoin: Optional[bool] = None,
|
|
125
|
-
status: Optional[bool] = None,
|
|
126
|
-
logo: Optional[str] = None):
|
|
127
|
-
"""
|
|
128
|
-
Constructor for Project
|
|
129
|
-
|
|
130
|
-
:param con: Connection instance
|
|
131
|
-
:param id: IRI of the project [required for CREATE, READ]
|
|
132
|
-
:param shortcode: Shortcode of the project. String inf the form 'XXXX' where each X is a hexadezimal sign 0-1,A,B,C,D,E,F. [required for CREATE]
|
|
133
|
-
:param shortname: Shortname of the project [required for CREATE]
|
|
134
|
-
:param longname: Longname of the project [required for CREATE]
|
|
135
|
-
:param description: LangString instance containing the description [required for CREATE]
|
|
136
|
-
:param keywords: Set of keywords [required for CREATE]
|
|
137
|
-
:param ontologies: Set of ontologies that belong to this project [optional]
|
|
138
|
-
:param selfjoin: Allow selfjoin [required for CREATE]
|
|
139
|
-
:param status: Status of project (active if True) [required for CREATE]
|
|
140
|
-
:param logo: Path to logo image file [optional] NOT YET USED
|
|
141
|
-
"""
|
|
142
|
-
super().__init__(con)
|
|
143
|
-
self._id = id
|
|
144
|
-
self._shortcode = shortcode
|
|
145
|
-
self._shortname = shortname
|
|
146
|
-
self._longname = longname
|
|
147
|
-
self._description = LangString(description)
|
|
148
|
-
self._keywords = keywords
|
|
149
|
-
if not isinstance(ontologies, set) and ontologies is not None:
|
|
150
|
-
raise BaseError('Ontologies must be a set of strings or None!')
|
|
151
|
-
self._ontologies = ontologies
|
|
152
|
-
self._selfjoin = selfjoin
|
|
153
|
-
self._status = status
|
|
154
|
-
self._logo = logo
|
|
155
|
-
|
|
156
|
-
def __str__(self):
|
|
157
|
-
tmpstr = self._id + "\n " + self._shortcode + "\n " + self._shortname
|
|
158
|
-
return tmpstr
|
|
159
|
-
|
|
160
|
-
#
|
|
161
|
-
# Here follows a list of getters/setters
|
|
162
|
-
#
|
|
163
|
-
@property
|
|
164
|
-
def id(self) -> Optional[str]:
|
|
165
|
-
return self._id
|
|
166
|
-
|
|
167
|
-
@id.setter
|
|
168
|
-
def id(self, value: str) -> None:
|
|
169
|
-
raise BaseError('Project id cannot be modified!')
|
|
170
|
-
|
|
171
|
-
@property
|
|
172
|
-
def shortcode(self) -> Optional[str]:
|
|
173
|
-
return self._shortcode
|
|
174
|
-
|
|
175
|
-
@shortcode.setter
|
|
176
|
-
def shortcode(self, value: str) -> None:
|
|
177
|
-
raise BaseError('Shortcode id cannot be modified!')
|
|
178
|
-
|
|
179
|
-
@property
|
|
180
|
-
def shortname(self) -> Optional[str]:
|
|
181
|
-
return self._shortname
|
|
182
|
-
|
|
183
|
-
@shortname.setter
|
|
184
|
-
def shortname(self, value: str) -> None:
|
|
185
|
-
if self._shortname != str(value):
|
|
186
|
-
self._shortname = str(value)
|
|
187
|
-
self._changed.add('shortname')
|
|
188
|
-
|
|
189
|
-
@property
|
|
190
|
-
def longname(self) -> Optional[str]:
|
|
191
|
-
return self._longname
|
|
192
|
-
|
|
193
|
-
@longname.setter
|
|
194
|
-
def longname(self, value: str) -> None:
|
|
195
|
-
if self._longname != str(value):
|
|
196
|
-
self._longname = str(value)
|
|
197
|
-
self._changed.add('longname')
|
|
198
|
-
|
|
199
|
-
@property
|
|
200
|
-
def description(self) -> Optional[LangString]:
|
|
201
|
-
return self._description
|
|
202
|
-
|
|
203
|
-
@description.setter
|
|
204
|
-
def description(self, value: Optional[LangString]) -> None:
|
|
205
|
-
self._description = LangString(value)
|
|
206
|
-
self._changed.add('description')
|
|
207
|
-
|
|
208
|
-
def addDescription(self, lang: Union[Languages, str], value: str) -> None:
|
|
209
|
-
"""
|
|
210
|
-
Add/replace a project description with the given language (executed at next update)
|
|
211
|
-
|
|
212
|
-
:param lang: The language the description is in, either a string "EN", "DE", "FR", "IT" or a Language instance
|
|
213
|
-
:param value: The text of the description
|
|
214
|
-
:return: None
|
|
215
|
-
"""
|
|
216
|
-
|
|
217
|
-
self._description[lang] = value
|
|
218
|
-
self._changed.add('description')
|
|
219
|
-
|
|
220
|
-
def rmDescription(self, lang: Union[Languages, str]) -> None:
|
|
221
|
-
"""
|
|
222
|
-
Remove a description from a project (executed at next update)
|
|
223
|
-
|
|
224
|
-
:param lang: The language the description to be removed is in, either a string "EN", "DE", "FR", "IT" or a Language instance
|
|
225
|
-
:return: None
|
|
226
|
-
"""
|
|
227
|
-
|
|
228
|
-
del self._description[lang]
|
|
229
|
-
self._changed.add('description')
|
|
230
|
-
|
|
231
|
-
@property
|
|
232
|
-
def keywords(self) -> Set[str]:
|
|
233
|
-
return self._keywords
|
|
234
|
-
|
|
235
|
-
@keywords.setter
|
|
236
|
-
def keywords(self, value: Union[List[str], Set[str]]):
|
|
237
|
-
if isinstance(value, set):
|
|
238
|
-
self._keywords = value
|
|
239
|
-
self._changed.add('keywords')
|
|
240
|
-
elif isinstance(value, list):
|
|
241
|
-
self._keywords = set(value)
|
|
242
|
-
self._changed.add('keywords')
|
|
243
|
-
else:
|
|
244
|
-
raise BaseError('Must be a set of strings!')
|
|
245
|
-
|
|
246
|
-
def addKeyword(self, value: str):
|
|
247
|
-
"""
|
|
248
|
-
Add a new keyword to the set of keywords. (executed at next update)
|
|
249
|
-
May raise a BaseError
|
|
250
|
-
|
|
251
|
-
:param value: keyword
|
|
252
|
-
:return: None
|
|
253
|
-
"""
|
|
254
|
-
|
|
255
|
-
self._keywords.add(value)
|
|
256
|
-
self._changed.add('keywords')
|
|
257
|
-
|
|
258
|
-
def rmKeyword(self, value: str):
|
|
259
|
-
"""
|
|
260
|
-
Remove a keyword from the list of keywords (executed at next update)
|
|
261
|
-
May raise a BaseError
|
|
262
|
-
|
|
263
|
-
:param value: keyword
|
|
264
|
-
:return: None
|
|
265
|
-
"""
|
|
266
|
-
try:
|
|
267
|
-
self._keywords.remove(value)
|
|
268
|
-
except KeyError as ke:
|
|
269
|
-
raise BaseError('Keyword "' + value + '" is not in keyword set')
|
|
270
|
-
self._changed.add('keywords')
|
|
271
|
-
|
|
272
|
-
@property
|
|
273
|
-
def ontologies(self) -> Set[str]:
|
|
274
|
-
return self._ontologies
|
|
275
|
-
|
|
276
|
-
@ontologies.setter
|
|
277
|
-
def ontologies(self, value: Set[str]) -> None:
|
|
278
|
-
raise BaseError('Cannot add a ontology!')
|
|
279
|
-
|
|
280
|
-
@property
|
|
281
|
-
def selfjoin(self) -> Optional[bool]:
|
|
282
|
-
return self._selfjoin
|
|
283
|
-
|
|
284
|
-
@selfjoin.setter
|
|
285
|
-
def selfjoin(self, value: bool) -> None:
|
|
286
|
-
if self._selfjoin != value:
|
|
287
|
-
self._changed.add('selfjoin')
|
|
288
|
-
self._selfjoin = value
|
|
289
|
-
|
|
290
|
-
@property
|
|
291
|
-
def status(self) -> bool:
|
|
292
|
-
return self._status
|
|
293
|
-
|
|
294
|
-
@status.setter
|
|
295
|
-
def status(self, value: bool) -> None:
|
|
296
|
-
if self._status != value:
|
|
297
|
-
self._status = value
|
|
298
|
-
self._changed.add('status')
|
|
299
|
-
|
|
300
|
-
@property
|
|
301
|
-
def logo(self) -> str:
|
|
302
|
-
return self._logo
|
|
303
|
-
|
|
304
|
-
@logo.setter
|
|
305
|
-
def logo(self, value: str) -> None:
|
|
306
|
-
if self._logo != value:
|
|
307
|
-
self._logo = value
|
|
308
|
-
self._changed.add('logo')
|
|
309
|
-
|
|
310
|
-
@classmethod
|
|
311
|
-
def fromJsonObj(cls, con: Connection, json_obj: Any) -> Any:
|
|
312
|
-
"""
|
|
313
|
-
Internal method! Should not be used directly!
|
|
314
|
-
|
|
315
|
-
This method is used to create a Project instance from the JSON data returned by Knora
|
|
316
|
-
|
|
317
|
-
:param con: Connection instance
|
|
318
|
-
:param json_obj: JSON data returned by Knora as python3 object
|
|
319
|
-
:return: Project instance
|
|
320
|
-
"""
|
|
321
|
-
id = json_obj.get('id')
|
|
322
|
-
if id is None:
|
|
323
|
-
raise BaseError('Project id is missing')
|
|
324
|
-
shortcode = json_obj.get('shortcode')
|
|
325
|
-
if shortcode is None:
|
|
326
|
-
raise BaseError("Shortcode is missing")
|
|
327
|
-
shortname = json_obj.get('shortname')
|
|
328
|
-
if shortname is None:
|
|
329
|
-
raise BaseError("Shortname is missing")
|
|
330
|
-
longname = json_obj.get('longname')
|
|
331
|
-
if longname is None:
|
|
332
|
-
raise BaseError("Longname is missing")
|
|
333
|
-
description = LangString.fromJsonObj(json_obj.get('description'))
|
|
334
|
-
keywords = set(json_obj.get('keywords'))
|
|
335
|
-
if keywords is None:
|
|
336
|
-
raise BaseError("Keywords are missing")
|
|
337
|
-
ontologies = set(json_obj.get('ontologies'))
|
|
338
|
-
if ontologies is None:
|
|
339
|
-
raise BaseError("ontologies are missing")
|
|
340
|
-
selfjoin = json_obj.get('selfjoin')
|
|
341
|
-
if selfjoin is None:
|
|
342
|
-
raise BaseError("Selfjoin is missing")
|
|
343
|
-
status = json_obj.get('status')
|
|
344
|
-
if status is None:
|
|
345
|
-
raise BaseError("Status is missing")
|
|
346
|
-
logo = json_obj.get('logo')
|
|
347
|
-
return cls(con=con,
|
|
348
|
-
id=id,
|
|
349
|
-
shortcode=shortcode,
|
|
350
|
-
shortname=shortname,
|
|
351
|
-
longname=longname,
|
|
352
|
-
description=description,
|
|
353
|
-
keywords=keywords,
|
|
354
|
-
ontologies=ontologies,
|
|
355
|
-
selfjoin=selfjoin,
|
|
356
|
-
status=status,
|
|
357
|
-
logo=logo)
|
|
358
|
-
|
|
359
|
-
def toJsonObj(self, action: Actions) -> Any:
|
|
360
|
-
"""
|
|
361
|
-
Internal method! Should not be used directly!
|
|
362
|
-
|
|
363
|
-
Creates a JSON-object from the Project instance that can be used to call Knora
|
|
364
|
-
|
|
365
|
-
:param action: Action the object is used for (Action.CREATE or Action.UPDATE)
|
|
366
|
-
:return: JSON-object
|
|
367
|
-
"""
|
|
368
|
-
|
|
369
|
-
tmp = {}
|
|
370
|
-
if action == Actions.Create:
|
|
371
|
-
if self._shortcode is None:
|
|
372
|
-
raise BaseError("There must be a valid project shortcode!")
|
|
373
|
-
tmp['shortcode'] = self._shortcode
|
|
374
|
-
if self._shortname is None:
|
|
375
|
-
raise BaseError("There must be a valid project shortname!")
|
|
376
|
-
tmp['shortname'] = self._shortname
|
|
377
|
-
if self._longname is None:
|
|
378
|
-
raise BaseError("There must be a valid project longname!")
|
|
379
|
-
tmp['longname'] = self._longname
|
|
380
|
-
if self._description.isEmpty():
|
|
381
|
-
raise BaseError("There must be a valid project description!")
|
|
382
|
-
tmp['description'] = self._description.toJsonObj()
|
|
383
|
-
if self._keywords is not None and len(self._keywords) > 0:
|
|
384
|
-
tmp['keywords'] = self._keywords
|
|
385
|
-
if self._selfjoin is None:
|
|
386
|
-
raise BaseError("selfjoin must be defined (True or False!")
|
|
387
|
-
tmp['selfjoin'] = self._selfjoin
|
|
388
|
-
if self._status is None:
|
|
389
|
-
raise BaseError("status must be defined (True or False!")
|
|
390
|
-
tmp['status'] = self._status
|
|
391
|
-
elif action == Actions.Update:
|
|
392
|
-
if self._shortcode is not None and 'shortcode' in self._changed:
|
|
393
|
-
tmp['shortcode'] = self._shortcode
|
|
394
|
-
if self._shortname is not None and 'shortname' in self._changed:
|
|
395
|
-
tmp['shortname'] = self._shortname
|
|
396
|
-
if self._longname is not None and 'longname' in self._changed:
|
|
397
|
-
tmp['longname'] = self._longname
|
|
398
|
-
if not self._description.isEmpty() and 'description' in self._changed:
|
|
399
|
-
tmp['description'] = self._description.toJsonObj()
|
|
400
|
-
if len(self._keywords) > 0 and 'keywords' in self._changed:
|
|
401
|
-
tmp['keywords'] = self._keywords
|
|
402
|
-
if self._selfjoin is not None and 'selfjoin' in self._changed:
|
|
403
|
-
tmp['selfjoin'] = self._selfjoin
|
|
404
|
-
if self._status is not None and 'status' in self._changed:
|
|
405
|
-
tmp['status'] = self._status
|
|
406
|
-
return tmp
|
|
407
|
-
|
|
408
|
-
def createDefinitionFileObj(self):
|
|
409
|
-
return {
|
|
410
|
-
"shortcode": self._shortcode,
|
|
411
|
-
"shortname": self._shortname,
|
|
412
|
-
"longname": self._longname,
|
|
413
|
-
"descriptions": self._description.createDefinitionFileObj(),
|
|
414
|
-
"keywords": [kw for kw in self._keywords]
|
|
415
|
-
}
|
|
416
|
-
|
|
417
|
-
def create(self) -> 'Project':
|
|
418
|
-
"""
|
|
419
|
-
Create a new project in Knora
|
|
420
|
-
|
|
421
|
-
:return: JSON-object from Knora
|
|
422
|
-
"""
|
|
423
|
-
|
|
424
|
-
jsonobj = self.toJsonObj(Actions.Create)
|
|
425
|
-
jsondata = json.dumps(jsonobj, cls=SetEncoder)
|
|
426
|
-
result = self._con.post('/admin/projects', jsondata)
|
|
427
|
-
return Project.fromJsonObj(self._con, result['project'])
|
|
428
|
-
|
|
429
|
-
def read(self) -> 'Project':
|
|
430
|
-
"""
|
|
431
|
-
Read a project from Knora
|
|
432
|
-
|
|
433
|
-
:return: JSON-object from Knora
|
|
434
|
-
"""
|
|
435
|
-
result = None
|
|
436
|
-
if self._id is not None:
|
|
437
|
-
result = self._con.get('/admin/projects/iri/' + quote_plus(self._id))
|
|
438
|
-
elif self._shortcode is not None:
|
|
439
|
-
result = self._con.get('/admin/projects/shortcode/' + quote_plus(self._shortcode))
|
|
440
|
-
elif self._shortname is not None:
|
|
441
|
-
result = self._con.get('/admin/projects/shortname/' + quote_plus(self._shortname))
|
|
442
|
-
if result is not None:
|
|
443
|
-
return Project.fromJsonObj(self._con, result['project'])
|
|
444
|
-
else:
|
|
445
|
-
return None
|
|
446
|
-
|
|
447
|
-
def update(self) -> Union['Project', None]:
|
|
448
|
-
"""
|
|
449
|
-
Udate the project info in Knora with the modified data in this project instance
|
|
450
|
-
|
|
451
|
-
:return: JSON-object from Knora refecting the update
|
|
452
|
-
"""
|
|
453
|
-
|
|
454
|
-
jsonobj = self.toJsonObj(Actions.Update)
|
|
455
|
-
if jsonobj:
|
|
456
|
-
jsondata = json.dumps(jsonobj, cls=SetEncoder)
|
|
457
|
-
result = self._con.put('/admin/projects/iri/' + quote_plus(self.id), jsondata)
|
|
458
|
-
return Project.fromJsonObj(self._con, result['project'])
|
|
459
|
-
else:
|
|
460
|
-
return None
|
|
461
|
-
|
|
462
|
-
def delete(self) -> 'Project':
|
|
463
|
-
"""
|
|
464
|
-
Delete the given Knora project
|
|
465
|
-
|
|
466
|
-
:return: Knora response
|
|
467
|
-
"""
|
|
468
|
-
|
|
469
|
-
result = self._con.delete('/admin/projects/iri/' + quote_plus(self._id))
|
|
470
|
-
return Project.fromJsonObj(self._con, result['project'])
|
|
471
|
-
|
|
472
|
-
@staticmethod
|
|
473
|
-
def getAllProjects(con: Connection) -> List['Project']:
|
|
474
|
-
"""
|
|
475
|
-
Get all existing projects in Knora
|
|
476
|
-
|
|
477
|
-
:param con: Connection instance
|
|
478
|
-
:return:
|
|
479
|
-
"""
|
|
480
|
-
result = con.get('/admin/projects')
|
|
481
|
-
if 'projects' not in result:
|
|
482
|
-
raise BaseError("Request got no projects!")
|
|
483
|
-
return list(map(lambda a: Project.fromJsonObj(con, a), result['projects']))
|
|
484
|
-
|
|
485
|
-
def print(self):
|
|
486
|
-
"""
|
|
487
|
-
print info to stdout
|
|
488
|
-
|
|
489
|
-
:return: None
|
|
490
|
-
"""
|
|
491
|
-
|
|
492
|
-
print('Project Info:')
|
|
493
|
-
print(' Id: {}'.format(self._id))
|
|
494
|
-
print(' Shortcode: {}'.format(self._shortcode))
|
|
495
|
-
print(' Shortname: {}'.format(self._shortname))
|
|
496
|
-
print(' Longname: {}'.format(self._longname))
|
|
497
|
-
if self._description is not None:
|
|
498
|
-
print(' Description:')
|
|
499
|
-
for descr in self._description.items():
|
|
500
|
-
print(' {}: {}'.format(descr[0], descr[1]))
|
|
501
|
-
else:
|
|
502
|
-
print(' Description: None')
|
|
503
|
-
if self._keywords is not None:
|
|
504
|
-
print(' Keywords: {}'.format(' '.join(self._keywords)))
|
|
505
|
-
else:
|
|
506
|
-
print(' Keywords: None')
|
|
507
|
-
if self._ontologies is not None:
|
|
508
|
-
print(' Ontologies: {}'.format(' '.join(self._ontologies)))
|
|
509
|
-
else:
|
|
510
|
-
print(' Ontologies: None')
|
|
511
|
-
print(' Selfjoin: {}'.format(self._selfjoin))
|
|
512
|
-
print(' Status: {}'.format(self._status))
|
|
513
|
-
|
|
514
|
-
if __name__ == '__main__':
|
|
515
|
-
con = Connection('http://0.0.0.0:3333')
|
|
516
|
-
con.login('root@example.com', 'test')
|
|
517
|
-
|
|
518
|
-
projects = Project.getAllProjects(con)
|
|
519
|
-
|
|
520
|
-
for project in projects:
|
|
521
|
-
project.print()
|
|
522
|
-
|
|
523
|
-
new_project = Project(con=con,
|
|
524
|
-
shortcode='F11F',
|
|
525
|
-
shortname='mytest3',
|
|
526
|
-
longname='A Test beloning to me',
|
|
527
|
-
description=LangString({Languages.EN: 'My Tests description'}),
|
|
528
|
-
keywords={'AAA', 'BBB'},
|
|
529
|
-
selfjoin=False,
|
|
530
|
-
status=True).create()
|
|
531
|
-
|
|
532
|
-
new_project.print()
|
|
533
|
-
|
|
534
|
-
new_project.longname = 'A long name fore a short project'
|
|
535
|
-
new_project.status = False
|
|
536
|
-
new_project.description = LangString({Languages.DE: 'Beschreibung meines Tests'})
|
|
537
|
-
new_project.add_keyword('CCC')
|
|
538
|
-
new_project = new_project.update()
|
|
539
|
-
new_project.print()
|
|
540
|
-
|
|
541
|
-
new_project = new_project.delete()
|
|
542
|
-
|
|
543
|
-
print('**************************************************************')
|
|
544
|
-
projects = Project.getAllProjects(con)
|
|
545
|
-
|
|
546
|
-
for project in projects:
|
|
547
|
-
project.print()
|