owlontsplitter.java

来自「Semantic Web Ontology Editor」· Java 代码 · 共 478 行 · 第 1/2 页

JAVA
478
字号
	/* (non-Javadoc)
	 * @see org.semanticweb.owl.model.OWLObjectVisitor#visit(org.semanticweb.owl.model.OWLObjectCardinalityRestriction)
	 */
	public void visit(OWLObjectCardinalityRestriction node) throws OWLException {
		// TODO Auto-generated method stub
		
	}

	/* (non-Javadoc)
	 * @see org.semanticweb.owl.model.OWLObjectVisitor#visit(org.semanticweb.owl.model.OWLObjectProperty)
	 */
	public void visit(OWLObjectProperty node) throws OWLException {
		// TODO Auto-generated method stub
		
	}

	/* (non-Javadoc)
	 * @see org.semanticweb.owl.model.OWLObjectVisitor#visit(org.semanticweb.owl.model.OWLObjectSomeRestriction)
	 */
	public void visit(OWLObjectSomeRestriction node) throws OWLException {
		// TODO Auto-generated method stub
		
	}

	/* (non-Javadoc)
	 * @see org.semanticweb.owl.model.OWLObjectVisitor#visit(org.semanticweb.owl.model.OWLObjectValueRestriction)
	 */
	public void visit(OWLObjectValueRestriction node) throws OWLException {
		// TODO Auto-generated method stub
		
	}

	/* (non-Javadoc)
	 * @see org.semanticweb.owl.model.OWLObjectVisitor#visit(org.semanticweb.owl.model.OWLNot)
	 */
	public void visit(OWLNot node) throws OWLException {
		// TODO Auto-generated method stub
		
	}

	/* (non-Javadoc)
	 * @see org.semanticweb.owl.model.OWLObjectVisitor#visit(org.semanticweb.owl.model.OWLOntology)
	 */
	public void visit(OWLOntology node) throws OWLException {
		// TODO Auto-generated method stub
		
	}

	/* (non-Javadoc)
	 * @see org.semanticweb.owl.model.OWLObjectVisitor#visit(org.semanticweb.owl.model.OWLOr)
	 */
	public void visit(OWLOr node) throws OWLException {
		// TODO Auto-generated method stub
		
	}

	/* (non-Javadoc)
	 * @see org.semanticweb.owl.model.OWLObjectVisitor#visit(org.semanticweb.owl.model.OWLClass)
	 */
	public void visit(OWLClass cla) throws OWLException {
		
		Set remove = new HashSet();
		// rewrite A \sub B \and C -> A \sub B, A \sub C
		for (Iterator iter = cla.getSuperClasses(ontology).iterator(); iter.hasNext();) {
			OWLDescription sup = (OWLDescription) iter.next();
			if (sup instanceof OWLAnd) {
				OWLAnd and = (OWLAnd) sup;
				for (Iterator iter2 = and.getOperands().iterator(); iter2.hasNext();) {
					OWLDescription op = (OWLDescription) iter2.next();
					AddSuperClass as = new AddSuperClass(ontology, cla, op, null);
					as.accept((ChangeVisitor) ontology);
				}
				remove.add(sup);
			}
		}
		for (Iterator iter = remove.iterator(); iter.hasNext();) {
			RemoveSuperClass rs = new RemoveSuperClass(ontology, cla, (OWLDescription) iter.next(), null);
			rs.accept((ChangeVisitor) ontology);
		}
		
		// rewrite A \equ B \and C -> A \sub B, A \sub C, B \and C \sub A
		remove.clear();
		for (Iterator iter = cla.getEquivalentClasses(ontology).iterator(); iter.hasNext();) {
			OWLDescription equ = (OWLDescription) iter.next();
			if (equ instanceof OWLAnd) {
				OWLAnd and = (OWLAnd) equ;
				for (Iterator iter2 = and.getOperands().iterator(); iter2.hasNext();) {
					OWLDescription op = (OWLDescription) iter2.next();
					AddSuperClass as = new AddSuperClass(ontology, cla, op, null);
					as.accept((ChangeVisitor) ontology);
				}
				remove.add(equ);
			}
		}
		for (Iterator iter = remove.iterator(); iter.hasNext();) {
			OWLDescription equ = (OWLDescription) iter.next();
			RemoveEquivalentClass re = new RemoveEquivalentClass(ontology, cla, equ, null);
			re.accept((ChangeVisitor) ontology);
			OWLSubClassAxiom newAxiom = ontology.getOWLDataFactory().getOWLSubClassAxiom(equ, cla);
			AddClassAxiom ac = new AddClassAxiom(ontology, newAxiom, null);
			ac.accept((ChangeVisitor) ontology);
		}
	}

	/* (non-Javadoc)
	 * @see org.semanticweb.owl.model.OWLObjectVisitor#visit(org.semanticweb.owl.model.OWLEnumeration)
	 */
	public void visit(OWLEnumeration node) throws OWLException {
		// TODO Auto-generated method stub
		
	}

	/* (non-Javadoc)
	 * @see org.semanticweb.owl.model.OWLObjectVisitor#visit(org.semanticweb.owl.model.OWLSameIndividualsAxiom)
	 */
	public void visit(OWLSameIndividualsAxiom node) throws OWLException {
		// TODO Auto-generated method stub
		
	}

	/* (non-Javadoc)
	 * @see org.semanticweb.owl.model.OWLObjectVisitor#visit(org.semanticweb.owl.model.OWLSubClassAxiom)
	 */
	public void visit(OWLSubClassAxiom axiom) throws OWLException {
		// TODO Auto-generated method stub
		OWLDescription sub = axiom.getSubClass();
		OWLDescription sup = axiom.getSuperClass();
		if (sup instanceof OWLAnd) {
			OWLAnd and = (OWLAnd) sup;
			for (Iterator iter = and.getOperands().iterator(); iter.hasNext();) {
				OWLDescription op = (OWLDescription) iter.next();
				OWLSubClassAxiom newAxiom = ontology.getOWLDataFactory().getOWLSubClassAxiom(sub, op);
				AddClassAxiom ac = new AddClassAxiom(ontology, newAxiom, null);
				ac.accept((ChangeVisitor) ontology);
			}
			RemoveClassAxiom rc = new RemoveClassAxiom(ontology, axiom, null);
			rc.accept((ChangeVisitor) ontology);
		}
		
	}

	/* (non-Javadoc)
	 * @see org.semanticweb.owl.model.OWLObjectVisitor#visit(org.semanticweb.owl.model.OWLSubPropertyAxiom)
	 */
	public void visit(OWLSubPropertyAxiom node) throws OWLException {
		// TODO Auto-generated method stub
		
	}

	/* (non-Javadoc)
	 * @see org.semanticweb.owl.model.OWLObjectVisitor#visit(org.semanticweb.owl.model.OWLFunctionalPropertyAxiom)
	 */
	public void visit(OWLFunctionalPropertyAxiom node) throws OWLException {
		// TODO Auto-generated method stub
		
	}

	/* (non-Javadoc)
	 * @see org.semanticweb.owl.model.OWLObjectVisitor#visit(org.semanticweb.owl.model.OWLInverseFunctionalPropertyAxiom)
	 */
	public void visit(OWLInverseFunctionalPropertyAxiom node) throws OWLException {
		// TODO Auto-generated method stub
		
	}

	/* (non-Javadoc)
	 * @see org.semanticweb.owl.model.OWLObjectVisitor#visit(org.semanticweb.owl.model.OWLTransitivePropertyAxiom)
	 */
	public void visit(OWLTransitivePropertyAxiom node) throws OWLException {
		// TODO Auto-generated method stub
		
	}

	/* (non-Javadoc)
	 * @see org.semanticweb.owl.model.OWLObjectVisitor#visit(org.semanticweb.owl.model.OWLSymmetricPropertyAxiom)
	 */
	public void visit(OWLSymmetricPropertyAxiom node) throws OWLException {
		// TODO Auto-generated method stub
		
	}

	/* (non-Javadoc)
	 * @see org.semanticweb.owl.model.OWLObjectVisitor#visit(org.semanticweb.owl.model.OWLInversePropertyAxiom)
	 */
	public void visit(OWLInversePropertyAxiom node) throws OWLException {
		// TODO Auto-generated method stub
		
	}

	/* (non-Javadoc)
	 * @see org.semanticweb.owl.model.OWLObjectVisitor#visit(org.semanticweb.owl.model.OWLPropertyDomainAxiom)
	 */
	public void visit(OWLPropertyDomainAxiom node) throws OWLException {
		// TODO Auto-generated method stub
		
	}

	/* (non-Javadoc)
	 * @see org.semanticweb.owl.model.OWLObjectVisitor#visit(org.semanticweb.owl.model.OWLObjectPropertyRangeAxiom)
	 */
	public void visit(OWLObjectPropertyRangeAxiom node) throws OWLException {
		// TODO Auto-generated method stub
		
	}

	/* (non-Javadoc)
	 * @see org.semanticweb.owl.model.OWLObjectVisitor#visit(org.semanticweb.owl.model.OWLDataPropertyRangeAxiom)
	 */
	public void visit(OWLDataPropertyRangeAxiom node) throws OWLException {
		// TODO Auto-generated method stub
		
	}

	/* (non-Javadoc)
	 * @see org.semanticweb.owl.model.OWLObjectVisitor#visit(org.semanticweb.owl.model.OWLObjectPropertyInstance)
	 */
	public void visit(OWLObjectPropertyInstance node) throws OWLException {
		// TODO Auto-generated method stub
		
	}

	/* (non-Javadoc)
	 * @see org.semanticweb.owl.model.OWLObjectVisitor#visit(org.semanticweb.owl.model.OWLDataPropertyInstance)
	 */
	public void visit(OWLDataPropertyInstance node) throws OWLException {
		// TODO Auto-generated method stub
		
	}

	/* (non-Javadoc)
	 * @see org.semanticweb.owl.model.OWLObjectVisitor#visit(org.semanticweb.owl.model.OWLIndividualTypeAssertion)
	 */
	public void visit(OWLIndividualTypeAssertion node) throws OWLException {
		// TODO Auto-generated method stub
		
	}

}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?