@Override public String loadInStore(InputStream data, String formatIdentifier, String preferredKey, boolean force) { try { OWLOntology o = store.loadOntologyFromOntologyDocument(data); return OWLUtils.guessOntologyIdentifier(o).toString(); } catch (OWLOntologyCreationException e) { throw new IllegalArgumentException(e); } }
@Override public Set<String> getKeys() { Set<String> result = new HashSet<String>(); for (OWLOntology o : store.getOntologies()) result.add(OWLUtils.guessOntologyIdentifier(o).toString()); return result; }
@Override public String toString() { return "<ONTOLOGY_CONTENT>" + OWLUtils.guessOntologyIdentifier(getRootOntology()); }
@Override public String toString() { return "<GRAPH_CONTENT>" + OWLUtils.guessOntologyIdentifier(getRootOntology()); }
private void performAdd(OntologyInputSource<?,?> ontSrc) { Object obj = ontSrc.getRootOntology(); OWLOntology ontology = (OWLOntology) obj; // Should not modify the child ontology in any way. // TODO implement transaction control. // See to it that the ontology is copied to this manager. OWLOntology newOnt = reload((OWLOntology) ontology, ontologyManager, true, false); // if (newOnt!=null) managedOntologies.put(OWLUtils.guessOntologyIdentifier(newOnt), newOnt); try { // Store the top ontology if (!(this instanceof SessionOntologySpace)) { // No longer storing in OWLAPI implementation! // if (storage == null) log.warn( // "No ontology storage found. Ontology {} will be stored in-memory only.", ontology); // else { // // storage = new ClerezzaOntologyStorage(tcManager, wtcProvider) // storage.store(ontology); // } } // ONManager.get().getOntologyStore().load(rootOntology.getOntologyID().getOntologyIRI()); } catch (Exception ex) { log.warn("An error occurred while storing ontology " + ontology + " . Ontology management will be volatile.", ex); } fireOntologyAdded(OWLUtils.guessOntologyIdentifier(ontology)); }
protected Set<TripleCollection> getImportedGraphs(TripleCollection g, boolean recursive) { Set<TripleCollection> result = new HashSet<TripleCollection>(); UriRef u = OWLUtils.guessOntologyIdentifier(g); Iterator<Triple> it = g.filter(u, OWL.imports, null); while (it.hasNext()) { Resource r = it.next().getObject(); if (r instanceof UriRef) { TripleCollection gr = TcManager.getInstance().getTriples((UriRef) r); // Avoid calls to getGraph() to save memory // if (gr instanceof Graph) result.add(/* (Graph) */gr); // else if (gr instanceof MGraph) result.add(((MGraph) gr).getGraph()); if (recursive) result.addAll(getImportedGraphs(gr, true)); } } return result; }
@Override public String loadInStore(IRI location, String formatIdentifier, String preferredKey, boolean force) { OWLOntology o = null; try { o = store.loadOntologyFromOntologyDocument(location); } catch (OWLOntologyAlreadyExistsException e) { if (!force) o = store.getOntology(e.getOntologyID()); } catch (OWLOntologyDocumentAlreadyExistsException e) { if (!force) o = store.getOntology(e.getOntologyDocumentIRI()); } catch (OWLOntologyCreationException e) { throw new IllegalArgumentException(e); } return OWLUtils.guessOntologyIdentifier(o).toString(); }
uri = OWLUtils.guessOntologyIdentifier((TripleCollection) o); } else if (o instanceof OWLOntology) { uri = new UriRef(OWLUtils.guessOntologyIdentifier((OWLOntology) o).toString()); } else throw new UnsupportedOperationException( "This ontology collector implementation cannot handle " + o.getClass().getCanonicalName()
IRI idd = OWLUtils.guessOntologyIdentifier(ontology); if (mgr == null) mgr = ontologyManager; Set<OWLOntology> closure = withClosure ? ontology.getOWLOntologyManager().getImportsClosure(ontology) IRI id2 = OWLUtils.guessOntologyIdentifier(o);
new UriRef(iri); // Can I make a UriRef from it? } catch (Exception ex) { iri = OWLUtils.guessOntologyIdentifier(rdfData).getUnicodeString();