diff --git a/server/data-source/couchdb-dataset.mjs b/server/data-source/couchdb-dataset.mjs index 4de05e6..ab991ca 100644 --- a/server/data-source/couchdb-dataset.mjs +++ b/server/data-source/couchdb-dataset.mjs @@ -1,6 +1,6 @@ import { getId, getTypes, getEntityByIri, getString, getStrings, getResource, getResources, getPlainStrings, getPlainString, getEntityByType, getValue } from "./shared/jsonld.mjs"; import { selectForLanguages } from "./shared/couchdb-response.mjs"; -import { DCTERMS, DCAT, VCARD, SKOS, SGOV, EUA, ADMS, FOAF, OWL, NKOD, PU, SPDX } from "./shared/vocabulary.mjs"; +import { DCTERMS, DCAT, VCARD, SKOS, SGOV, EUA, ADMS, FOAF, OWL, NKOD, PU, SPDX , EUROPE} from "./shared/vocabulary.mjs"; export function createCouchDbDataset(couchDbConnector) { return { @@ -72,6 +72,7 @@ function jsonldToDataset(jsonld, iri) { loadDatasetTemporal(jsonld, entity, result); loadDatasetOptional(entity, result); loadDatasetNationalCatalog(jsonld, entity, result); + loadDatasetHighValueDatasets(entity, result); return result; } @@ -121,6 +122,8 @@ function createEmptyDataset(iri) { "isFromVdf": false, "isCodelist": false, "vdfOriginator": null, + "applicableLegislation": [], + "hvdCategory": [], } } @@ -230,11 +233,16 @@ function loadDatasetNationalCatalog(jsonld, entity, dataset) { const types = getTypes(entity); dataset.isFromForm = types.includes(NKOD.SourceForm); dataset.isFromCatalog = types.includes(NKOD.SourceLkod); - dataset.isFromVDF = types.includes(NKOD.Vdf); + dataset.isFromVdf = types.includes(NKOD.Vdf); dataset.isCodelist = types.includes(NKOD.CodeList); dataset.vdfOriginator = getResource(entity, NKOD.originator); } +function loadDatasetHighValueDatasets(entity, dataset) { + dataset.applicableLegislation = getResources(entity, EUROPE.applicableLegislation); + dataset.hvdCategory = getResources(entity, EUROPE.hvdCategory); +} + function jsonldToDistribution(jsonld, iri) { const entity = getEntityByIri(jsonld, iri); if (entity === null) { @@ -263,6 +271,7 @@ function jsonldToDistribution(jsonld, iri) { "compressFormat": getResource(entity, DCAT.compressFormat), "type": "Distribution", "legal": loadDistributionLegal(jsonld, entity), + "applicableLegislation": getResources(entity, EUROPE.applicableLegislation), }; const accessServiceIri = getResource(entity, DCAT.accessService); @@ -304,6 +313,7 @@ function loadDistributionDataService(jsonld, iri) { "endpointDescription": getResource(entity, DCAT.endpointDescription), "endpointURL": getResource(entity, DCAT.endpointURL), "conformsTo": getResources(entity, DCTERMS.conformsTo), + "applicableLegislation": getResources(entity, EUROPE.applicableLegislation), } } @@ -314,6 +324,7 @@ function createEmptyDataService() { "endpointDescription": null, "endpointURL": null, "conformsTo": [], + "applicableLegislation": [], }; } diff --git a/server/data-source/shared/vocabulary.mjs b/server/data-source/shared/vocabulary.mjs index e4fad1e..f9cbf36 100644 --- a/server/data-source/shared/vocabulary.mjs +++ b/server/data-source/shared/vocabulary.mjs @@ -201,3 +201,10 @@ export const LP = { export const SGOV = { "ObjectType": "https://slovník.gov.cz/základní/pojem/typ-objektu", }; + +const EUROPE_PREFIX = "http://data.europa.eu/r5r/"; + +export const EUROPE = { + "applicableLegislation": EUROPE_PREFIX + "applicableLegislation", + "hvdCategory": EUROPE_PREFIX + "hvdCategory", +}; diff --git a/server/data-source/solr-dataset.mjs b/server/data-source/solr-dataset.mjs index 509018f..e04caec 100644 --- a/server/data-source/solr-dataset.mjs +++ b/server/data-source/solr-dataset.mjs @@ -57,7 +57,9 @@ function buildDatasetsQuery(language, query) { sort, sortDirection, offset, - limit + limit, + hvdCategory, + applicableLegislation, } = query; const fq = [ ...prepareFieldQuery("publisher", publisher), @@ -66,6 +68,8 @@ function buildDatasetsQuery(language, query) { ...prepareFieldQuery("file_type", format), ...prepareFieldQuery("data_service_type", dataServiceType), ...prepareFieldQuery("is_part_of", isPartOf), + ...prepareFieldQuery("hvd_category", hvdCategory), + ...prepareFieldQuery("applicable_legislation", applicableLegislation), ]; if (temporalStart !== null) { fq.push(`temporal_start:[* TO ${temporalStart}T00:00:00Z]`); @@ -86,6 +90,7 @@ function buildDatasetsQuery(language, query) { "data_service_type", "publisher", "theme", + "hvd_category", ], "fl": [ "iri", @@ -94,6 +99,7 @@ function buildDatasetsQuery(language, query) { "description_cs", "description_en", "file_type", + "applicable_legislation", ], "fq": fq, "sort": prepareSort(language, sort, sortDirection), @@ -116,6 +122,7 @@ function parseDatasetsResponse(languages, response) { "title": selectLanguage(document, "title_", languages), "description": selectLanguage(document, "description_", languages), "file_type": document["file_type"] ?? [], + "applicable_legislation": document["applicable_legislation"] ?? [], })); const facet_fields = response["facet_counts"]["facet_fields"]; @@ -125,6 +132,7 @@ function parseDatasetsResponse(languages, response) { "dataServiceType": parseFacet(facet_fields["data_service_type"]), "publisher": parseFacet(facet_fields["publisher"]), "theme": parseFacet(facet_fields["theme"]), + "hvdCategory": parseFacet(facet_fields["hvd_category"]), }; return { diff --git a/server/http/dataset-detail/dataset-detail-cs.html b/server/http/dataset-detail/dataset-detail-cs.html index 95fcf8f..5cf9f0e 100644 --- a/server/http/dataset-detail/dataset-detail-cs.html +++ b/server/http/dataset-detail/dataset-detail-cs.html @@ -1,44 +1,64 @@ - + +
{{> head }} -- {{breaklines description}} -
+ {{/with}} + {{#if applicableLegislationVisible}} ++ {{breaklines description}} +
{{breaklines description}}