Skip to content

Commit

Permalink
fix(ckan): distributions must be named nodes
Browse files Browse the repository at this point in the history
  • Loading branch information
tpluscode committed Oct 24, 2024
1 parent c3be8dc commit b47dfb7
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/grumpy-steaks-hear.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@zazuko/trifid-plugin-ckan": patch
---

The CKAN harvester ignored blank node distributions. All distributions are named nodes now
3 changes: 2 additions & 1 deletion packages/ckan/src/xml.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,9 @@ const toXML = (dataset) => {
}))

const copiedDistributions = dataset.out(ns.dcat.distribution)
.map(distribution => ({
.map((distribution, index) => ({
'dcat:Distribution': {
'@': { 'rdf:about': `${dataset.value}/distribution/${index + 1}` },
'dcterms:issued': serializeTerm(dataset.out(ns.dcterms.issued)),
'dcterms:modified': serializeTerm(dataset.out(ns.dcterms.modified)),
'dcterms:license': serializeTerm(copyright),
Expand Down
2 changes: 1 addition & 1 deletion packages/ckan/test/ckan.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ describe('@zazuko/trifid-plugin-ckan', () => {

expect(distributions).to.have.length(2)
const expected = await parser.parseStringPromise(`
<dcat:Distribution>
<dcat:Distribution rdf:about="https://agriculture.ld.admin.ch/foag/cube/MilkDairyProducts/Production_Quantity_Month/distribution/1">
<dcterms:issued rdf:datatype="http://www.w3.org/2001/XMLSchema#date">2024-02-01</dcterms:issued>
<dcterms:format rdf:resource="http://publications.europa.eu/resource/authority/file-type/CSV"/>
<dcat:accessURL rdf:resource="http://foo.bar/"/>
Expand Down

0 comments on commit b47dfb7

Please sign in to comment.