init();
URI AURI = modelSet.createURI("http://example.com/models#A");
URI BURI = modelSet.createURI("http://example.com/models#B");
Model A = modelSet.getModel(AURI);
Model B = modelSet.getModel(BURI);
assert A.getContextURI() == AURI;
assert B.getContextURI() == BURI;
Model C = modelSet.getDefaultModel();
System.out.println(C.getContextURI());
System.out.println("\nAll context URIs:");
Iterator<URI> contextIt = modelSet.getModelURIs();
while(contextIt.hasNext()) {
System.out.println(contextIt.next());
}
//there is also modelSet.getModels()
//TODO: does getModelURIs return the null context?
defaultModels(A,B);
modelSet.dump();
//TODO explain A.isomorphicWith(Model other) in web
//TODO explain that ModelSet implements xyz (and therefore can be serialized, ...)
// set union
System.out.println("union of A and B (A \\Cap B):");
A.addAll(B.iterator());
A.dump();
defaultModels(A,B);
// set complement
System.out.println("complement of B in A (A\\B):");
A.removeAll(B.iterator());
A.dump();
defaultModels(A,B);
// set intersection
System.out.println("intersection of A and B (A \\Cup B):");
// intersection(A,B) == complement(A, complement(A,B))
C.addAll(A.iterator());
C.removeAll(B.iterator());
A.removeAll(C.iterator());
A.dump();
defaultModels(A,B);
// finding the statement "max knows konrad" in any model
System.out.println(modelSet.findStatements(Variable.ANY, max, knows, konrad));