log.debug("Deferring addition to stored Clerezza graph {} (if available).", ref);
key = addOntology(new GraphSource((UriRef) ref));
} else if (ref instanceof OWLOntologyID) {
OWLOntologyID idref = (OWLOntologyID) ref;
log.debug("Deferring addition to stored ontology with public key {} (if available).", ref);
if (!ontologyProvider.hasOntology(idref)) throw new MissingOntologyException(this, idref);
key = idref;
if (managedOntologies.add(idref)) fireOntologyAdded(idref);
} else throw new IllegalArgumentException("Invalid origin " + origin);
} else throw new IllegalArgumentException(
"Ontology source must provide either an ontology object, or a way to reference one (i.e. an origin).");