Skip to content
Snippets Groups Projects
Commit 6b6d9473 authored by Mathieu Massaviol's avatar Mathieu Massaviol
Browse files

Merge branch '59-reparer-affichage-donnees-spatiales-sur-dataset' into 'main'

Resolve "Réparer affichage données spatiales sur dataset"

Closes #59

See merge request !71
parents 42774ff6 68a52642
No related branches found
No related tags found
1 merge request!71Resolve "Réparer affichage données spatiales sur dataset"
Pipeline #10718 passed
Showing with 194 additions and 104 deletions
{ import type { OcDataset } from "@/declarations";
export const datasetExample1: OcDataset = {
"@id": "urn:testdataset:nakala:6d79f9ed-e10e-4eea-8bfe-93c0bdf370dc", "@id": "urn:testdataset:nakala:6d79f9ed-e10e-4eea-8bfe-93c0bdf370dc",
"@type": "http://www.w3.org/ns/dcat#Dataset", "@type": ["http://www.w3.org/ns/dcat#Dataset"],
"identifier": "test-6d79f9ed-e10e-4eea-8bfe-93c0bdf370dc",
"creator@string": "Coché, Lorraine; Arnaud, Elie; Bouveret, Laurent; David, Romain; Foulquier, Eric; Gandilhon, Nadège; Jeannesson, Etienne; Le Bras, Yvan; Lerigoleur, Emilie; Lopez, Pascal Jean; Madon, Bénédicte; Sananikone, Julien; Sèbe, Maxime; Le Berre, Iwan; Jung, Jean-Luc", "creator@string": "Coché, Lorraine; Arnaud, Elie; Bouveret, Laurent; David, Romain; Foulquier, Eric; Gandilhon, Nadège; Jeannesson, Etienne; Le Bras, Yvan; Lerigoleur, Emilie; Lopez, Pascal Jean; Madon, Bénédicte; Sananikone, Julien; Sèbe, Maxime; Le Berre, Iwan; Jung, Jean-Luc",
"accrualPeriodicity": "http://publications.europa.eu/resource/authority/frequency/UNKNOWN", "accrualPeriodicity": "http://publications.europa.eu/resource/authority/frequency/UNKNOWN",
"bibliographicCitation": "Coché, L., Arnaud, E., Laurent, B., David, R., Foulquier, E., Gandilhon, N., Jeannesson, E., Le Bras, Y., Lerigoleur, E., Jean Lopez, P., Madon, B., Sananikone, J., Sèbe, M., Le Berre, I., & Jung, J.-L. (2021). Kakila database of marine mammal observation data around the French archipelago of Guadeloupe in the AGOA sanctuary - French Antilles [dataset]. PNDB Metacat PRODUCTION Node. https://doi.org/10.48502/8BB5-PK85", "bibliographicCitation": "Coché, L., Arnaud, E., Laurent, B., David, R., Foulquier, E., Gandilhon, N., Jeannesson, E., Le Bras, Y., Lerigoleur, E., Jean Lopez, P., Madon, B., Sananikone, J., Sèbe, M., Le Berre, I., & Jung, J.-L. (2021). Kakila database of marine mammal observation data around the French archipelago of Guadeloupe in the AGOA sanctuary - French Antilles [dataset]. PNDB Metacat PRODUCTION Node. https://doi.org/10.48502/8BB5-PK85",
...@@ -115,12 +118,12 @@ ...@@ -115,12 +118,12 @@
"fr": "Base de données collectée dans le cadre du stage de master 2 Lorraine Coché \"Inventaire et structuration des données d'observation des mammifères marins autour de la Guadeloupe\" en 2020 (Master Écosystèmes marins tropicaux de l'Université des Antilles). Cette base de données a été constituée dans un esprit de science participative. Elle centralise et harmonise les données d'observation collectées par l'équipe du Sanctuaire Agoa (Aire Marine Protégée), l'OMMAG (Observatoire des Mammifères Marins de l'Archipel Guadeloupéen), BREACH Antilles, et les sociétés de whale-watching Cétacés Caraïbes, Guadeloupe Evasion Découverte et Aventures Marines.", "fr": "Base de données collectée dans le cadre du stage de master 2 Lorraine Coché \"Inventaire et structuration des données d'observation des mammifères marins autour de la Guadeloupe\" en 2020 (Master Écosystèmes marins tropicaux de l'Université des Antilles). Cette base de données a été constituée dans un esprit de science participative. Elle centralise et harmonise les données d'observation collectées par l'équipe du Sanctuaire Agoa (Aire Marine Protégée), l'OMMAG (Observatoire des Mammifères Marins de l'Archipel Guadeloupéen), BREACH Antilles, et les sociétés de whale-watching Cétacés Caraïbes, Guadeloupe Evasion Découverte et Aventures Marines.",
"en": "Database collected as part of Lorraine Coché's Master 2 course entitled \"Inventory and structuring of marine mammal observation data around Guadeloupe\" in 2020 (Master's degree in Tropical Marine Ecosystems at the University of the West Indies). This database has been set up in the spirit of participatory science. It centralises and harmonises the observation data collected by the Agoa Sanctuary team (Marine Protected Area), OMMAG (Observatoire des Mammifères Marins de l'Archipel Guadeloupéen), BREACH Antilles, and the whale-watching companies Cétacés Caraïbes, Guadeloupe Evasion Découverte and Aventures Marines." "en": "Database collected as part of Lorraine Coché's Master 2 course entitled \"Inventory and structuring of marine mammal observation data around Guadeloupe\" in 2020 (Master's degree in Tropical Marine Ecosystems at the University of the West Indies). This database has been set up in the spirit of participatory science. It centralises and harmonises the observation data collected by the Agoa Sanctuary team (Marine Protected Area), OMMAG (Observatoire des Mammifères Marins de l'Archipel Guadeloupéen), BREACH Antilles, and the whale-watching companies Cétacés Caraïbes, Guadeloupe Evasion Découverte and Aventures Marines."
}, },
"identifier": [ "otherIdentifier": [
{ {
"@id": "_:vb112236", "@id": "_:vb112236",
"@type": "http://www.w3.org/ns/adms#Identifier", "@type": "http://www.w3.org/ns/adms#Identifier",
"creator": "https://doi.org/", "creator": "https://doi.org/",
"issued": "2021-05-20", "issued": new Date(Date.parse("2021-05-20")),
"notation": "10.48502/8bb5-pk85", "notation": "10.48502/8bb5-pk85",
"schemeAgency": "DOI" "schemeAgency": "DOI"
}, },
...@@ -128,7 +131,7 @@ ...@@ -128,7 +131,7 @@
"@id": "_:vb112249", "@id": "_:vb112249",
"@type": "http://www.w3.org/ns/adms#Identifier", "@type": "http://www.w3.org/ns/adms#Identifier",
"creator": "https://doi.org/", "creator": "https://doi.org/",
"issued": "2021-05-20", "issued": new Date(Date.parse("2021-05-20")),
"notation": "10.48502/8bb5-pk85", "notation": "10.48502/8bb5-pk85",
"schemeAgency": "DOI" "schemeAgency": "DOI"
}, },
...@@ -136,16 +139,16 @@ ...@@ -136,16 +139,16 @@
"@id": "_:vb112262", "@id": "_:vb112262",
"@type": "http://www.w3.org/ns/adms#Identifier", "@type": "http://www.w3.org/ns/adms#Identifier",
"creator": "https://doi.org/", "creator": "https://doi.org/",
"issued": "2021-05-20", "issued": new Date(Date.parse("2021-05-20")),
"notation": "10.48502/8bb5-pk85", "notation": "10.48502/8bb5-pk85",
"schemeAgency": "DOI" "schemeAgency": "DOI"
} }
], ],
"isPartOf": "https://data.driihm.fr/catalogs/geo-ohm-lc", "isPartOf": "https://data.driihm.fr/catalogs/geo-ohm-lc",
"isReferencedBy": "https://doi.org/10.3897/BDJ.9.e69022", "isReferencedBy": "https://doi.org/10.3897/BDJ.9.e69022",
"issued": "2021-01-01", "issued": new Date(Date.parse("2021-01-01")),
"language": "http://publications.europa.eu/resource/authority/language/FRE", "language": "http://publications.europa.eu/resource/authority/language/FRE",
"modified": "2023-12-04", "modified": new Date(Date.parse("2023-12-04")),
"provenance": [ "provenance": [
{ {
"@id": "_:vb112239", "@id": "_:vb112239",
...@@ -181,52 +184,65 @@ ...@@ -181,52 +184,65 @@
{ {
"@id": "_:vb112238", "@id": "_:vb112238",
"@type": "http://purl.org/dc/terms/Location", "@type": "http://purl.org/dc/terms/Location",
"geometry": "<gml:Envelope srsName=\"http://www.opengis.net/def/crs/OGC/1.3/CRS84\"><gml:lowerCorner>-61.8098386177696 15.832018691052</gml:lowerCorner><gml:upperCorner>-61.0019590353041 16.5144923539361</gml:upperCorner></gml:Envelope>", "geometry": [
"geometry@Geometry": "POLYGON((-61.80983861777 16.514492353936,-61.001959035304 16.514492353936,-61.001959035304 15.832018691052,-61.80983861777 15.832018691052,-61.80983861777 16.514492353936))" {
"@type": "http://www.opengis.net/ont/geosparql#gmlLiteral",
"@value": "<gml:Envelope srsName=\"http://www.opengis.net/def/crs/OGC/1.3/CRS84\"><gml:lowerCorner>-61.8098386177696 15.832018691052</gml:lowerCorner><gml:upperCorner>-61.0019590353041 16.5144923539361</gml:upperCorner></gml:Envelope>"
},
{
"@type": "http://www.openlinksw.com/schemas/virtrdf#Geometry",
"@value": "POLYGON((-61.80983861777 16.514492353936,-61.001959035304 16.514492353936,-61.001959035304 15.832018691052,-61.80983861777 15.832018691052,-61.80983861777 16.514492353936))"
}
]
}, },
{ {
"@id": "_:vb112251", "@id": "_:vb112251",
"@type": "http://purl.org/dc/terms/Location", "@type": "http://purl.org/dc/terms/Location",
"geometry": "<gml:Envelope srsName=\"http://www.opengis.net/def/crs/OGC/1.3/CRS84\"><gml:lowerCorner>-61.8098386177696 15.832018691052</gml:lowerCorner><gml:upperCorner>-61.0019590353041 16.5144923539361</gml:upperCorner></gml:Envelope>", "geometry": [
"geometry@Geometry": "POLYGON((-61.80983861777 16.514492353936,-61.001959035304 16.514492353936,-61.001959035304 15.832018691052,-61.80983861777 15.832018691052,-61.80983861777 16.514492353936))" {
"@type": "http://www.opengis.net/ont/geosparql#gmlLiteral",
"@value": "<gml:Envelope srsName=\"http://www.opengis.net/def/crs/OGC/1.3/CRS84\"><gml:lowerCorner>-61.8098386177696 15.832018691052</gml:lowerCorner><gml:upperCorner>-61.0019590353041 16.5144923539361</gml:upperCorner></gml:Envelope>"
},
{
"@type": "http://www.openlinksw.com/schemas/virtrdf#Geometry",
"@value": "POLYGON((-61.80983861777 16.514492353936,-61.001959035304 16.514492353936,-61.001959035304 15.832018691052,-61.80983861777 15.832018691052,-61.80983861777 16.514492353936))"
}
]
}, },
{ {
"@id": "_:vb112264", "@id": "_:vb112264",
"@type": "http://purl.org/dc/terms/Location", "@type": "http://purl.org/dc/terms/Location",
"geometry": "<gml:Envelope srsName=\"http://www.opengis.net/def/crs/OGC/1.3/CRS84\"><gml:lowerCorner>-61.8098386177696 15.832018691052</gml:lowerCorner><gml:upperCorner>-61.0019590353041 16.5144923539361</gml:upperCorner></gml:Envelope>", "geometry": [
"geometry@Geometry": "POLYGON((-61.80983861777 16.514492353936,-61.001959035304 16.514492353936,-61.001959035304 15.832018691052,-61.80983861777 15.832018691052,-61.80983861777 16.514492353936))" {
"@type": "http://www.opengis.net/ont/geosparql#gmlLiteral",
"@value": "<gml:Envelope srsName=\"http://www.opengis.net/def/crs/OGC/1.3/CRS84\"><gml:lowerCorner>-61.8098386177696 15.832018691052</gml:lowerCorner><gml:upperCorner>-61.0019590353041 16.5144923539361</gml:upperCorner></gml:Envelope>"
},
{
"@type": "http://www.openlinksw.com/schemas/virtrdf#Geometry",
"@value": "POLYGON((-61.80983861777 16.514492353936,-61.001959035304 16.514492353936,-61.001959035304 15.832018691052,-61.80983861777 15.832018691052,-61.80983861777 16.514492353936))"
}
]
} }
], ],
"temporal": [ "temporal": [
{ [
"@id": "_:vb112237", new Date(Date.parse('2019-12-31')),
"@type": "http://purl.org/dc/terms/PeriodOfTime", new Date(Date.parse('2000-01-01'))
"endDate": "2019-12-31", ],
"startDate": "2000-01-01" [
}, new Date(Date.parse('2019-12-31')),
{ new Date(Date.parse('2000-01-01'))
"@id": "_:vb112250", ],
"@type": "http://purl.org/dc/terms/PeriodOfTime", [
"endDate": "2019-12-31", new Date(Date.parse('2019-12-31')),
"startDate": "2000-01-01" new Date(Date.parse('2000-01-01'))
}, ]
{
"@id": "_:vb112263",
"@type": "http://purl.org/dc/terms/PeriodOfTime",
"endDate": "2019-12-31",
"startDate": "2000-01-01"
}
], ],
"title": { "title": {
"fr": "KAKILA, Base de données d'observation des mammifères marins autour de l'archipel de la Guadeloupe dans le sanctuaire AGOA - Antilles françaises", "fr": "KAKILA, Base de données d'observation des mammifères marins autour de l'archipel de la Guadeloupe dans le sanctuaire AGOA - Antilles françaises",
"en": "KAKILA, Marine mammal observation database around the Guadeloupe archipelago in the AGOA sanctuary - French West Indies" "en": "KAKILA, Marine mammal observation database around the Guadeloupe archipelago in the AGOA sanctuary - French West Indies"
}, },
"sameAs": "https://doi.org/10.48502/8bb5-pk85", "sameAs": "https://doi.org/10.48502/8bb5-pk85",
"identifier@id": [
"_:vb112236",
"_:vb112249",
"_:vb112262"
],
"status": { "status": {
"@id": "http://publications.europa.eu/resource/authority/dataset-status/COMPLETED", "@id": "http://publications.europa.eu/resource/authority/dataset-status/COMPLETED",
"prefLabel": { "prefLabel": {
......
import type { Meta, StoryObj } from '@storybook/vue3' import type { Meta, StoryObj } from '@storybook/vue3'
import OcDescriptorDataset from './OcDescriptorDataset.vue' import OcDescriptorDataset from './OcDescriptorDataset.vue'
import datasetExample from '@/assets/datasetExample1.json' import { datasetExample1 } from '@/assets/datasetExample1'
const meta: Meta<typeof OcDescriptorDataset> = { const meta: Meta<typeof OcDescriptorDataset> = {
component: OcDescriptorDataset component: OcDescriptorDataset
...@@ -19,7 +19,7 @@ export const Default: Story = { ...@@ -19,7 +19,7 @@ export const Default: Story = {
template: '<OcDescriptorDataset v-bind="args" />' template: '<OcDescriptorDataset v-bind="args" />'
}), }),
args: { args: {
dataset: datasetExample, dataset: datasetExample1,
community: { community: {
name: 'example' name: 'example'
} }
......
import type { Meta, StoryObj } from '@storybook/vue3' import type { Meta, StoryObj } from '@storybook/vue3'
import OcDescriptorResource from './OcDescriptorResource.vue' import OcDescriptorResource from './OcDescriptorResource.vue'
import datasetExample1 from '@/assets/datasetExample1.json' import { datasetExample1 } from '@/assets/datasetExample1'
const meta: Meta<typeof OcDescriptorResource> = { const meta: Meta<typeof OcDescriptorResource> = {
component: OcDescriptorResource component: OcDescriptorResource
...@@ -16,8 +16,19 @@ export const Default: Story = { ...@@ -16,8 +16,19 @@ export const Default: Story = {
setup() { setup() {
return { args } return { args }
}, },
template: '<OcDescriptorResource v-bind="args" />' template: '<OcDescriptorResource v-bind="args" />',
}), }),
args: {
loading: false,
community: {
identifier: "189088ec-baa9-4397-8c6f-eefde9a3790c",
title: {
fr: "Communauté du LabEx DRIIHM",
en: "DRIIHM Community"
},
name: 'driihm'
}
}
} }
export const Loading: Story = { export const Loading: Story = {
...@@ -38,6 +49,7 @@ export const Loading: Story = { ...@@ -38,6 +49,7 @@ export const Loading: Story = {
fr: "Communauté du LabEx DRIIHM", fr: "Communauté du LabEx DRIIHM",
en: "DRIIHM Community" en: "DRIIHM Community"
}, },
name: 'driihm'
} }
} }
} }
...@@ -61,6 +73,7 @@ export const Kakila: Story = { ...@@ -61,6 +73,7 @@ export const Kakila: Story = {
fr: "Communauté du LabEx DRIIHM", fr: "Communauté du LabEx DRIIHM",
en: "DRIIHM Community" en: "DRIIHM Community"
}, },
name: 'driihm'
} }
} }
} }
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
/> />
<Button <Button
v-if="resource?.identifier"
size="small" size="small"
:as="OcLink" :as="OcLink"
:to="{ :to="{
...@@ -155,16 +156,28 @@ ...@@ -155,16 +156,28 @@
<slot></slot> <slot></slot>
</main> </main>
<aside class="w-[20rem]"> <aside class="w-[20rem]">
<OcDescriptorSpatialCoverage <section class="bg-white rounded p-2 flex flex-col gap-2 mb-4" v-if="props.resource?.spatial">
v-if="props.resource?.spatial" <h2 class="text-xl font-medium">
class="mb-4" {{ globalTranslateValue(datasetMetadata.spatial.label) }}
:spatial-items="props.resource?.spatial" </h2>
/> <OcDescriptorSpatialCoverage
v-if="spatialGeometry.length"
:spatial-items="spatialGeometry"
/>
<div v-if="spatialConcepts.length" class="flex gap-2">
<span
class="rounded bg-slate-200 border border-slate-500 text-black font-medium px-2 py-1"
v-for="spatialConcept in spatialConcepts"
:key="spatialConcept['@id']"
>
{{ translateValue(spatialConcept.prefLabel) }}
</span>
</div>
</section>
<section class="bg-white rounded p-2 mb-4" v-if="props.resource?.temporal"> <section class="bg-white rounded p-2 mb-4" v-if="props.resource?.temporal">
<h2 class="text-xl font-medium mb-2"> <h2 class="text-xl font-medium mb-2">
{{ globalTranslateValue(datasetMetadata.temporal.label) }} {{ globalTranslateValue(datasetMetadata.temporal.label) }}
({{ props.resource.temporal.length }})
</h2> </h2>
<ul> <ul>
<li v-for="(temporal, key) in props.resource.temporal" :key="key"> <li v-for="(temporal, key) in props.resource.temporal" :key="key">
...@@ -306,4 +319,7 @@ const contactPointLink = computed(() => { ...@@ -306,4 +319,7 @@ const contactPointLink = computed(() => {
const body = t('emails.ask.body', { resourceType, resourceTitle, resourceLink }) const body = t('emails.ask.body', { resourceType, resourceTitle, resourceLink })
return `mailto:${mailto}?subject=${subject}&body=${body}` return `mailto:${mailto}?subject=${subject}&body=${body}`
}) })
const spatialConcepts = computed(() => props.resource?.spatial?.filter((spatialItem) => spatialItem.prefLabel))
const spatialGeometry = computed(() => props.resource?.spatial?.filter((spatialItem) => spatialItem.geometry))
</script> </script>
import type { Meta, StoryObj } from '@storybook/vue3' import type { Meta, StoryObj } from '@storybook/vue3'
import OcDescriptorSpatialCoverage from './OcDescriptorSpatialCoverage.vue' import OcDescriptorSpatialCoverage from './OcDescriptorSpatialCoverage.vue'
import datasetExample from '@/assets/datasetExample1.json' import { datasetExample1 } from '@/assets/datasetExample1'
import example1 from './example1.json' import example1 from './example1.json'
import example2 from './example2.json' import example2 from './example2.json'
...@@ -21,7 +21,7 @@ export const Default: Story = { ...@@ -21,7 +21,7 @@ export const Default: Story = {
template: '<OcDescriptorSpatialCoverage v-bind="args" />' template: '<OcDescriptorSpatialCoverage v-bind="args" />'
}), }),
args: { args: {
spatialItems: datasetExample.spatial spatialItems: datasetExample1.spatial?.filter((item) => item.geometry )
} }
} }
......
...@@ -15,16 +15,13 @@ import OSM from 'ol/source/OSM.js' ...@@ -15,16 +15,13 @@ import OSM from 'ol/source/OSM.js'
import TileLayer from 'ol/layer/Tile.js' import TileLayer from 'ol/layer/Tile.js'
import VectorLayer from 'ol/layer/Vector.js' import VectorLayer from 'ol/layer/Vector.js'
import View from 'ol/View.js' import View from 'ol/View.js'
import type { OcGeometry } from '@/declarations'
const props = defineProps({ const props = defineProps({
spatialItems: { spatialItems: {
type: Array, type: Array<OcGeometry>,
required: false required: false
}, }
// resourceURI: {
// type: String,
// required: false
// }
}) })
const loading = ref(true) const loading = ref(true)
...@@ -33,38 +30,42 @@ let map: Map ...@@ -33,38 +30,42 @@ let map: Map
let allLayers: VectorLayer[] = [] let allLayers: VectorLayer[] = []
const initialExtent = ref() const initialExtent = ref()
function createLayerFrom(data): VectorLayer | null { function createLayerFrom(data: OcGeometry): VectorLayer | null {
if (data.datatype == 'http://www.openlinksw.com/schemas/virtrdf#Geometry') { for(const geometry of data.geometry) {
const format = new WKT() if (geometry['@type'] === 'http://www.openlinksw.com/schemas/virtrdf#Geometry') {
let value = data.value const format = new WKT()
if (data.value.startsWith('BOX(')) { let value = geometry['@value']
//BOX geometry is not a WKT shape, need to transform it to Polygon if (value.startsWith('BOX(')) {
value = box2polygon(data.value) //BOX geometry is not a WKT shape, need to transform it to Polygon
} value = box2polygon(value)
const feature = format.readFeature(value, { }
dataProjection: 'EPSG:4326', const feature = format.readFeature(value, {
featureProjection: 'EPSG:3857' dataProjection: 'EPSG:4326',
}) featureProjection: 'EPSG:3857'
const vector = new VectorLayer({
source: new VectorSource({
features: [feature]
}) })
}) const vector = new VectorLayer({
return vector source: new VectorSource({
} else if (data['geometry@Geometry']) { features: [feature]
const format = new WKT() })
const value = data['geometry@Geometry']
const feature = format.readFeature(value, {
dataProjection: 'EPSG:4326',
featureProjection: 'EPSG:3857'
})
const vector = new VectorLayer({
source: new VectorSource({
features: [feature]
}) })
}) return vector
return vector } else if (geometry['@type'] === 'http://www.opengis.net/ont/geosparql#wktLiteral') {
} else return null const format = new WKT()
const value = geometry['@value']
const feature = format.readFeature(value, {
dataProjection: 'EPSG:4326',
featureProjection: 'EPSG:3857'
})
const vector = new VectorLayer({
source: new VectorSource({
features: [feature]
})
})
return vector
}
}
console.warn('No readable geometry found')
return null
} }
function box2polygon(box) { function box2polygon(box) {
......
Source diff could not be displayed: it is too large. Options to address this: view the blob.
...@@ -60,7 +60,7 @@ export type OcDataset = OcResource & { ...@@ -60,7 +60,7 @@ export type OcDataset = OcResource & {
status?: OcConcept status?: OcConcept
modified?: Date modified?: Date
temporal?: [Date, Date][] temporal?: [Date, Date][]
spatial?: OcConcept[] spatial?: Array<OcConcept | OcGeometry>
landingPage?: string landingPage?: string
license?: OcConcept license?: OcConcept
conformsTo?: OcConcept conformsTo?: OcConcept
...@@ -135,6 +135,11 @@ export type OcConceptScheme = { ...@@ -135,6 +135,11 @@ export type OcConceptScheme = {
prefLabel: LocalizedProperty<string> prefLabel: LocalizedProperty<string>
} }
export type OcGeometry = {
'@id'?: string,
geometry: Array<{'@type': string, '@value': string}>
}
export type OcOrganization = { export type OcOrganization = {
'@id': string '@id': string
'@type': string | string[] '@type': string | string[]
......
...@@ -7,7 +7,8 @@ import { ...@@ -7,7 +7,8 @@ import {
type OcConcept, type OcConcept,
type OcOrganization, type OcOrganization,
type OcDatasetSummary, type OcDatasetSummary,
type OcAdmsIdentifier type OcAdmsIdentifier,
type OcGeometry
} from '@/declarations' } from '@/declarations'
import { import {
defaultLocalizedPropFormatter, defaultLocalizedPropFormatter,
...@@ -232,7 +233,7 @@ export async function getDataset(identifier: string, auth?: Credentials): Promis ...@@ -232,7 +233,7 @@ export async function getDataset(identifier: string, auth?: Credentials): Promis
/** /**
* Temporal * Temporal
*/ */
const datasetTemporalPromise = executeSparqlConstruct<{ startDate: Date, endDate: Date }>( const datasetTemporalPromise = executeSparqlConstruct<{ startDate: string, endDate: string }>(
` `
CONSTRUCT { CONSTRUCT {
?temporal ?p ?o. ?temporal ?p ?o.
...@@ -249,11 +250,11 @@ export async function getDataset(identifier: string, auth?: Credentials): Promis ...@@ -249,11 +250,11 @@ export async function getDataset(identifier: string, auth?: Credentials): Promis
context: { context: {
startDate: { startDate: {
'@id': 'http://www.w3.org/ns/dcat#startDate', '@id': 'http://www.w3.org/ns/dcat#startDate',
'@type': 'http://www.w3.org/2001/XMLSchema#dateTime' '@type': 'http://www.w3.org/2001/XMLSchema#date',
}, },
endDate: { endDate: {
'@id': 'http://www.w3.org/ns/dcat#endDate', '@id': 'http://www.w3.org/ns/dcat#endDate',
'@type': 'http://www.w3.org/2001/XMLSchema#dateTime' '@type': 'http://www.w3.org/2001/XMLSchema#date',
} }
} }
...@@ -328,9 +329,9 @@ export async function getDataset(identifier: string, auth?: Credentials): Promis ...@@ -328,9 +329,9 @@ export async function getDataset(identifier: string, auth?: Credentials): Promis
) )
/** /**
* Spatial * Spatial concept(s)
*/ */
const datasetSpatialPromise = executeSparqlConstruct<OcConcept>( const datasetSpatialConceptPromise = executeSparqlConstruct<OcConcept>(
` `
CONSTRUCT { CONSTRUCT {
?spatial skos:prefLabel ?o. ?spatial skos:prefLabel ?o.
...@@ -351,6 +352,33 @@ export async function getDataset(identifier: string, auth?: Credentials): Promis ...@@ -351,6 +352,33 @@ export async function getDataset(identifier: string, auth?: Credentials): Promis
} }
) )
/**
* Spatial geometry(s)
*/
const datasetSpatialGeometryPromise = executeSparqlConstruct<OcGeometry>(
`
CONSTRUCT {
?spatial ?p ?geometry.
?spatial rdf:type dct:Location.
}
WHERE {
<${datasetUri}> dct:spatial ?spatial.
?spatial a dct:Location.
?spatial ?p ?geometry.
FILTER (bif:isgeometry(?geometry))
}
`,
{
auth,
context: {
geometry: {
'@id': "http://www.w3.org/ns/locn#geometry",
'@container': '@set'
}
}
}
)
/** /**
* Theme * Theme
*/ */
...@@ -605,13 +633,14 @@ export async function getDataset(identifier: string, auth?: Credentials): Promis ...@@ -605,13 +633,14 @@ export async function getDataset(identifier: string, auth?: Credentials): Promis
datasetIdentifierPromise, // 7 datasetIdentifierPromise, // 7
datasetTypePromise, // 8, datasetTypePromise, // 8,
datasetLanguagePromise, // 9 datasetLanguagePromise, // 9
datasetSpatialPromise, // 10 datasetSpatialConceptPromise, // 10
datasetAccrualPeriodicityPromise, // 11 datasetAccrualPeriodicityPromise, // 11
datasetLicensePromise, // 12 datasetLicensePromise, // 12
datasetConformsToPromise // 13 datasetConformsToPromise, // 13
datasetSpatialGeometryPromise // 14
]) ])
dataset.temporal = datasetResponse[0].map<[Date, Date]>(temporal => [temporal.startDate, temporal.endDate]) dataset.temporal = datasetResponse[0].map<[Date, Date]>(temporal => [new Date(Date.parse(temporal.startDate)), new Date(Date.parse(temporal.endDate))])
dataset.status = datasetResponse[1][0] dataset.status = datasetResponse[1][0]
dataset.creator = datasetResponse[2] dataset.creator = datasetResponse[2]
dataset.contactPoint = datasetResponse[3] dataset.contactPoint = datasetResponse[3]
...@@ -621,11 +650,15 @@ export async function getDataset(identifier: string, auth?: Credentials): Promis ...@@ -621,11 +650,15 @@ export async function getDataset(identifier: string, auth?: Credentials): Promis
dataset.otherIdentifier = datasetResponse[7] dataset.otherIdentifier = datasetResponse[7]
dataset.type = datasetResponse[8][0] dataset.type = datasetResponse[8][0]
dataset.language = datasetResponse[9] dataset.language = datasetResponse[9]
dataset.spatial = datasetResponse[10] dataset.spatial = [...datasetResponse[10], ...datasetResponse[14]]
dataset.accrualPeriodicity = datasetResponse[11][0] dataset.accrualPeriodicity = datasetResponse[11][0]
dataset.license = datasetResponse[12][0] dataset.license = datasetResponse[12][0]
dataset.conformsTo = datasetResponse[13][0] dataset.conformsTo = datasetResponse[13][0]
// Format Dates
dataset.issued = dataset.issued ? new Date(Date.parse(dataset.issued)) : dataset.issued
dataset.modified = dataset.modified ? new Date(Date.parse(dataset.modified)) : dataset.modified
return dataset return dataset
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment