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

Method writeContacts

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

Write multiple contact points of a dcat:Dataset @param w XML writer @param con RDF triple store connection @param uri URI of the dataset @param pred RDF predicate @throws XMLStreamException

(XMLStreamWriter w, RepositoryConnection con,
		IRI uri, IRI pred)

Source from the content-addressed store, hash-verified

267 * @throws XMLStreamException
268 */
269 private static void writeContacts(XMLStreamWriter w, RepositoryConnection con,
270 IRI uri, IRI pred) throws XMLStreamException {
271 try (RepositoryResult<Statement> res = con.getStatements(uri, pred, null)) {
272 while (res.hasNext()) {
273 Value v = res.next().getObject();
274 if (v instanceof IRI && con.hasStatement(null, null, (IRI) v, false)) {
275 IRI contact = (IRI) v;
276 w.writeStartElement("dcat:contactPoint");
277 w.writeStartElement("vcard:Kind");
278 writeLiterals(w, con, contact, VCARD4.FN, "vcard:fn");
279 writeLiterals(w, con, contact, VCARD4.ORGANIZATION_NAME, "vcard:hasOrganizationName");
280 writeLiterals(w, con, contact, VCARD4.HAS_ORGANIZATION_NAME, "vcard:hasOrganizationName");
281 writeReferences(w, con, contact, VCARD4.HAS_URL, "vcard:hasURL");
282 writeReferences(w, con, contact, VCARD4.HAS_EMAIL, "vcard:hasEmail");
283 writeReferences(w, con, contact, VCARD4.HAS_TELEPHONE, "vcard:hasTelephone");
284 w.writeEndElement();
285 w.writeEndElement();
286 } else {
287 LOG.error("Not a contact IRI {}", v.stringValue());
288 }
289 }
290 }
291 }
292
293 /**
294 * Write qualified roles of a dcat:Dataset

Callers 1

writeResourceMethod · 0.95

Calls 2

writeLiteralsMethod · 0.95
writeReferencesMethod · 0.95

Tested by

no test coverage detected