private void addLists(RepositoryConnection conn, Model schema)
throws RepositoryException {
boolean modified = false;
List<Value> lists = new ArrayList<Value>();
for (URI pred : LIST_PROPERTIES) {
lists.addAll(schema.filter(null, pred, null).objects());
}
for (Value list : lists) {
if (list instanceof Resource
&& !schema.contains((Resource) list, null, null)) {
RepositoryResult<Statement> stmts = conn.getStatements(
(Resource) list, null, null, true);
try {
while (stmts.hasNext()) {
schema.add(stmts.next());
modified = true;
}
} finally {
stmts.close();
}
}
}
if (modified) {
addLists(conn, schema);
}
}