Skip to content

Commit 4a99ffe

Browse files
authored
Merge pull request #108 from opendata-swiss/fix/export-distribution-issued-and-modified-dates
Fix/export distribution issued and modified dates
2 parents e6ba527 + 63f0b2e commit 4a99ffe

File tree

4 files changed

+11
-2
lines changed

4 files changed

+11
-2
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ To install ckanext-dcatapchharvest for development, activate your CKAN virtualen
3636
do:
3737

3838
git clone https://github.com/ogdch/ckanext-dcatapchharvest.git
39-
cd ckanext-switzerland
39+
cd ckanext-dcatapchharvest
4040
python setup.py develop
4141
pip install -r dev-requirements.txt
4242
pip install -r requirements.txt

ckanext/dcatapchharvest/profiles.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1027,6 +1027,8 @@ def graph_from_dataset(self, dataset_dict, dataset_ref): # noqa
10271027
('issued', DCT.issued, None, Literal),
10281028
('modified', DCT.modified, None, Literal),
10291029
]
1030+
self._add_date_triples_from_dict(resource_dict, distribution,
1031+
items)
10301032

10311033
# ByteSize
10321034
if resource_dict.get('byte_size'):

ckanext/dcatapchharvest/tests/fixtures/dataset.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,9 @@
123123
],
124124
"rights": "Creative Commons Zero 1.0 Universell (CC0 1.0)",
125125
"license": "NonCommercialAllowed-CommercialAllowed-ReferenceNotRequired",
126-
"format": "CSV"
126+
"format": "CSV",
127+
"issued": "2015-06-26T15:21:09.034694",
128+
"modified": "2015-06-30T15:21:09.000000"
127129
},
128130
{
129131
"id": "28e75e40-e1a1-497b-a1b9-8c1834d60201",

ckanext/dcatapchharvest/tests/test_dcatap_ch_serialize.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,11 @@ def test_graph_from_dataset(self):
161161
expected_literal = Literal("P1D", datatype=XSD.duration)
162162
assert self._triple(g, distribution, DCAT.temporalResolution, expected_literal)
163163

164+
if resource_dict.get('issued'):
165+
assert self._triple(g, distribution, DCT.issued, resource_dict["issued"], XSD.dateTime)
166+
167+
if resource_dict.get('modified'):
168+
assert self._triple(g, distribution, DCT.modified, resource_dict["modified"], XSD.dateTime)
164169

165170
def test_graph_from_dataset_uri(self):
166171
"""Tests that datasets (resources) with a uri from the test system

0 commit comments

Comments
 (0)