Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update some CKAN properties #265

Merged
merged 14 commits into from
Feb 27, 2024
11 changes: 6 additions & 5 deletions packages/ckan/src/xml.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ const toXML = (dataset) => {
dcat: prefixes.dcat,
dcterms: prefixes.dcterms,
vcard: prefixes.vcard,
foaf: prefixes.foaf,
},
}, {
'rdf:RDF': {
Expand Down Expand Up @@ -73,22 +74,22 @@ const toXML = (dataset) => {
'dcat:mediaType': serializeTerm(workExample.out(ns.schema.encodingFormat)),
'dcat:accessURL': serializeTerm(workExample.out(ns.schema.url)),
'dcterms:title': serializeTerm(workExample.out(ns.schema.name)),
'dcterms:rights': serializeTerm(copyright),
'dcterms:license': serializeTerm(copyright),
'dcterms:format': { '#': distributionFormatFromEncoding(workExample.out(ns.schema.encodingFormat)) },
},
}))

const publishers = dataset.out(ns.dcterms.publisher)
.map(publisher => ({
'rdf:Description': {
'rdfs:label': publisher.value,
'foaf:Organization': {
'foaf:name': publisher.value,
tpluscode marked this conversation as resolved.
Show resolved Hide resolved
},
}))

// Datasets contain a mix of legacy (DC) frequencies and new (EU) frequencies.
// The query makes sure we get both legacy and new ones, we only
// provide the new ones to CKAN, by converting legacy ones if needed.
const legacyFreqPrefix = 'http://publications.europa.eu/resource/authority/frequency/'
const euFreqPrefix = 'http://publications.europa.eu/resource/authority/frequency/'
const accrualPeriodicity = dataset.out(ns.dcterms.accrualPeriodicity)
.map((t) => {
if (!t.term || !t.term.value) {
Expand All @@ -98,7 +99,7 @@ const toXML = (dataset) => {
t.term.value = convertLegacyFrequency(t.term.value)
return t
})
.filter(({ term }) => term.value.startsWith(legacyFreqPrefix))
.filter(({ term }) => term.value.startsWith(euFreqPrefix))

return {
'dcat:Dataset': {
Expand Down