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

Method checkCircular

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

Check circular references (object same as subject) @param con

(RepositoryConnection con)

Source from the content-addressed store, hash-verified

1057 * @param con
1058 */
1059 private static void checkCircular(RepositoryConnection con) {
1060 int circulars = 0;
1061
1062 try(RepositoryResult<Statement> res = con.getStatements(null, RDF.TYPE, null)) {
1063 while(res.hasNext()) {
1064 Resource subj = res.next().getSubject();
1065 try(RepositoryResult<Statement> res2 = con.getStatements(subj, null, subj)) {
1066 while(res2.hasNext()) {
1067 Resource obj = res2.next().getPredicate();
1068 LOG.warn("Circular reference {} {}", subj, obj);
1069 circulars++;
1070 }
1071 }
1072 }
1073 }
1074 LOG.info("Detected {} circulars", circulars);
1075 }
1076
1077 private static boolean isValidIRI(IRI iri) {
1078 String str = iri.stringValue();

Callers 1

mainMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected