/** * Apply the changes. * * @param changes the changes */ protected void apply(List<OWLOntologyChange> changes) { try { manager.applyChanges(changes); } catch (Exception e) { LOG.error("COULD NOT TRANSLATE AXIOM", e); } }
/** * Apply the changes. * * @param changes the changes */ protected void apply(List<OWLOntologyChange> changes) { try { manager.applyChanges(changes); } catch (Exception e) { LOG.error("COULD NOT TRANSLATE AXIOM", e); } }
/** * Apply the changes. * * @param changes the changes */ protected void apply(List<OWLOntologyChange> changes) { try { manager.applyChanges(changes); } catch (Exception e) { LOG.error("COULD NOT TRANSLATE AXIOM", e); } }
/** * Apply the changes. * * @param changes the changes */ protected void apply(List<OWLOntologyChange> changes) { try { manager.applyChanges(changes); } catch (Exception e) { LOG.error("COULD NOT TRANSLATE AXIOM", e); } }
@Override public ChangeApplied applyChanges(List<? extends OWLOntologyChange> changes) throws OWLOntologyRenameException { if (sealed) { throw new DirectChangeApplicationNotAllowedException(); } return delegate.applyChanges(changes); }
public void redo() { if (canRedo()) { try { typeOfChangeInProgress = ChangeType.REDOING; List<OWLOntologyChange> redoChanges = redoStack.pop(); manager.applyChanges(redoChanges); } catch (Exception e) { logger.error(e); } finally { typeOfChangeInProgress = ChangeType.NORMAL; } } }
public void redo() { if (canRedo()) { try { typeOfChangeInProgress = ChangeType.REDOING; List<OWLOntologyChange> redoChanges = redoStack.pop(); manager.applyChanges(redoChanges); } catch (Exception e) { logger.error("An error occurred whilst redoing the last set of undone changes.", e); } finally { typeOfChangeInProgress = ChangeType.NORMAL; } } }
public void redo() { if (canRedo()) { try { typeOfChangeInProgress = ChangeType.REDOING; List<OWLOntologyChange> redoChanges = redoStack.pop(); manager.applyChanges(redoChanges); } catch (Exception e) { logger.error("An error occurred whilst redoing the last set of undone changes.", e); } finally { typeOfChangeInProgress = ChangeType.NORMAL; } } }
private static OWLOntology createOntology(OWLOntologyManager manager, OWLAxiom axiom) throws OWLOntologyCreationException { OWLOntology ontology = manager.createOntology(); List<OWLOntologyChange> changes = new ArrayList<OWLOntologyChange>(); changes.add(new AddAxiom(ontology, axiom)); manager.applyChanges(changes); return ontology; }
/** * Reused from InferredOntologyGenerator * @param manager * @param ontology * @throws OWLOntologyChangeException */ public void fillOntology(OWLOntologyManager manager, OWLOntology ontology) throws OWLOntologyChangeException { List<OWLOntologyChange> changes = new ArrayList<OWLOntologyChange>(); for (InferredAxiomGenerator<? extends OWLAxiom> axiomGenerator : axiomGenerators) { for (OWLAxiom ax : axiomGenerator.createAxioms(manager, reasoner)) { changes.add(new AddAxiom(ontology, ax)); } } manager.applyChanges(changes); }
public void addAnnotations(OWLClass cls, Set<OWLAnnotation> annotations) { List<AddAxiom> changes = new ArrayList<AddAxiom>(); for (OWLAnnotation annotation : annotations) { changes.add(new AddAxiom(ontology, factory.getOWLAnnotationAssertionAxiom(cls.getIRI(), annotation))); } manager.applyChanges(changes); }
private void createDebuggingOntology() throws OWLException { if (debuggingOntology != null) { owlOntologyManager.removeOntology(debuggingOntology); } debuggingOntology = owlOntologyManager.createOntology(); List<OWLOntologyChange> changes = new ArrayList<OWLOntologyChange>(); for (OWLAxiom ax : debuggingAxioms) { changes.add(new AddAxiom(debuggingOntology, ax)); } owlOntologyManager.applyChanges(changes); }
protected OWLOntology extractAsOntology(Set<OWLEntity> signature, IRI iri, boolean verbose) throws OWLOntologyCreationException { Set<OWLAxiom> axs = extract(signature, verbose); OWLOntology newOnt = manager.createOntology(iri); LinkedList<AddAxiom> addaxs = new LinkedList<AddAxiom>(); for (OWLAxiom ax : axs) { addaxs.add(new AddAxiom(newOnt, ax)); } manager.applyChanges(addaxs); return newOnt; }
private OWLOntologyManager mergeOntologiesInNewManager(final OWLOntologyManager manager) throws OWLOntologyCreationException { final OWLOntologyManager newManager = OWLManager.createOWLOntologyManager(); final OWLOntology merged = newManager.createOntology(); final List<OWLOntologyChange> changes = new ArrayList<>(); manager.ontologies().forEach(ontology -> ontology.axioms().forEach(ax -> changes.add(new AddAxiom(merged, ax)))); newManager.applyChanges(changes); return newManager; }
private void writeOWLAxioms2OWLOntology(@NonNull Set<@NonNull OWLAxiom> axioms) throws SWRLRuleEngineException { OWLInferredAxiomFilter inferredAxiomFilter = new OWLInferredAxiomFilter(axioms); List<OWLAxiom> filteredAxioms = axioms.stream().filter(a -> !a.accept(inferredAxiomFilter)) .collect(Collectors.toList()); List<? extends OWLOntologyChange> changes = filteredAxioms.stream().map(a -> new AddAxiom(getOWLOntology(), a)) .collect(Collectors.toList()); try { getOWLOntologyManager().applyChanges(changes); } catch (RuntimeException e) { throw new SWRLRuleEngineException("Error writing OWL axioms to ontology", e); } }
public Set<OWLAxiom> getSOSForIncosistentClass(OWLClassExpression cls) throws OWLException { reset(); currentClass = setupDebuggingClass(cls); generateSOSAxioms(); for (OWLAxiom ax : temporaryAxioms) { owlOntologyManager.applyChanges(Arrays.asList(new RemoveAxiom(getOWLOntology(), ax))); } debuggingAxioms.removeAll(temporaryAxioms); ontologyCounter = 0; return new HashSet<OWLAxiom>(debuggingAxioms); }
public void copyClass(OWLClass cls, OWLClass parentClass, OntologyLoader ontologyLoader) { manager.applyChange(new AddAxiom(ontology, factory.getOWLSubClassOfAxiom(cls, parentClass))); List<AddAxiom> changes = new ArrayList<AddAxiom>(); for (OWLAnnotationAssertionAxiom axiom : ontologyLoader.getAllAnnotationAxiom(cls)) { changes.add(new AddAxiom(ontology, axiom)); } manager.applyChanges(changes); }
@Override public void visit(OWLClass desc) { ClassPatternExecutor patternExecutor = new ClassPatternExecutor(desc, (InstantiatedPatternModel) patternModel, ontology, ontologyManager, annotation.getProperty().getIRI(), HANDLER); List<OWLAxiomChange> changes = patternExecutor.visit(opplStatement); try { ontologyManager.applyChanges(changes); } catch (OWLOntologyChangeException e) { throw new RuntimeException(e); } } });
/** * Deletes the individual from Ontology */ public void delete() { OWLEntityRemover remover = new OWLEntityRemover(getOwlOntology().getOWLOntologyManager(), Collections .singleton(getOwlOntology())); owlIndividual.accept(remover); getOwlOntology().getOWLOntologyManager().applyChanges(remover.getChanges()); }
public static VersionedOntologyDocument loadOntology(Client client, OWLOntologyManager manager, RemoteOntologyDocument doc, RevisionPointer revision) throws OWLOntologyCreationException, OWLServerException { DocumentFactory factory = client.getDocumentFactory(); ChangeHistory changes = client.getChanges(doc, OntologyDocumentRevision.START_REVISION.asPointer(), revision); OWLOntology ontology = manager.createOntology(); List<OWLOntologyChange> changesAsChangeList = changes.getChanges(ontology); manager.applyChanges(changesAsChangeList); adjustImports(ontology, changesAsChangeList); VersionedOntologyDocument versionedOntology = factory.createVersionedOntology(ontology, doc, changes.getEndRevision()); versionedOntology.appendLocalHistory(changes); return versionedOntology; }