conciseformatentityrenderer.java
来自「Semantic Web Ontology Editor」· Java 代码 · 共 1,805 行 · 第 1/5 页
JAVA
1,805 行
&& rem.getProperty().equals((OWLProperty) subj) && rem.getSuperProperty().equals((OWLProperty) obj)) { deleted = oc; } else if (code.equals("P-SUP") && rem.getProperty().equals((OWLProperty) obj) && rem.getSuperProperty().equals((OWLProperty) subj)) { deleted = oc; } } else if(oc instanceof RemoveClassAxiom) { RemoveClassAxiom rem = (RemoveClassAxiom) oc; if (rem.getAxiom() instanceof OWLDisjointClassesAxiom) { OWLDisjointClassesAxiom change = (OWLDisjointClassesAxiom) rem.getAxiom(); if ((code.equals("C-DIS")) && (change.getDisjointClasses().contains(subj)) && (change.getDisjointClasses().contains(obj))) { return oc; } } else if (rem.getAxiom() instanceof OWLSubClassAxiom) { OWLSubClassAxiom axiom = (OWLSubClassAxiom) rem.getAxiom(); if(code.equals("C-SUB") && axiom.getSubClass().equals(subj) && axiom.getSuperClass().equals(obj)) return oc; else if(code.equals("C-SUP") && axiom.getSubClass().equals(obj) && axiom.getSuperClass().equals(subj)) return oc; } } else if(oc instanceof RemoveSuperClass) { RemoveSuperClass change = (RemoveSuperClass) oc; if(code.equals("C-SUB") && change.getOWLClass().equals(subj) && change.getDescription().equals(obj)) return oc; else if(code.equals("C-SUP") && change.getOWLClass().equals(obj) && change.getDescription().equals(subj)) return oc; } else if(oc instanceof RemoveEquivalentClass) { RemoveEquivalentClass change = (RemoveEquivalentClass) oc; if(code.equals("C-EQU") && change.getOWLClass().equals(subj) && change.getDescription().equals(obj)) return oc; } else if(oc instanceof BooleanElementChange) { BooleanElementChange change = (BooleanElementChange) oc; if(code.equals("C-INT") && change.getChangeType().equals("Remove") && change.getOWLClass().equals(subj) && change.getType().equals(OWLAnd.class) && change.getOWLDescription().hashCode()==obj.hashCode()) deleted = oc; else if(code.equals("C-UNI") && change.getChangeType().equals("Remove") && change.getOWLClass().equals(subj) && change.getType().equals(OWLOr.class) && change.getOWLDescription().hashCode()==obj.hashCode()) deleted = oc; else if(code.equals("C-NOT") && change.getChangeType().equals("Remove") && change.getOWLClass().equals(subj) && change.getType().equals(OWLNot.class) && change.getOWLDescription().hashCode()==obj.hashCode()) deleted = oc; } else if(oc instanceof AddEquivalentClass) { AddEquivalentClass change = (AddEquivalentClass) oc; if(code.equals("C-INT") && change.getOWLClass().equals(subj) && change.getDescription() instanceof OWLAnd && ((OWLAnd)change.getDescription()).getOperands().contains(obj)) deleted = null; else if(code.equals("C-UNI") && change.getOWLClass().equals(subj) && change.getDescription() instanceof OWLOr && ((OWLOr)change.getDescription()).getOperands().contains(obj)) deleted = null; } else if (oc instanceof EnumElementChange) { EnumElementChange change = (EnumElementChange) oc; if (code.equals("I-ONE") && change.getChangeType().equals("Remove") && change.getOWLClass().equals(subj) && change.getOWLIndividual().hashCode()==obj.hashCode()) deleted = oc; } else if (oc instanceof RemoveIndividualClass) { RemoveIndividualClass change = (RemoveIndividualClass) oc; if (code.equals("I-INS") && change.getDescription().equals(subj) && change.getIndividual().equals(obj)) deleted = oc; else if (code.equals("C-TYP") && change.getDescription().equals(obj) && change.getIndividual().equals(subj)) deleted = oc; } else if (oc instanceof AddEnumeration) { AddEnumeration change = (AddEnumeration) oc; if (code.equals("I-ONE") && change.getOWLClass().equals(subj) && change.getEnumeration().getIndividuals().contains(obj)) deleted = null; } else if(oc instanceof RemoveIndividualAxiom) { RemoveIndividualAxiom rem = (RemoveIndividualAxiom) oc; if (rem.getAxiom() instanceof OWLSameIndividualsAxiom) { OWLSameIndividualsAxiom sameAxiom = (OWLSameIndividualsAxiom) rem.getAxiom(); if (code.equals("I-SAM") && sameAxiom.getIndividuals().contains((OWLIndividual) obj) && sameAxiom.getIndividuals().contains((OWLIndividual) subj)) { deleted = oc; } } if (rem.getAxiom() instanceof OWLDifferentIndividualsAxiom) { OWLDifferentIndividualsAxiom diffAxiom = (OWLDifferentIndividualsAxiom) rem.getAxiom(); if (code.equals("I-DIF") && diffAxiom.getIndividuals().contains((OWLIndividual) obj) && diffAxiom.getIndividuals().contains((OWLIndividual) subj)) { deleted = oc; } } } } return deleted; } /** * Same as getAdded(subj, code) except this one only checks * AddAnnotationInstance changes * @param subj * @return * @throws OWLException */ private Set getAddedAnnotations(OWLObject subj) throws OWLException { Set added = new HashSet(); Iterator i = changes.iterator(); while(i.hasNext()) { OntologyChange oc = (OntologyChange) i.next(); if (oc instanceof AddAnnotationInstance) { AddAnnotationInstance change = (AddAnnotationInstance) oc; if (change.getSubject().equals(subj)) added.add(oc); } } return added; } /** * Given a subject (OWL entity) and a code for the axiom type, * match any current uncommitted ontology change involving subject and of type code * and return a map between object of the change and the change itself * Stuff returned is rendered in 'green' in the HTML renderer * @param subj - subject of the axiom change * @param code - type of axiom change * @return * @throws OWLException */ private Map getAdded(OWLObject subj, String code) throws OWLException { Map added = new Hashtable(); Iterator i = changes.iterator(); while(i.hasNext()) { OntologyChange oc = (OntologyChange) i.next(); if (oc instanceof SetFunctional) { SetFunctional change = (SetFunctional) oc; if (code.equals("ATTRIB")) { if (change.isFunctional() && change.getProperty().equals(subj)) { // only for property attributes, add a set of ontology changes as the value in the hashmap Set ocSet = new HashSet(); if (added.containsKey(subj)) ocSet = (HashSet) added.get(subj); ocSet.add(oc); added.put(subj, ocSet); } } } else if (oc instanceof SetInverseFunctional) { SetInverseFunctional change = (SetInverseFunctional) oc; if (code.equals("ATTRIB")) { if (change.isInverseFunctional() && change.getProperty().equals(subj)) {// only for property attributes, add a set of ontology changes as the value in the hashmap Set ocSet = new HashSet(); if (added.containsKey(subj)) ocSet = (HashSet) added.get(subj); ocSet.add(oc); added.put(subj, ocSet); } } } else if (oc instanceof SetTransitive) { SetTransitive change = (SetTransitive) oc; if (code.equals("ATTRIB")) { if (change.isTransitive() && change.getProperty().equals(subj)) {// only for property attributes, add a set of ontology changes as the value in the hashmap Set ocSet = new HashSet(); if (added.containsKey(subj)) ocSet = (HashSet) added.get(subj); ocSet.add(oc); added.put(subj, ocSet); } } } else if (oc instanceof SetSymmetric) { SetSymmetric change = (SetSymmetric) oc; if (code.equals("ATTRIB")) { if (change.isSymmetric() && change.getProperty().equals(subj)) {// only for property attributes, add a set of ontology changes as the value in the hashmap Set ocSet = new HashSet(); if (added.containsKey(subj)) ocSet = (HashSet) added.get(subj); ocSet.add(oc); added.put(subj, ocSet); } } } else if(oc instanceof AddSuperClass) { AddSuperClass change = (AddSuperClass) oc; if(code.equals("C-SUB") && change.getOWLClass().equals(subj)) added.put(change.getDescription(), oc); else if(code.equals("C-SUP") && change.getDescription().equals(subj)) added.put(change.getOWLClass(), oc); } else if(oc instanceof RemoveSuperClass) { RemoveSuperClass change = (RemoveSuperClass) oc; if(code.equals("C-SUB") && change.getOWLClass().equals(subj)) added.remove(change.getDescription()); else if(code.equals("C-SUP") && change.getDescription().equals(subj)) added.remove(change.getOWLClass()); } else if(oc instanceof AddEquivalentClass) { AddEquivalentClass change = (AddEquivalentClass) oc; if(code.equals("C-EQU") && change.getOWLClass().equals(subj)) added.put(change.getDescription(), oc); } else if(oc instanceof BooleanElementChange) { BooleanElementChange change = (BooleanElementChange) oc; if(code.equals("C-INT") && change.getChangeType().equals("Add") && change.getType().equals(OWLAnd.class) && change.getOWLClass().equals(subj)) { added.put(change.getOWLDescription(), oc); } else if(code.equals("C-UNI") && change.getChangeType().equals("Add") && change.getType().equals(OWLOr.class) && change.getOWLClass().equals(subj)) { added.put(change.getOWLDescription(), oc); } else if(code.equals("C-NOT") && change.getChangeType().equals("Add") && change.getType().equals(OWLNot.class) && change.getOWLClass().equals(subj)) { added.put(change.getOWLDescription(), oc); } } else if(oc instanceof RemoveEquivalentClass) { RemoveEquivalentClass change = (RemoveEquivalentClass) oc; if(code.equals("C-EQU") && change.getOWLClass().equals(subj) && !(change.getDescription() instanceof OWLAnd) && !(change.getDescription() instanceof OWLOr) && !(change.getDescription() instanceof OWLEnumeration)) added.remove(change.getDescription()); else if(code.equals("C-INT") && change.getOWLClass().equals(subj) && change.getDescription() instanceof OWLAnd) added.keySet().removeAll(((OWLAnd)change.getDescription()).getOperands()); else if(code.equals("C-UNI") && change.getOWLClass().equals(subj) && change.getDescription() instanceof OWLOr) added.keySet().removeAll(((OWLOr)change.getDescription()).getOperands()); } else if (oc instanceof AddClassAxiom) { if (code.equals("C-DIS")) { AddClassAxiom change = (AddClassAxiom) oc; if (change.getAxiom() instanceof OWLDisjointClassesAxiom) { OWLDisjointClassesAxiom disAxiom = (OWLDisjointClassesAxiom) change.getAxiom(); if (disAxiom.getDisjointClasses().contains(subj)) { Iterator j = disAxiom.getDisjointClasses().iterator(); while(j.hasNext()) added.put(j.next(), oc); added.remove(subj); } } } else if (code.equals("C-SUP")) { AddClassAxiom change = (AddClassAxiom) oc; if (change.getAxiom() instanceof OWLSubClassAxiom) { OWLSubClassAxiom subAxiom = (OWLSubClassAxiom) change.getAxiom(); if (subAxiom.getSuperClass().equals(subj)) { added.put(subAxiom.getSubClass(), oc); } } } } else if(oc instanceof AddDomain) { AddDomain change = (AddDomain) oc; if(code.equals("P-DOM") && change.getDomain().equals(subj) ) { added.put(change.getProperty(), oc); } if(code.equals("C-HASDOM") && change.getProperty().equals(subj) ) { added.put(change.getDomain(), oc); } } else if (oc instanceof AddObjectPropertyRange) { AddObjectPropertyRange change = (AddObjectPropertyRange) oc; if(code.equals("P-RAN") && change.getRange().equals(subj) ) { added.put(change.getProperty(), oc); } if(code.equals("C-HASRAN") && change.getProperty().equals(subj) ) { added.put(change.getRange(), oc); } }
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?