-
Notifications
You must be signed in to change notification settings - Fork 6
Open
Description
Ajout d'un endpoint renvoyant la description d'un indicateur (y compris le lien vers son rapport qualité)
Edit : ajout d'une proposition de requête et de réponse json
# Requête Magma-fusion pour le service /operations/indicateur/{id}
SELECT ?indicatorId ?indicator
?indicatorLabelLg1 ?indicatorLabelLg2 ?indicatorAltLabelLg1 ?indicatorAltLabelLg2
?indicatorAbstractLg1 ?indicatorAbstractLg2 ?indicatorHistoryNoteLg1 ?indicatorHistoryNoteLg2
?periodicity ?periodicityId ?periodicityLabelLg1 ?periodicityLabelLg2
?wasGeneratedBySeries
?seeAlsoSeries ?seeAlsoIndicators
?sims ?simsId
?created ?modified
?creators ?publishers ?contributors
?validationState
WHERE {
BIND('${indicatorId}' AS ?indicatorId)
# NB: pour l'instant, les variables de langue ne sont pas reportées dans les sous-requêtes
BIND('${LG1}' AS ?lg1)
BIND('${LG2}' AS ?lg2)
# Un indicateur est un StatisticalIndicator
?indicator a insee:StatisticalIndicator .
FILTER(STRAFTER(STR(?indicator),'/produits/indicateur/') = ?indicatorId ) .
#Infos sur l'indicateur lui-même (tout en OPTIONAL pour éviter les problèmes)
#Labels
OPTIONAL {?indicator skos:prefLabel ?indicatorLabelLg1 . FILTER (lang(?indicatorLabelLg1) = ?lg1)}
OPTIONAL {?indicator skos:prefLabel ?indicatorLabelLg2 . FILTER (lang(?indicatorLabelLg2) = ?lg2)}
#Alt labels
OPTIONAL {?indicator skos:altLabel ?indicatorAltLabelLg1 . FILTER (lang(?indicatorAltLabelLg1) = ?lg1)}
OPTIONAL {?indicator skos:altLabel ?indicatorAltLabelLg2 . FILTER (lang(?indicatorAltLabelLg2) = ?lg2)}
#Abstract
OPTIONAL {?indicator dcterms:abstract ?indicatorAbstractLg1 . FILTER (lang(?indicatorAbstractLg1) = ?lg1)}
OPTIONAL {?indicator dcterms:abstract ?indicatorAbstractLg2 . FILTER (lang(?indicatorAbstractLg2) = ?lg2)}
#HistoryNote
OPTIONAL {?indicator skos:historyNote ?indicatorHistoryNoteLg1 . FILTER (lang(?indicatorHistoryNoteLg1) = ?lg1)}
OPTIONAL {?indicator skos:historyNote ?indicatorHistoryNoteLg2 . FILTER (lang(?indicatorHistoryNoteLg2) = ?lg2)}
#Periodicity
OPTIONAL {
?indicator dcterms:accrualPeriodicity ?periodicity .
OPTIONAL {?periodicity skos:notation ?periodicityId}
OPTIONAL{?periodicity skos:prefLabel ?periodicityLabelLg1 . FILTER (lang(?periodicityLabelLg1) = ?lg1)}
OPTIONAL{?periodicity skos:prefLabel ?periodicityLabelLg2 . FILTER (lang(?periodicityLabelLg2) = ?lg2)}
}
#Séries mères (il peut y en avoir plusieurs)
OPTIONAL {
SELECT ?indicator (GROUP_CONCAT(DISTINCT CONCAT(STR(?wasGeneratedBySerieId), '$', STR(?wasGeneratedBySerie), '$', COALESCE(?wasGeneratedBySerieLabelLg1, ''), '$', COALESCE(?wasGeneratedBySerieLabelLg2, '')) ; SEPARATOR='|') AS ?wasGeneratedBySeries)
WHERE {
?wasGeneratedBySerie a insee:StatisticalOperationSeries ; (^prov:wasGeneratedBy) ?indicator .
BIND(STRAFTER(STR(?wasGeneratedBySerie),'/operations/serie/') AS ?wasGeneratedBySerieId ) .
OPTIONAL {?wasGeneratedBySerie skos:prefLabel ?wasGeneratedBySerieLabelLg1 . FILTER (lang(?wasGeneratedBySerieLabelLg1) = '${LG1}')}
OPTIONAL {?wasGeneratedBySerie skos:prefLabel ?wasGeneratedBySerieLabelLg2 . FILTER (lang(?wasGeneratedBySerieLabelLg2) = '${LG2}')}
}
GROUP BY ?indicator
}
# Autres objets liés à l'indicateur
#Séries voir aussi
OPTIONAL {
SELECT ?indicator (GROUP_CONCAT(DISTINCT CONCAT(STR(?seeAlsoSerieId), '$', STR(?seeAlsoSerie), '$', COALESCE(?seeAlsoSerieLabelLg1, ''), '$', COALESCE(?seeAlsoSerieLabelLg2, '')) ; SEPARATOR='|') AS ?seeAlsoSeries)
WHERE {
?seeAlsoSerie a insee:StatisticalOperationSeries ; (^rdfs:seeAlso|rdfs:seeAlso) ?indicator .
BIND(STRAFTER(STR(?seeAlsoSerie),'/operations/serie/') AS ?seeAlsoSerieId ) .
OPTIONAL {?seeAlsoSerie skos:prefLabel ?seeAlsoSerieLabelLg1 . FILTER (lang(?seeAlsoSerieLabelLg1) = '${LG1}')}
OPTIONAL {?seeAlsoSerie skos:prefLabel ?seeAlsoSerieLabelLg2 . FILTER (lang(?seeAlsoSerieLabelLg2) = '${LG2}')}
}
GROUP BY ?indicator
}
#Indicateurs voir aussi
OPTIONAL {
SELECT ?indicator (GROUP_CONCAT(DISTINCT CONCAT(STR(?seeAlsoIndicatorId), '$', STR(?seeAlsoIndicator), '$', COALESCE(?seeAlsoIndicatorLabelLg1, ''), '$', COALESCE(?seeAlsoIndicatorLabelLg2, '')) ; SEPARATOR='|') AS ?seeAlsoIndicators)
WHERE {
?seeAlsoIndicator a insee:StatisticalIndicator ; (^rdfs:seeAlso|rdfs:seeAlso) ?indicator .
BIND(STRAFTER(STR(?seeAlsoIndicator),'/produits/indicateur/') AS ?seeAlsoIndicatorId ) .
OPTIONAL {?seeAlsoIndicator skos:prefLabel ?seeAlsoIndicatorLabelLg1 . FILTER (lang(?seeAlsoIndicatorLabelLg1) = '${LG1}')}
OPTIONAL {?seeAlsoIndicator skos:prefLabel ?seeAlsoIndicatorLabelLg2 . FILTER (lang(?seeAlsoIndicatorLabelLg2) = '${LG2}')}
}
GROUP BY ?indicator
}
#Sims
OPTIONAL {
?sims a sdmx-mm:MetadataReport; sdmx-mm:target ?indicator .
BIND(STRAFTER(STR(?sims),'/qualite/rapport/') AS ?simsId)
}
# Informations de gestion
# Dates
OPTIONAL {?indicator dcterms:created ?created}
OPTIONAL {?indicator dcterms:modified ?modified}
# Agents
# Creator
OPTIONAL {
SELECT ?indicator (GROUP_CONCAT(DISTINCT CONCAT(COALESCE(?creatorId, ''), '$', STR(?creator), '$', COALESCE(?creatorLabelLg1, ''), '$', COALESCE(?creatorLabelLg2, '')) ; SEPARATOR='|') AS ?creators)
WHERE {
?creator a org:Organization ; ^dc:creator ?indicator .
OPTIONAL{?creator dct:identifier ?creatorId}
OPTIONAL {?creator skos:prefLabel ?creatorLabelLg1 . FILTER (lang(?creatorLabelLg1) = '${LG1}')}
OPTIONAL {?creator skos:prefLabel ?creatorLabelLg2 . FILTER (lang(?creatorLabelLg2) = '${LG2}')}
}
GROUP BY ?indicator
}
# Publisher
OPTIONAL {
SELECT ?indicator (GROUP_CONCAT(DISTINCT CONCAT(COALESCE(?publisherId, ''), '$', STR(?publisher), '$', COALESCE(?publisherLabelLg1, ''), '$', COALESCE(?publisherLabelLg2, '')) ; SEPARATOR='|') AS ?publishers)
WHERE {
?publisher a org:Organization ; ^dcterms:publisher ?indicator .
OPTIONAL{?publisher dct:identifier ?publisherId}
OPTIONAL {?publisher skos:prefLabel ?publisherLabelLg1 . FILTER (lang(?publisherLabelLg1) = '${LG1}')}
OPTIONAL {?publisher skos:prefLabel ?publisherLabelLg2 . FILTER (lang(?publisherLabelLg2) = '${LG2}')}
}
GROUP BY ?indicator
}
# Contributor
OPTIONAL {
SELECT ?indicator (GROUP_CONCAT(DISTINCT CONCAT(COALESCE(?contributorId, ''), '$', STR(?contributor), '$', COALESCE(?contributorLabelLg1, ''), '$', COALESCE(?contributorLabelLg2, '')) ; SEPARATOR='|') AS ?contributors)
WHERE {
?contributor a org:Organization ; ^dcterms:contributor ?indicator .
OPTIONAL{?contributor dct:identifier ?contributorId}
OPTIONAL {?contributor skos:prefLabel ?contributorLabelLg1 . FILTER (lang(?contributorLabelLg1) = '${LG1}')}
OPTIONAL {?contributor skos:prefLabel ?contributorLabelLg2 . FILTER (lang(?contributorLabelLg2) = '${LG2}')}
}
GROUP BY ?indicator
}
# Statut
OPTIONAL {?indicator insee:validationState ?validationState}
}Qui donnerait comme résultat :
{
"id": "?indicatorId",
"uri": "?indicator",
"label": [
{
"contenu": ".indicatorLabelLg1",
"langue": "?lg1"
},
{
"contenu": "?indicatorLabelLg2",
"langue": "?lg2"
}
],
"altLabel": [
{
"contenu": "?indicatorAltLabelLg1",
"langue": "?lg1"
},
{
"contenu": "?indicatorAltLabelLg2",
"langue": "?lg2"
}
],
"resume": [
{
"contenu": "?indicatorAbstractLg1",
"langue": "?lg1"
},
{
"contenu": "?indicatorAbstractLg2",
"langue": "?lg2"
}
],
"noteHistorique": [
{
"contenu": "?indicatorHistoryNoteLg1",
"langue": "?lg1"
},
{
"contenu": "?indicatorHistoryNoteLg2",
"langue": "?lg2"
}
],
"frequenceCollecte": {
"id": "?periodicityId",
"uri": "?periodicity",
"label": [
{
"contenu": "?periodicityLabelLg1",
"langue": "?lg1"
},
{
"contenu": "?periodicityLabelLg2",
"langue": "?lg2"
}
]
},
"rapportQualite": {
"id": "?simsId",
"uri": "?sims"
},
"seriesContributrices": [
{
"id": "wasGeneratedBySeries[1]",
"uri": "wasGeneratedBySeries[2]",
"label": [
{
"contenu": "wasGeneratedBySeries[3]",
"langue": "?lg1"
},
{
"contenu": "wasGeneratedBySeries[4]",
"langue": "?lg2"
}
]
}
],
"seriesLiees": [
{
"id": "?seeAlsoSeries[1]",
"uri": "?seeAlsoSeries[2]",
"label": [
{
"contenu": "?seeAlsoSeriesseeAlsoSeries[3]",
"langue": "?lg1"
},
{
"contenu": "?seeAlsoSeries[4]",
"langue": "?lg2"
}
]
}
],
"indicateursLies": [
{
"id": "?indicators[1]",
"uri": "?indicators[2]",
"label": [
{
"contenu": "?indicators[3]",
"langue": "?lg1"
},
{
"contenu": "?indicators[4]",
"langue": "?lg2"
}
]
}
],
"dateCreation": "?created",
"dateMiseAJour": "?modified",
"proprietaires": [
{
"id": "?creators[1]",
"uri": "?creators[2]",
"label": [
{
"contenu": "?creators[3]",
"langue": "?lg1"
},
{
"contenu": "?creators[4]",
"langue": "?lg2"
}
]
}
],
"organismesResponsables": [
{
"id": "?publishers[1]",
"uri": "?publishers[2]",
"label": [
{
"contenu": "?publishers[3]",
"langue": "?lg1"
},
{
"contenu": "?publishers[4]",
"langue": "?lg2"
}
]
}
],
"partenaires": [
{
"id": "?contributors[1]",
"uri": "?contributors[2]",
"label": [
{
"contenu": "?contributors[3]",
"langue": "?lg1"
},
{
"contenu": "?contributors[4]",
"langue": "?lg2"
}
]
}
],
"statutValidation": "?validationState"
}Même remarque que dans la carte pour /operations/serie/{id} : les ressources multiples sont regroupées dans des sous-requêtes avec des GROUP BY dans la requête proposée, ce qui nécessite des doubles split de chaîne de caractère en Java. Le choix fait pour /operations/serie/{id} s'appliquera de la même manière ici.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels