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

Method isUnique

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

Check uniqueness of dct:identifier @param con @param iri @return

(RepositoryConnection con, IRI iri)

Source from the content-addressed store, hash-verified

761 * @return
762 */
763 private static boolean isUnique(RepositoryConnection con, IRI iri) {
764 try (RepositoryResult<Statement> res = con.getStatements(iri, DCTERMS.IDENTIFIER, null)) {
765 while (res.hasNext()) {
766 String id = res.next().getObject().stringValue();
767 if (id.isBlank()) {
768 LOG.warn("Empty dct:identifier for {}", iri);
769 } else {
770 if (!IDENTIFIERS.add(id)) {
771 LOG.error("{} ID {} already present, skipping ...", iri, id);
772 return false;
773 }
774 }
775 }
776 }
777 return true;
778 }
779
780 /**
781 * Write DCAT dataset / service / series

Callers 1

writeResourcesMethod · 0.95

Calls 1

addMethod · 0.45

Tested by

no test coverage detected