MCPcopy Create free account
hub / github.com/Fedict/dcattools / writeDates

Method writeDates

tools/src/main/java/be/gov/data/tools/EDP.java:240–257  ·  view source on GitHub ↗

Write temporal date info for a dcat:Dataset @param w XML writer @param con RDF triple store connection @param uri dataset URI @throws XMLStreamException

(XMLStreamWriter w, RepositoryConnection con, IRI uri)

Source from the content-addressed store, hash-verified

238 * @throws XMLStreamException
239 */
240 private static void writeDates(XMLStreamWriter w, RepositoryConnection con, IRI uri)
241 throws XMLStreamException {
242 try (RepositoryResult<Statement> res = con.getStatements(uri, DCTERMS.TEMPORAL, null)) {
243 while (res.hasNext()) {
244 Value v = res.next().getObject();
245 if (v instanceof IRI date) {
246 w.writeStartElement("dct:temporal");
247 w.writeStartElement("dct:PeriodOfTime");
248 writeLiterals(w, con, date, DCAT.START_DATE, "dcat:startDate");
249 writeLiterals(w, con, date, DCAT.END_DATE, "dcat:endDate");
250 w.writeEndElement();
251 w.writeEndElement();
252 } else {
253 LOG.error("Not a date IRI {}", v.stringValue());
254 }
255 }
256 }
257 }
258
259
260 /**

Callers 1

writeResourceMethod · 0.95

Calls 1

writeLiteralsMethod · 0.95

Tested by

no test coverage detected