Skip to content

Commit 54bc40c

Browse files
committed
date
1 parent bd9736b commit 54bc40c

File tree

2 files changed

+15
-31
lines changed

2 files changed

+15
-31
lines changed

backend/src/design/plone/opendata/browser/dcatapit.py

+10-26
Original file line numberDiff line numberDiff line change
@@ -225,21 +225,23 @@ def __call__(self):
225225
g.add((catalog_node, DCAT.dataset, dataset_uri))
226226
g.add((dataset_uri, RDF.type, DCATAPIT.Dataset))
227227
g.add((dataset_uri, DCT.identifier, Literal(brain.getURL())))
228-
229-
# XXX: verificare il formato iso delle date usato da CKAN
230228
g.add(
231229
(
232230
dataset_uri,
233231
DCT.modified,
234-
Literal(
235-
brain.modified.asdatetime().isoformat(), datatype=XSD.dateTime
236-
),
232+
Literal(obj.last_update_date.isoformat(), datatype=XSD.date),
233+
)
234+
)
235+
g.add(
236+
(
237+
dataset_uri,
238+
DCT.issued,
239+
Literal(obj.release_date.isoformat(), datatype=XSD.date),
237240
)
238241
)
239242
g.add((dataset_uri, DCT.accrualPeriodicity, Literal(obj.frequency)))
240243

241244
g.add((dataset_uri, DCT.title, Literal(obj.Title(), lang=lang)))
242-
# g.add((dataset_uri, DCT.issued, Literal(record['PubDate'], datatype=XSD.dateTime)))
243245
g.add((dataset_uri, DCT.description, Literal(obj.Description(), lang=lang)))
244246
for theme in obj.themes:
245247
theme_uri = URIRef(theme)
@@ -268,16 +270,6 @@ def __call__(self):
268270
g.add((dataset_uri, DCAT.contactPoint, org_node))
269271
g.add((dataset_uri, DCT.publisher, publisher_node))
270272

271-
# location_node = BNode()
272-
# g.add((dataset_uri, DCT.spatial, location_node))
273-
# g.add((location_node, RDF.type, DCT.Location))
274-
# g.add((location_node, DCATAPIT.geographicalIdentifier, URIRef("https://www.geonames.org/6538969")))
275-
276-
# g.add((dataset_uri, DCT.accrualPeriodicity, URIRef("http://publications.europa.eu/resource/authority/frequency/CONT")))
277-
# g.add((dataset_uri, DCT.language, URIRef("http://publications.europa.eu/resource/authority/language/ITA")))
278-
# g.add((dataset_uri, DCT.modified, Literal(record['ModifiedDate'], datatype=XSD.dateTime)))
279-
# g.add((dataset_uri, DCAT.landingPage, URIRef(f"{catalog_uri}/dataset/{record['ID']}")))
280-
281273
for file_brain in catalog(path=brain.getPath(), portal_type="File"):
282274
distribution_uri = URIRef(file_brain.getURL())
283275

@@ -289,7 +281,8 @@ def __call__(self):
289281
(
290282
distribution_uri,
291283
DCAT.accessURL,
292-
# TODO: qui andrebbe messo il filename, anzichè "file", serve la getObject per recuperarlo ?
284+
# TODO: qui andrebbe messo il filename, anzichè "file",
285+
# serve la getObject per recuperarlo ?
293286
URIRef(f"{file_brain.getURL()}/@@download/file"),
294287
)
295288
)
@@ -370,15 +363,6 @@ def __call__(self):
370363
# XXX: per semplicità usiamo il rghtsHolder del dataset
371364
g.add((distribution_uri, DCAT.contactPoint, holder_uri))
372365

373-
# for keyword in record['Keywords'].split(","):
374-
# g.add((dataset_uri, DCAT.keyword, Literal(keyword.strip())))
375-
376-
# dataset_uri = URIRef(obj.absolute_url())
377-
# g.add((dataset_uri, DCT.title, Literal(obj.Title())))
378-
# g.add((dataset_uri, DCT.issued, Literal(record['PubDate'])))
379-
# g.add((dataset_uri, DCAT.theme, Literal(record['Theme'])))
380-
381-
# Salva l'RDF in un file
382366
out = io.BytesIO()
383367
g.serialize(destination=out, format=self.format)
384368
data = out.getvalue()

backend/src/design/plone/opendata/content/dataset.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,13 @@ class IOpendataDataset(model.Schema):
1919
# Dataset descrizione M --> plone.basic (TODO: deve essere obbligatorio? Oppure lo pubblichiamo ripetendo
2020
# il titolo, se non compilato, nell'RDF)
2121

22-
# Dataset data di rilascio O
23-
release_date = schema.Datetime(title=_("Data di rilascio"), required=False)
22+
# Dataset data di rilascio
23+
# Volto fa casino con la timezone, metto per ora una data anzichè un dattetime
24+
release_date = schema.Date(title=_("Data di rilascio"), required=False)
2425

2526
# Dataset data ultima modifica M --> dato redazionale !!!
26-
last_update_date = schema.Datetime(
27-
title=_("Data di ultima modifica"), required=True
28-
)
27+
# Volto fa casino con la timezone, metto per ora una data anzichè un dattetime
28+
last_update_date = schema.Date(title=_("Data di ultima modifica"), required=True)
2929

3030
# Dataset temi M
3131
themes = schema.Set(

0 commit comments

Comments
 (0)