diff --git a/oeo_ext/oeo_extended_store/oeox_template/oeo_ext_template_empty.owl b/oeo_ext/oeo_extended_store/oeox_template/oeo_ext_template_empty.owl index d66ff83e7..fdf4c8b30 100644 --- a/oeo_ext/oeo_extended_store/oeox_template/oeo_ext_template_empty.owl +++ b/oeo_ext/oeo_extended_store/oeox_template/oeo_ext_template_empty.owl @@ -5,12 +5,12 @@ xmlns:owl="http://www.w3.org/2002/07/owl#" xml:base="http://openenergy-platform.org/ontology/oeox" xmlns="http://openenergy-platform.org/ontology/oeox#" - xmlns:x_1.1="http://purl.org/dc/elements/1.1/" + xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:term="http://purl.org/dc/terms/"> - The Open Energy Ontology Extended (OEOX) extends the Open Energy Ontology. It contains compositions of terms that are too specific for the OEO. + The Open Energy Ontology Extended (OEOX) extends the Open Energy Ontology. It contains compositions of terms that are too specific for the OEO. http://creativecommons.org/publicdomain/zero/1.0/ Open Energy Ontology Extended (OEOX) diff --git a/oeo_ext/templates/oeo_ext/partials/oeo-ext-plugin-ui.html b/oeo_ext/templates/oeo_ext/partials/oeo-ext-plugin-ui.html index f380a3f9c..bdc97fb4f 100644 --- a/oeo_ext/templates/oeo_ext/partials/oeo-ext-plugin-ui.html +++ b/oeo_ext/templates/oeo_ext/partials/oeo-ext-plugin-ui.html @@ -8,14 +8,13 @@

Result


-
+ {% csrf_token %}

Numerator

-
@@ -47,6 +46,7 @@

Denominator

+ diff --git a/oeo_ext/templates/oeo_ext/partials/success.html b/oeo_ext/templates/oeo_ext/partials/success.html new file mode 100644 index 000000000..e26e82347 --- /dev/null +++ b/oeo_ext/templates/oeo_ext/partials/success.html @@ -0,0 +1,11 @@ +
+ {% if response_data.success %} +

{{ response_data.message }}

+

Your new unit has been created successfully.

+

New Composed Unit URI:

+

{{ response_data.newComposedUnitURI }}

+ {% else %} +

{{ response_data.message }}

+

{{ response_data.errors.error }}

+ {% endif %} +
\ No newline at end of file diff --git a/oeo_ext/utils.py b/oeo_ext/utils.py index f77d3ae8d..53627c96f 100644 --- a/oeo_ext/utils.py +++ b/oeo_ext/utils.py @@ -146,8 +146,8 @@ def get_new_iri( # Generate the new IRI using the count + 1 new_counter = generate_id(existing_count + 1) - # Build URI of pattern: oeox-base:ConceptLike#ConceptID - new_uri = URIRef(f"{base}{concept_type.value}/{id_prefix}{new_counter}") + # Build URI of pattern: oeox-base/ConceptID + new_uri = URIRef(f"{base}{id_prefix}{new_counter}") return new_uri diff --git a/oeo_ext/views.py b/oeo_ext/views.py index 9843aaad9..600b5577f 100644 --- a/oeo_ext/views.py +++ b/oeo_ext/views.py @@ -59,14 +59,23 @@ def post(self, request): # error is either dict with key:value or None new_unit, error = create_new_unit(numerator=n, denominator=d) if error: - response_data = error + # response_data = error + response_data = { + "success": False, + "message": "Form data is not valid!", + "errors": error, + } else: data["newComposedUnitURI"] = new_unit response_data = data - return JsonResponse(response_data, status=200) + return render( + request, + "oeo_ext/partials/success.html", + {"response_data": response_data}, + ) + # return JsonResponse(response_data, status=200) else: errors = { - # "form": form, "form_errors": form.errors, "nominator_errors": [f.errors for f in nominator_forms], "denominator_errors": [f.errors for f in denominator_forms], diff --git a/ontology/views.py b/ontology/views.py index 0300e1d0f..590070e9d 100644 --- a/ontology/views.py +++ b/ontology/views.py @@ -149,7 +149,10 @@ def get( if ontology in [OPEN_ENERGY_ONTOLOGY_NAME]: ontology_data = OEO_COMMON_DATA elif ontology in [OEO_EXT_NAME]: - ontology_data = OEOX_COMMON_DATA + # ontology_data = OEOX_COMMON_DATA + ontology_data = get_common_data( + OEO_EXT_NAME, file=OEO_EXT_OWL_NAME, path=OEO_EXT_PATH + ) sub_classes = [] super_classes = [] diff --git a/versions/changelogs/current.md b/versions/changelogs/current.md index f179bd2be..e93b9adfb 100644 --- a/versions/changelogs/current.md +++ b/versions/changelogs/current.md @@ -2,8 +2,8 @@ ## Changes - - Enhance embargo area feature (UI & API) [(#1804)](https://github.com/OpenEnergyPlatform/oeplatform/pull/1804) + - Refactor code - The REST API raises an error when creating a table with embargo period but false date time for start/end data - Update the table creation http "put" endpoint to handle embargo periods @@ -12,11 +12,12 @@ - Enhance the ontology pages, remove the modules page and fully rework the about page and oeo download capabilities. Additionally add the oeox and make its URIs available, also add more cases where a Http404 is raised to make [1807](https://github.com/OpenEnergyPlatform/oeplatform/pull/1807) - ## Features - Add the OEP-extended (oeo-ext) feature. It enables users to create new composed units (ontology classes) that extent the units available in the OEO. The feature is implemented as a plugin html form, it can be easily added to any Webpage of the oeplatform. [(#1680)](https://github.com/OpenEnergyPlatform/oeplatform/pull/1680) +- Add error message display to oeox-plugin view. [(#1812)](https://github.com/OpenEnergyPlatform/oeplatform/pull/1812) + ## Bugs ## Documentation updates