}
// Then ontology sources
if (coreOntologies != null) for (String ont : coreOntologies)
if (ont != null && !ont.isEmpty()) try {
srcs.add(new RootOntologySource(IRI.create(ont)));
} catch (OWLOntologyCreationException e2) {
// If this fails too, throw a bad request.
throw new WebApplicationException(e2, BAD_REQUEST);
}
// Now the creation.
try {
// Expand core sources
List<OntologyInputSource<?>> expanded = new ArrayList<OntologyInputSource<?>>();
for (OntologyInputSource<?> coreSrc : srcs)
if (coreSrc != null) {
if (coreSrc instanceof SetInputSource) {
for (Object o : ((SetInputSource<?>) coreSrc).getOntologies()) {
OntologyInputSource<?> src = null;
if (o instanceof OWLOntology) src = new RootOntologySource((OWLOntology) o);
else if (o instanceof TripleCollection) src = new GraphSource(
(TripleCollection) o);
if (src != null) expanded.add(src);
}
} else expanded.add(coreSrc); // Must be denoting a single ontology