public OWLClassExpressionMinimizer(OWLDataFactory dataFactory, AbstractReasonerComponent reasoner) { this.df = dataFactory; this.reasoner = reasoner; objectDuplicator = new OWLObjectDuplicator(dataFactory); }
/** * @param entity2IRIMap map of IRIs to rename * @return list of changes */ public List<OWLOntologyChange> changeIRI(Map<OWLEntity, IRI> entity2IRIMap) { List<OWLOntologyChange> changes = new ArrayList<>(); OWLObjectDuplicator duplicator = new OWLObjectDuplicator(entity2IRIMap, m); for (OWLOntology ont : ontologies) { entity2IRIMap.keySet().forEach( e -> fillListWithTransformChanges(changes, getAxioms(ont, e), ont, duplicator)); } return changes; } }
/** * @param entity2IRIMap map of IRIs to rename * @return list of changes */ public List<OWLOntologyChange> changeIRI(Map<OWLEntity, IRI> entity2IRIMap) { List<OWLOntologyChange> changes = new ArrayList<>(); OWLObjectDuplicator duplicator = new OWLObjectDuplicator(entity2IRIMap, m); for (OWLOntology ont : ontologies) { entity2IRIMap.keySet().forEach( e -> fillListWithTransformChanges(changes, getAxioms(ont, e), ont, duplicator)); } return changes; } }
/** * @param entity2IRIMap map of IRIs to rename * @return list of changes */ public List<OWLOntologyChange> changeIRI(Map<OWLEntity, IRI> entity2IRIMap) { List<OWLOntologyChange> changes = new ArrayList<>(); OWLObjectDuplicator duplicator = new OWLObjectDuplicator(entity2IRIMap, m); for (OWLOntology ont : ontologies) { entity2IRIMap.keySet().forEach( e -> fillListWithTransformChanges(changes, getAxioms(ont, e), ont, duplicator)); } return changes; } }
/** * Changes the IRI of an entity for another IRI. * * @param entity The entity whose IRI is to be changed. * @param newIRI The new IRI * @return A list of ontology changes that should be applied to change the specified entity IRI. */ public List<OWLOntologyChange> changeIRI(OWLEntity entity, IRI newIRI) { Map<OWLEntity, IRI> iriMap = new HashMap<>(); iriMap.put(entity, newIRI); List<OWLOntologyChange> changes = new ArrayList<>(); OWLObjectDuplicator duplicator = new OWLObjectDuplicator(iriMap, m); ontologies.forEach( o -> fillListWithTransformChanges(changes, getAxioms(o, entity), o, duplicator)); return changes; }
/** * Changes the IRI of an entity for another IRI. * * @param entity The entity whose IRI is to be changed. * @param newIRI The new IRI * @return A list of ontology changes that should be applied to change the specified entity IRI. */ public List<OWLOntologyChange> changeIRI(OWLEntity entity, IRI newIRI) { Map<OWLEntity, IRI> iriMap = new HashMap<>(); iriMap.put(entity, newIRI); List<OWLOntologyChange> changes = new ArrayList<>(); OWLObjectDuplicator duplicator = new OWLObjectDuplicator(iriMap, m); ontologies.forEach( o -> fillListWithTransformChanges(changes, getAxioms(o, entity), o, duplicator)); return changes; }
/** * Changes the IRI of an entity for another IRI. * * @param entity The entity whose IRI is to be changed. * @param newIRI The new IRI * @return A list of ontology changes that should be applied to change the specified entity IRI. */ public List<OWLOntologyChange> changeIRI(OWLEntity entity, IRI newIRI) { Map<OWLEntity, IRI> iriMap = new HashMap<>(); iriMap.put(entity, newIRI); List<OWLOntologyChange> changes = new ArrayList<>(); OWLObjectDuplicator duplicator = new OWLObjectDuplicator(iriMap, m); ontologies.forEach( o -> fillListWithTransformChanges(changes, getAxioms(o, entity), o, duplicator)); return changes; }
public List<OWLOntologyChange> changeIRI(Map<OWLEntity, IRI> entity2IRIMap) { List<OWLOntologyChange> changes = new ArrayList<OWLOntologyChange>(); for (OWLOntology ont : ontologies) { for (OWLEntity ent : entity2IRIMap.keySet()) { OWLObjectDuplicator duplicator = new OWLObjectDuplicator(entity2IRIMap, owlOntologyManager.getOWLDataFactory()); fillListWithTransformChanges(changes, getAxioms(ont, ent), ont, duplicator); } } return changes; }
/** * @param literalToLiteralMap map of literals to change * @return list of changes */ public List<OWLOntologyChange> changeLiterals(Map<OWLLiteral, OWLLiteral> literalToLiteralMap) { List<OWLOntologyChange> changes = new ArrayList<>(); OWLObjectDuplicator duplicator = new OWLObjectDuplicator( Collections.<OWLEntity, IRI>emptyMap(), literalToLiteralMap, owlOntologyManager); for (OWLOntology ont : ontologies) { assert ont != null; for (OWLLiteral ent : literalToLiteralMap.keySet()) { assert ent != null; fillListWithTransformChanges(changes, getAxioms(ont, ent), ont, duplicator); } } return changes; } }
/** * @param literalToLiteralMap map of literals to change * @return list of changes */ public List<OWLOntologyChange> changeLiterals(Map<OWLLiteral, OWLLiteral> literalToLiteralMap) { List<OWLOntologyChange> changes = new ArrayList<>(); OWLObjectDuplicator duplicator = new OWLObjectDuplicator( Collections.<OWLEntity, IRI>emptyMap(), literalToLiteralMap, owlOntologyManager); for (OWLOntology ont : ontologies) { assert ont != null; for (OWLLiteral ent : literalToLiteralMap.keySet()) { assert ent != null; fillListWithTransformChanges(changes, getAxioms(ont, ent), ont, duplicator); } } return changes; } }
public OWLClassExpression minimizeClone(OWLClassExpression ce){ OWLObjectDuplicator objectDuplicator = new OWLObjectDuplicator(df); OWLClassExpression clone = objectDuplicator.duplicateObject(ce); return clone.accept(this); }
/** * Changes the IRI of an entity for another IRI. * * @param entity The entity whose IRI is to be changed. * @param newIRI The new IRI * @return A list of ontology changes that should be applied to change the * specified entity IRI. */ public List<OWLOntologyChange> changeIRI(OWLEntity entity, IRI newIRI) { Map<OWLEntity, IRI> iriMap = new HashMap<OWLEntity, IRI>(); iriMap.put(entity, newIRI); List<OWLOntologyChange> changes = new ArrayList<OWLOntologyChange>(); for (OWLOntology ont : ontologies) { OWLObjectDuplicator duplicator = new OWLObjectDuplicator(iriMap, owlOntologyManager.getOWLDataFactory()); fillListWithTransformChanges(changes, getAxioms(ont, entity), ont, duplicator); } return changes; }
/** * Changes a IRI for another IRI. This creates the appropriate changes to be applied in order to * change a IRI. * * @param iri The IRI to be changed * @param newIRI The IRI that the IRI should be changed to. * @return A list of ontology changes that should be applied to change the specified IRI. */ public List<OWLOntologyChange> changeIRI(IRI iri, IRI newIRI) { checkNotNull(iri, "iri cannot be null"); checkNotNull(newIRI, "newIRI cannot be null"); Map<IRI, IRI> uriMap = new HashMap<>(); uriMap.put(iri, newIRI); List<OWLOntologyChange> changes = new ArrayList<>(); OWLObjectDuplicator dup = new OWLObjectDuplicator(m, uriMap); ontologies .forEach(o -> fillListWithTransformChanges(changes, o.referencingAxioms(iri), o, dup)); return changes; }
/** * Changes a IRI for another IRI. This creates the appropriate changes to be applied in order to * change a IRI. * * @param iri The IRI to be changed * @param newIRI The IRI that the IRI should be changed to. * @return A list of ontology changes that should be applied to change the specified IRI. */ public List<OWLOntologyChange> changeIRI(IRI iri, IRI newIRI) { checkNotNull(iri, "iri cannot be null"); checkNotNull(newIRI, "newIRI cannot be null"); Map<IRI, IRI> uriMap = new HashMap<>(); uriMap.put(iri, newIRI); List<OWLOntologyChange> changes = new ArrayList<>(); OWLObjectDuplicator dup = new OWLObjectDuplicator(m, uriMap); ontologies .forEach(o -> fillListWithTransformChanges(changes, o.referencingAxioms(iri), o, dup)); return changes; }
private void handleNewSplitAxioms(OWLClass newlyCreatedClass, OWLClass classThatWasSplit, EntityBasedDiff diff) { OWLOntology sourceOntology = diffMap.getSourceOntology(); Map<OWLEntity, IRI> newTargetToSplitSource = Collections.singletonMap((OWLEntity) newlyCreatedClass, classThatWasSplit.getIRI()); OWLObjectDuplicator duplicator = new OWLObjectDuplicator(newTargetToSplitSource, diffMap.getOWLDataFactory()); Set<OWLClassExpression> inferredParents = getInferredParents(sourceOntology, classThatWasSplit); for (MatchedAxiom match : new ArrayList<MatchedAxiom>(diff.getAxiomMatches())) { if (match.getDescription().equals(MatchedAxiom.AXIOM_ADDED) && cameFromSourceOntology((OWLAxiom) duplicator.duplicateObject(match.getTargetAxiom()), sourceOntology, classThatWasSplit, inferredParents)) { MatchedAxiom modifiedBySplit = new MatchedAxiom(null, match.getTargetAxiom(), COPIED_FROM_SPLIT); changes.removeMatch(match); changes.addMatch(modifiedBySplit); } } }
private void handleNewSplitAxioms(OWLClass newlyCreatedClass, OWLClass classThatWasSplit, EntityBasedDiff diff) { OWLOntology sourceOntology = diffMap.getSourceOntology(); Map<OWLEntity, IRI> newTargetToSplitSource = Collections.singletonMap((OWLEntity) newlyCreatedClass, classThatWasSplit.getIRI()); OWLObjectDuplicator duplicator = new OWLObjectDuplicator(newTargetToSplitSource, diffMap.getOWLDataFactory()); Set<OWLClassExpression> inferredParents = getInferredParents(sourceOntology, classThatWasSplit); for (MatchedAxiom match : new ArrayList<MatchedAxiom>(diff.getAxiomMatches())) { if (match.getDescription().equals(MatchedAxiom.AXIOM_ADDED) && cameFromSourceOntology((OWLAxiom) duplicator.duplicateObject(match.getTargetAxiom()), sourceOntology, classThatWasSplit, inferredParents)) { MatchedAxiom modifiedBySplit = new MatchedAxiom(null, match.getTargetAxiom(), COPIED_FROM_SPLIT); changes.removeMatch(match); changes.addMatch(modifiedBySplit); } } }
public void drop(DropTargetDropEvent dtde) { if (!isDropAcceptable(dtde)) { dtde.rejectDrop(); } else { dtde.acceptDrop(DnDConstants.ACTION_COPY_OR_MOVE); List<OWLObject> objs = getDropObjects(dtde.getTransferable()); List<OWLObject> dupObjs = new ArrayList<>(); OWLObject dupObj = null; for (OWLObject obj : objs) { OWLObjectDuplicator duplicator = new OWLObjectDuplicator(target.getOWLModelManager().getOWLDataFactory()); dupObj = duplicator.duplicateObject(obj); dupObjs.add(dupObj); } dtde.dropComplete(target.dropOWLObjects(dupObjs, dtde.getLocation(), dtde.getDropAction())); } component.setCursor(orginalCursor); }
public void drop(DropTargetDropEvent dtde) { if (isDropAcceptable(dtde) == false) { dtde.rejectDrop(); } else { dtde.acceptDrop(DnDConstants.ACTION_COPY_OR_MOVE); List<OWLObject> objs = getDropObjects(dtde.getTransferable()); List<OWLObject> dupObjs = new ArrayList<OWLObject>(); OWLObject dupObj = null; for (OWLObject obj : objs) { OWLObjectDuplicator duplicator = new OWLObjectDuplicator(target.getOWLModelManager().getOWLDataFactory()); dupObj = duplicator.duplicateObject(obj); dupObjs.add(dupObj); } dtde.dropComplete(target.dropOWLObjects(dupObjs, dtde.getLocation(), dtde.getDropAction())); } component.setCursor(orginalCursor); }
public void drop(DropTargetDropEvent dtde) { if (!isDropAcceptable(dtde)) { dtde.rejectDrop(); } else { dtde.acceptDrop(DnDConstants.ACTION_COPY_OR_MOVE); List<OWLObject> objs = getDropObjects(dtde.getTransferable()); List<OWLObject> dupObjs = new ArrayList<>(); OWLObject dupObj = null; for (OWLObject obj : objs) { OWLObjectDuplicator duplicator = new OWLObjectDuplicator(target.getOWLModelManager().getOWLDataFactory()); dupObj = duplicator.duplicateObject(obj); dupObjs.add(dupObj); } dtde.dropComplete(target.dropOWLObjects(dupObjs, dtde.getLocation(), dtde.getDropAction())); } component.setCursor(orginalCursor); }
public void drop(DropTargetDropEvent dtde) { if (isDropAcceptable(dtde) == false) { dtde.rejectDrop(); } else { dtde.acceptDrop(DnDConstants.ACTION_COPY_OR_MOVE); List<OWLObject> objs = getDropObjects(dtde.getTransferable()); List<OWLObject> dupObjs = new ArrayList<OWLObject>(); OWLObject dupObj = null; for (OWLObject obj : objs) { OWLObjectDuplicator duplicator = new OWLObjectDuplicator(target.getOWLModelManager().getOWLDataFactory()); dupObj = duplicator.duplicateObject(obj); dupObjs.add(dupObj); } dtde.dropComplete(target.dropOWLObjects(dupObjs, dtde.getLocation(), dtde.getDropAction())); } component.setCursor(orginalCursor); }