From 32fab1ba372c22e4bc88fba014c790b02226ff7a Mon Sep 17 00:00:00 2001 From: Luca Frosini Date: Fri, 5 Apr 2024 15:25:56 +0200 Subject: [PATCH] Fixing templates --- src/main/resources/freemarker/Fishery.ftl | 38 ++++++++-------- src/main/resources/freemarker/Stock.ftl | 39 ++++++++-------- .../freemarker/Traceability Unit.ftl | 45 +++++++++++-------- src/main/resources/freemarker/macros.ftl | 2 +- 4 files changed, 65 insertions(+), 59 deletions(-) diff --git a/src/main/resources/freemarker/Fishery.ftl b/src/main/resources/freemarker/Fishery.ftl index 46c99a9..4f1bdb2 100644 --- a/src/main/resources/freemarker/Fishery.ftl +++ b/src/main/resources/freemarker/Fishery.ftl @@ -15,8 +15,14 @@ "version" : "${version?string["0.0"]}", "extras": [ <#-- START of Common Metadata --> + <#if source = "grsf"> + <@metadata key="system:type" var=grsf_type?capitalize sep="" /> + <#else> + <@metadata key="system:type" var="Legacy" sep="" /> + <@metadata key="GRSF Type" namespace=identity_namespace var=grsf_type?capitalize /> <@metadata key="Short Name" namespace=identity_namespace var=short_name /> + <@metadata key="GRSF Semantic Identifier" namespace=identity_namespace var=grsf_semantic_identifier /> <#if database_sources??> <@metadatalist key="Database Source" namespace=identity_namespace list=database_sources /> <#if source = "grsf"> @@ -25,10 +31,17 @@ - <@metadatalist key="Species" namespace=identity_namespace list=species tagValues=true/> + <@metadatalist key="Species" namespace=identity_namespace list=species tagValues=true /> + <@metadata key="Domain" var="Fishery" /> + <@metadata key="GRSF UUID" var=grsf_uuid /> + <@metadata key="Citation" var=citation /> + <@metadatalistJson key="Annotation" list=annotations include=include_sensitive /> + <@metadata key="Record URL" var=record_url /> + <#-- END of Common Metadata --> + + <#-- Start of Stock/Fishery Common Metadata --> <@metadatalist key="Similar GRSF Record" namespace=identity_namespace list=similar_grsf_record /> <@metadatalist key="Connected Stock Record" namespace=identity_namespace list=connected /> - <@metadatalist key="Data Owner" namespace=data_namespace list=data_owner include=include_sensitive /> <@timeseries key="Catch" namespace=data_namespace timeseries="catches" groupname="catch-group" /> <@timeseries key="Landing" namespace=data_namespace timeseries="landings" groupname="landing-group" /> @@ -42,15 +55,10 @@ <@metadata key="Status of the Record" var=status_grsf_record /> <@metadata key="spatial" var=spatial /> - <@metadata key="Domain" var="Fishery" /> - <@metadata key="GRSF UUID" var=grsf_uuid /> - <@metadata key="Citation" var=citation /> - <@metadatalistJson key="Annotation" list=annotations include=include_sensitive /> - <#-- END of Common Metadata --> + <#-- END of Stock/Fishery Common Metadata --> <#-- START of Fishery Metadata --> <@metadata key="GRSF Fishery Name" namespace=identity_namespace var=fishery_name /> - <@metadata key="GRSF Semantic Identifier" namespace=identity_namespace var=grsf_semantic_identifier /> <#if traceability_flag??> <@metadata key="Traceability Flag" var=traceability_flag?c /> <#if traceability_flag> @@ -65,14 +73,6 @@ <@metadatalist key="Management Body/Authority" namespace=identity_namespace list=management_body_authorities /> <@metadatalist key="Resources Exploited" namespace=identity_namespace list=resources_exploited /> <#-- END of Fishery Metadata --> - - <@metadata key="Record URL" var=record_url /> - - <#if source = "grsf"> - <@metadata key="system:type" var=grsf_type?capitalize sep=""/> - <#else> - <@metadata key="system:type" var="Legacy" sep=""/> - ], "organization": <@source_macro /> "groups": [ @@ -82,7 +82,7 @@ "title": "${group.title}" }, - <@group name="fishery-group" title="Fishery" var="OK" sep=""/> + <@group name="fishery-group" title="Fishery" var="OK" sep="" /> ], "tags": [ <#list tag_list as tag> @@ -90,7 +90,7 @@ <@tag tagname=connections_indicator /> <@tag tagname=similarities_indicator /> - <@tag tagname=grsf_type?capitalize sep=""/> + <@tag tagname=grsf_type?capitalize sep="" /> ], "resources": [ <@resources var=source_of_information /><#if refers_to?? && source_of_information??>, @@ -105,4 +105,4 @@ }<#sep>, ] -} +} \ No newline at end of file diff --git a/src/main/resources/freemarker/Stock.ftl b/src/main/resources/freemarker/Stock.ftl index 5efe668..f3fd709 100644 --- a/src/main/resources/freemarker/Stock.ftl +++ b/src/main/resources/freemarker/Stock.ftl @@ -15,8 +15,14 @@ "version" : "${version?string["0.0"]}", "extras": [ <#-- START of Common Metadata --> + <#if source = "grsf"> + <@metadata key="system:type" var=grsf_type?capitalize sep="" /> + <#else> + <@metadata key="system:type" var="Legacy" sep="" /> + <@metadata key="GRSF Type" namespace=identity_namespace var=grsf_type?capitalize /> <@metadata key="Short Name" namespace=identity_namespace var=short_name /> + <@metadata key="GRSF Semantic Identifier" namespace=identity_namespace var=grsf_semantic_identifier /> <#if database_sources??> <@metadatalist key="Database Source" namespace=identity_namespace list=database_sources /> <#if source = "grsf"> @@ -25,10 +31,17 @@ - <@metadatalist key="Species" namespace=identity_namespace list=species tagValues=true/> + <@metadatalist key="Species" namespace=identity_namespace list=species tagValues=true /> + <@metadata key="Domain" var="Stock" /> + <@metadata key="GRSF UUID" var=grsf_uuid /> + <@metadata key="Citation" var=citation /> + <@metadatalistJson key="Annotation" list=annotations include=include_sensitive /> + <@metadata key="Record URL" var=record_url /> + <#-- END of Common Metadata --> + + <#-- Start of Stock/Fishery Common Metadata --> <@metadatalist key="Similar GRSF Record" namespace=identity_namespace list=similar_grsf_record /> <@metadatalist key="Connected Fishery Record" namespace=identity_namespace list=connected /> - <@metadatalist key="Data Owner" namespace=data_namespace list=data_owner include=include_sensitive /> <@timeseries key="Catch" namespace=data_namespace timeseries="catches" groupname="catch-group" /> <@timeseries key="Landing" namespace=data_namespace timeseries="landings" groupname="landing-group" /> @@ -42,16 +55,10 @@ <@metadata key="Status of the Record" var=status_grsf_record /> <@metadata key="spatial" var=spatial /> - <@metadata key="Domain" var="Stock" /> - <@metadata key="GRSF UUID" var=grsf_uuid /> - <@metadata key="Citation" var=citation /> - <@metadatalistJson key="Annotation" list=annotations include=include_sensitive /> - <#-- END of Common Metadata --> - + <#-- END of Stock/Fishery Common Metadata --> <#-- START of Stock Metadata --> <@metadata key="GRSF Stock Name" namespace=identity_namespace var=stock_name /> - <@metadata key="GRSF Semantic Identifier" namespace=identity_namespace var=grsf_semantic_identifier /> <@metadatalist key="Assessment Area" namespace=identity_namespace list=assessment_area tagValues=true /> <@metadatalist key="Intersecting FAO Major Fishing Areas" namespace=identity_namespace list=hidden_assessment_area tagValues=true include=include_sensitive /> <@timeseries key="Assessment Method" namespace=data_namespace timeseries="assessment_methods" groupname="assessment-method-group" /> @@ -65,14 +72,6 @@ <@timeseries key="Scientific Advice" namespace=data_namespace timeseries="scientific_advice" groupname="scientific-advice-group" /> <@metadata key="Assessor" namespace=data_namespace var=assessor include=include_sensitive /> <#-- END of Stock Metadata --> - - <@metadata key="Record URL" var=record_url /> - - <#if source = "grsf"> - <@metadata key="system:type" var=grsf_type?capitalize sep=""/> - <#else> - <@metadata key="system:type" var="Legacy" sep=""/> - ], "organization": <@source_macro /> "groups": [ @@ -84,7 +83,7 @@ <@group name="assessment-method-group" title="Assessment Method" var=assessment_methods /> <@group name="scientific-advice-group" title="Scientific Advice" var=scientific_advice /> - <@group name="stock-group" title="Stock" var="OK" sep=""/> + <@group name="stock-group" title="Stock" var="OK" sep="" /> ], "tags": [ <#list tag_list as tag> @@ -92,7 +91,7 @@ <@tag tagname=connections_indicator /> <@tag tagname=similarities_indicator /> - <@tag tagname=grsf_type?capitalize sep=""/> + <@tag tagname=grsf_type?capitalize sep="" /> ], "resources": [ <@resources var=source_of_information /><#if refers_to?? && source_of_information??>, @@ -107,4 +106,4 @@ }<#sep>, ] -} +} \ No newline at end of file diff --git a/src/main/resources/freemarker/Traceability Unit.ftl b/src/main/resources/freemarker/Traceability Unit.ftl index 3311eb6..a8861f9 100644 --- a/src/main/resources/freemarker/Traceability Unit.ftl +++ b/src/main/resources/freemarker/Traceability Unit.ftl @@ -14,30 +14,37 @@ "version" : "${version?string["0.0"]}", "extras": [ - <#if database_sources??> - <@metadatalist key="Database Source" namespace=identity_namespace list=database_sources /> - - - <@metadata key="GRSF Traceability Unit Name" namespace=identity_namespace var=traceability_unit_name /> - <@metadata key="GRSF Semantic Identifier" namespace=identity_namespace var=grsf_semantic_identifier /> + <#-- START of Common Metadata --> + <@metadata key="system:type" var="Traceability Unit" sep="" /> <@metadata key="GRSF Type" namespace=identity_namespace var="Traceability Unit" /> <@metadata key="Short Name" namespace=identity_namespace var=short_name /> + <@metadata key="GRSF Semantic Identifier" namespace=identity_namespace var=grsf_semantic_identifier /> + <#if database_sources??> + <@metadatalist key="Database Source" namespace=identity_namespace list=database_sources /> + <#if source = "grsf"> + <#list database_sources as database_source> + <#assign group_list += [{"name":"${database_source_name_to_id[database_source?json_string]}-group", "title":"${database_source?json_string}"}] > + + + + <@metadatalist key="Species" namespace=identity_namespace list=species tagValues=true /> + <@metadata key="Domain" var="Traceability Unit" /> + <@metadata key="GRSF UUID" var=grsf_uuid /> + <@metadata key="Citation" var=citation /> + <@metadatalistJson key="Annotation" list=annotations include=include_sensitive /> + <@metadata key="Record URL" var=record_url /> + <#-- END of Common Metadata --> + + <#-- START of Traceability Unit Metadata --> + <@metadata key="GRSF Traceability Unit Name" namespace=identity_namespace var=traceability_unit_name /> <@metadata key="Connected Stock Record" namespace=identity_namespace var=referring_stock_record.url /> <@metadata key="Connected Fishery Record" namespace=identity_namespace var=referring_fishery_record.url /> - <@metadatalist key="Species" namespace=identity_namespace list=species tagValues=true /> <@metadatalist key="Assessment Area" namespace=identity_namespace list=assessment_area /> <@metadatalist key="Management/Reporting Area" namespace=identity_namespace list=management_reporting_area tagValues=true /> <@metadatalist key="Flag State" namespace=identity_namespace list=flag_state tagValues=true /> <@metadatalist key="Fishing Gear" namespace=identity_namespace list=fishing_gear tagValues=true /> <@metadatalist key="Management Body/Authority" namespace=identity_namespace list=management_body_authorities /> - - <@metadata key="Domain" var="Traceability Unit" /> - <@metadata key="GRSF UUID" var=grsf_uuid /> - <@metadata key="Citation" var=citation /> - <@metadatalistJson key="Annotation" list=annotations include=include_sensitive /> - - <@metadata key="Record URL" var=record_url /> - <@metadata key="system:type" var="Traceability Unit" sep=""/> + <#-- END of Traceability Unit Metadata --> ], "organization": <@source_macro /> "groups": [ @@ -47,13 +54,13 @@ "title": "${group.title}" }, - <@group name="traceability-unit-group" title="Traceability Unit" var="OK" sep=""/> + <@group name="traceability-unit-group" title="Traceability Unit" var="OK" sep="" /> ], "tags": [ <#list tag_list as tag> <@tagbyvalue value=tag include=true /> - <@tag tagname="Traceability Unit" sep=""/> + <@tag tagname="Traceability Unit" sep="" /> ], "resources": [ <#if !is_patch && referring_stock_record?has_content> @@ -62,7 +69,7 @@ <#if !is_patch && referring_fishery_record?has_content> <@resource name="GRSF Fishery" url=referring_fishery_record.url description=referring_fishery_record.semantic_id /> - <@resource name="Traceability Unit URI" url=traceability_record_uri sep=""/> + <@resource name="Traceability Unit URI" url=traceability_record_uri sep="" /> ], "timeseries": [ <#list timeseries_list as elem> @@ -73,4 +80,4 @@ }<#sep>, ] -} +} \ No newline at end of file diff --git a/src/main/resources/freemarker/macros.ftl b/src/main/resources/freemarker/macros.ftl index 99d010c..d768b44 100644 --- a/src/main/resources/freemarker/macros.ftl +++ b/src/main/resources/freemarker/macros.ftl @@ -128,7 +128,7 @@ <#macro source_macro sep=","> <#local source_title = "${database_source_id_to_name[source]}" > <#if source = "grsf"> - <#assign group_list += [{"name":"${source}", "title":"${source_title}"}] > + <#assign group_list += [{"name":"${source}-group", "title":"${source_title}"}] > <#else> <#assign group_list += [{"name":"legacy-group", "title":"Legacy"}] >