From 3c08c3a27a2be015015a82c4448a6b4ebf30700a Mon Sep 17 00:00:00 2001 From: Mathieu Massaviol <mathieu.massaviol@univ-amu.fr> Date: Fri, 8 Nov 2024 13:51:15 +0100 Subject: [PATCH] Various corrections #29 --- .../OcResourceSearchFacetList.vue | 1 + .../OcSearchResultCardSkeleton.vue | 14 +++++++------- src/helpers/icons.ts | 4 +++- src/helpers/resourceType.ts | 4 +++- src/locales/en.ts | 1 + src/locales/fr.ts | 1 + src/pages/community/[community].search.vue | 2 +- src/sparql/search.ts | 19 ++++++++++++++++--- 8 files changed, 33 insertions(+), 13 deletions(-) diff --git a/src/components/Search/OcResourceSearchFacetList/OcResourceSearchFacetList.vue b/src/components/Search/OcResourceSearchFacetList/OcResourceSearchFacetList.vue index e58907f..0e40f95 100644 --- a/src/components/Search/OcResourceSearchFacetList/OcResourceSearchFacetList.vue +++ b/src/components/Search/OcResourceSearchFacetList/OcResourceSearchFacetList.vue @@ -1,4 +1,5 @@ <template> + WIP <Panel :header="t('search.resourceType')" toggleable> <template #toggleicon="toggleIconProps"> <i v-if="toggleIconProps.collapsed" class="fa-solid fa-chevron-down text-gray-700" /> diff --git a/src/components/Search/OcSearchResultCardSkeleton/OcSearchResultCardSkeleton.vue b/src/components/Search/OcSearchResultCardSkeleton/OcSearchResultCardSkeleton.vue index 7303e26..5f6eec4 100644 --- a/src/components/Search/OcSearchResultCardSkeleton/OcSearchResultCardSkeleton.vue +++ b/src/components/Search/OcSearchResultCardSkeleton/OcSearchResultCardSkeleton.vue @@ -1,15 +1,15 @@ <template> - <div class="bg-gray-100 w-full h-44 rounded-md "> - <div class="p-4 h-36"> - <div id="title" class="font-semibold text-2xl flex flex-row gap-2 mb-2"> + <div class="bg-gray-100 w-full h-58 rounded-md "> + <div class="p-4 h-50"> + <div id="title" class="font-semibold text-2xl flex flex-row gap-2 mb-3"> <p class="w-6 h-6 bg-slate-200 rounded animate-pulse"></p> <p class="rounded bg-slate-200 w-4/5 h-6 text-white font-semibold text-2xl animate-pulse"></p> </div> - <div id="subtitle" class="text-sm w-1/5 h-2 bg-slate-200 mb-2"></div> - <div id="creators" class="rounded bg-slate-200 w-4/5 h-4 text-white font-semibold text-2xl animate-pulse"></div> + <div id="subtitle" class="text-sm w-1/5 h-2 bg-slate-200 mb-4 animate-pulse"></div> + <div id="creators" class="rounded bg-slate-200 w-4/5 h-4 mb-4 text-white font-semibold text-2xl animate-pulse"></div> <div id="description"> - <p class="font-medium text-gray-500 animate-pulse">{{ t('search.searchResult.description') }}</p> - <p class="rounded text-sm bg-slate-200 h-8 w-full"></p> + <p class="font-medium text-gray-500 mb-1 animate-pulse">{{ t('search.searchResult.description') }}</p> + <p class="rounded text-sm bg-slate-200 h-12 w-full animate-pulse"></p> </div> </div> <div id="footer" class="bg-gray-200 rounded-b-md h-8"> diff --git a/src/helpers/icons.ts b/src/helpers/icons.ts index 5bfb9e4..fe44f75 100644 --- a/src/helpers/icons.ts +++ b/src/helpers/icons.ts @@ -13,5 +13,7 @@ export const iconsDict:Record<string, string> = { dataset: 'fa-solid fa-table', distribution: 'fa-solid fa-file', service: 'fa-solid fa-cube', - search: 'fa-solid fa-magnifying-glass' + search: 'fa-solid fa-magnifying-glass', + concept: 'fa-solid fa-quote-right', + unknown: 'fa-solid fa-question' } diff --git a/src/helpers/resourceType.ts b/src/helpers/resourceType.ts index e35076e..e2a7cb2 100644 --- a/src/helpers/resourceType.ts +++ b/src/helpers/resourceType.ts @@ -3,6 +3,7 @@ export enum ResourceType { DATASET ='dataset', DISTRIBUTION ='distribution', SERVICE ='service', + CONCEPT = 'concept', UNKNOWN = 'unknown', } @@ -10,7 +11,8 @@ export const type2ResourceType: Record<string, ResourceType> = { 'http://www.w3.org/ns/dcat#Catalog': ResourceType.CATALOG, 'http://www.w3.org/ns/dcat#Dataset': ResourceType.DATASET, 'http://www.w3.org/ns/dcat#Distribution': ResourceType.DISTRIBUTION, - 'http://www.w3.org/ns/dcat#Service': ResourceType.SERVICE, + 'http://www.w3.org/ns/dcat#DataService': ResourceType.SERVICE, + 'http://www.w3.org/2004/02/skos/core#Concept': ResourceType.CONCEPT } export const getResourceTypeFromAtType = (atType: string | string[]): ResourceType => { diff --git a/src/locales/en.ts b/src/locales/en.ts index fbc0c51..f985907 100644 --- a/src/locales/en.ts +++ b/src/locales/en.ts @@ -365,6 +365,7 @@ Greetings, 'dataset': 'dataset', 'distribution': 'distribution', 'service': 'service', + 'concept': 'concept', 'unknown': 'unknown', }, and: 'and' diff --git a/src/locales/fr.ts b/src/locales/fr.ts index 808ba9f..22e8be9 100644 --- a/src/locales/fr.ts +++ b/src/locales/fr.ts @@ -381,6 +381,7 @@ Cordialement, 'dataset': 'jeu de données', 'distribution': 'distribution', 'service': 'service', + 'concept': 'concept', 'unknown': 'inconnu', }, and: 'et' diff --git a/src/pages/community/[community].search.vue b/src/pages/community/[community].search.vue index 960b7c7..e076162 100644 --- a/src/pages/community/[community].search.vue +++ b/src/pages/community/[community].search.vue @@ -172,7 +172,7 @@ const loadRouteParams = () => { start.value = route.query.start ? parseInt(route.query.start as string) : 0 } -watch(() => route.query.page, () => { getResultsForStart(start.value)}) +watch(() => route.query.start, () => { getResultsForStart(start.value) }) watch(() => route.query, search) onBeforeMount(() => { diff --git a/src/sparql/search.ts b/src/sparql/search.ts index ce520a4..c080794 100644 --- a/src/sparql/search.ts +++ b/src/sparql/search.ts @@ -44,7 +44,12 @@ export const searchResources = async (query: OcSearchQuery, auth?: Credentials) ` }) } - + + /** + * On retire les ressources ayant un espace dans leur IRI car SPARQL ne les autorise pas + * + * FILTER (!contains(str(?resource), ' ')) + */ const res = await executeSparqlSelect( ` SELECT DISTINCT ?resource @@ -52,6 +57,8 @@ export const searchResources = async (query: OcSearchQuery, auth?: Credentials) ?resource rdf:type ?type. ?resource dct:identifier ?identifier. + FILTER (!contains(str(?resource), ' ')) + ${queryFilter} } ORDER BY ASC(?resource) @@ -112,7 +119,13 @@ export const getSearchResults = async (resourceUriList: string[], auth?: Credent const frame = { '@context': {...searchResultContext, ...creatorContext}, - '@type': ['http://www.w3.org/ns/dcat#Catalog','http://www.w3.org/ns/dcat#Dataset','http://www.w3.org/ns/dcat#Distribution'], + '@type': [ + 'http://www.w3.org/ns/dcat#Catalog', + 'http://www.w3.org/ns/dcat#Dataset', + 'http://www.w3.org/ns/dcat#Distribution', + 'http://www.w3.org/ns/dcat#DataService', + 'http://www.w3.org/2004/02/skos/core#Concept' + ], contains: { creator: { '@id': 'http://purl.org/dc/terms/creator', @@ -125,7 +138,7 @@ export const getSearchResults = async (resourceUriList: string[], auth?: Credent } } - const formattedUris = '<' + resourceUriList.map((uri) => uri.trim()).join('> <') + '>' + const formattedUris = '<' + resourceUriList.join('> <') + '>' const res = await executeSparqlConstruct<OcSearchResult>( ` -- GitLab