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

fix: multilang publisher names #307

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/curvy-actors-glow.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@zazuko/trifid-plugin-ckan": patch
---

Language tages were lost from publisher names
tpluscode marked this conversation as resolved.
Show resolved Hide resolved
4 changes: 2 additions & 2 deletions packages/ckan/src/xml.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,13 +88,13 @@ const toXML = (dataset) => {
const publishers = dataset.out(ns.dcterms.publisher)
.map(publisher => {
const attr = {}
/** @type {string | string[]} */
/** @type {string | Record<string, unknown>[]} */
let name = publisher.value

if (isNamedNode(publisher)) {
attr['rdf:about'] = publisher.value
if (publisher.out(ns.schema.name).values.length > 0) {
name = publisher.out(ns.schema.name).values
name = publisher.out(ns.schema.name).map(serializeLiteral)
}
}

Expand Down
5 changes: 4 additions & 1 deletion packages/ckan/test/ckan.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,10 @@ describe('@zazuko/trifid-plugin-ckan', () => {

const expected = await parser.parseStringPromise(`
<foaf:Organization rdf:about="https://register.ld.admin.ch/opendataswiss/org/bundesamt-fur-landwirtschaft-blw">
<foaf:name>Bundesamt für Landwirtschaft</foaf:name>
<foaf:name xml:lang="de">Bundesamt für Landwirtschaft</foaf:name>
<foaf:name xml:lang="en">Federal Office for Agriculture</foaf:name>
<foaf:name xml:lang="fr">Office fédéral de l'agriculture</foaf:name>
<foaf:name xml:lang="it">Ufficio federale dell'agricoltura</foaf:name>
</foaf:Organization>`)
expect(publisher).to.containSubset(expected)
})
Expand Down
6 changes: 3 additions & 3 deletions packages/ckan/test/support/data.ttl
Original file line number Diff line number Diff line change
Expand Up @@ -166,9 +166,9 @@ _:genid2de581ad199db849c2a2500f49babdf0072d0b695fb815fb9 a schema:ContactPoint,
<https://register.ld.admin.ch/opendataswiss/org/bundesamt-fur-landwirtschaft-blw>
rdf:type schema:Organization ;
schema:name "Bundesamt für Landwirtschaft"@de ;
# schema:name "Federal Office for Agriculture"@en ;
# schema:name "Office fédéral de l'agriculture"@fr ;
# schema:name "Ufficio federale dell'agricoltura"@it ;
schema:name "Federal Office for Agriculture"@en ;
schema:name "Office fédéral de l'agriculture"@fr ;
schema:name "Ufficio federale dell'agricoltura"@it ;
.

category:gove
Expand Down
Loading