owlobjectcontainer.java

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

JAVA
457
字号
		restriction.getDescription().accept( this );		
	}

	public void visit( OWLObjectValueRestriction restriction ) throws OWLException {
		restriction.getObjectProperty().accept( this );
		restriction.getIndividual().accept( this );		
	}

	public void visit( OWLDataSomeRestriction restriction ) throws OWLException {
		restriction.getDataProperty().accept( this );
		restriction.getDataType().accept( this );		
	}

	public void visit( OWLDataAllRestriction restriction ) throws OWLException {
		restriction.getDataProperty().accept( this );
		restriction.getDataType().accept( this );
	}

	public void visit( OWLObjectCardinalityRestriction restriction ) throws OWLException {
		restriction.getObjectProperty().accept( this );	
	}

	public void visit( OWLDataCardinalityRestriction restriction ) throws OWLException {
		restriction.getDataProperty().accept( this );		
	}

	public void visit( OWLDataValueRestriction restriction ) throws OWLException {
		restriction.getDataProperty().accept( this );
		restriction.getValue().accept( this );		
	}

	public void visit( OWLEquivalentClassesAxiom axiom ) throws OWLException {

		Set equClas = axiom.getEquivalentClasses();
		for ( Iterator it = equClas.iterator();
		it.hasNext(); ) {
			OWLDescription desc = (OWLDescription) it.next();
			desc.accept( this );
			if ((desc instanceof OWLClass) && (((OWLClass) desc).getURI().equals(base.getURI())))
				LHS.addAll(objects);
			else 
				if (desc instanceof OWLClass && LHS.size()==0) LHS.addAll(objects);
			else 
				RHS.addAll(objects);
			objects.clear();
		}		
	}

	public void visit( OWLDisjointClassesAxiom axiom ) throws OWLException {
		for ( Iterator it = axiom.getDisjointClasses().iterator();
		it.hasNext(); ) {
			OWLDescription desc = (OWLDescription) it.next();
			desc.accept( this );
			if ((desc instanceof OWLClass) && (((OWLClass) desc).getURI().equals(base.getURI())))
				LHS.addAll(objects);
			else 
				if (desc instanceof OWLClass && LHS.size()==0) LHS.addAll(objects);
			else 
				RHS.addAll(objects);
			objects.clear();
		}
	}

	public void visit( OWLSubClassAxiom axiom ) throws OWLException {
		axiom.getSubClass().accept( this );
		LHS.addAll(objects);
		objects.clear();
		axiom.getSuperClass().accept( this );
		RHS.addAll(objects);
	}

	public void visit( OWLEquivalentPropertiesAxiom axiom ) throws OWLException {
		for ( Iterator it = axiom.getProperties().iterator();
		it.hasNext(); ) {
			OWLProperty prop = (OWLProperty) it.next();
			prop.accept( this );
		}
	}

	public void visit( OWLSubPropertyAxiom axiom ) throws OWLException {
		axiom.getSubProperty().accept( this );
		LHS.addAll(objects);
		objects.clear();
		axiom.getSuperProperty().accept( this );
		RHS.addAll(objects);
	}

	public void visit( OWLDifferentIndividualsAxiom ax) throws OWLException {
		for ( Iterator it = ax.getIndividuals().iterator();
		it.hasNext(); ) {
			OWLIndividual desc = (OWLIndividual) it.next();
			desc.accept( this );		
		}
	}

	public void visit( OWLSameIndividualsAxiom ax) throws OWLException {
		for ( Iterator it = ax.getIndividuals().iterator();
		it.hasNext(); ) {
			OWLIndividual desc = (OWLIndividual) it.next();
			desc.accept( this );		
		}
	}

	public void visit( OWLDataType ocdt ) throws OWLException {		
	}

	public void visit( OWLDataEnumeration enumeration ) throws OWLException {
		for ( Iterator it = enumeration.getValues().iterator();
		it.hasNext(); ) {
			OWLDataValue desc = (OWLDataValue) it.next();
			desc.accept( this );		
		}
	}
	

//	Uncomment for explanation
	
	public void visit( OWLFunctionalPropertyAxiom axiom ) throws OWLException {
		axiom.getProperty().accept( this );
		LHS.addAll(objects);
	}
	
	public void visit( OWLPropertyDomainAxiom axiom ) throws OWLException {
		axiom.getProperty().accept( this );
		LHS.addAll(objects);
		objects.clear();
		axiom.getDomain().accept( this );
		RHS.addAll(objects);
	}
	
	public void visit( OWLObjectPropertyRangeAxiom axiom ) throws OWLException {
		axiom.getProperty().accept( this );
		LHS.addAll(objects);
		objects.clear();
		axiom.getRange().accept( this );
		RHS.addAll(objects);
	}
	
	public void visit( OWLDataPropertyRangeAxiom axiom ) throws OWLException {
		axiom.getProperty().accept( this );
		LHS.addAll(objects);
		objects.clear();
		axiom.getRange().accept( this );
		RHS.addAll(objects);		
	}
	
 /* (non-Javadoc)
  * @see org.mindswap.pellet.owlapi.OWLExtendedObjectVisitor#visit(org.mindswap.pellet.owlapi.OWLInverseFunctionalPropertyAxiom)
  */
 public void visit(OWLInverseFunctionalPropertyAxiom axiom) throws OWLException {
		axiom.getProperty().accept( this );
		LHS.addAll(objects);
 }

 /* (non-Javadoc)
  * @see org.mindswap.pellet.owlapi.OWLExtendedObjectVisitor#visit(org.mindswap.pellet.owlapi.OWLTransitivePropertyAxiom)
  */
 public void visit(OWLTransitivePropertyAxiom axiom) throws OWLException {
 	axiom.getProperty().accept( this );
 	LHS.addAll(objects);
 }

 /* (non-Javadoc)
  * @see org.mindswap.pellet.owlapi.OWLExtendedObjectVisitor#visit(org.mindswap.pellet.owlapi.OWLSymmetricPropertyAxiom)
  */
 public void visit(OWLSymmetricPropertyAxiom axiom) throws OWLException {
		axiom.getProperty().accept( this );
		LHS.addAll(objects);
 }
 
 /* (non-Javadoc)
  * @see org.mindswap.pellet.owlapi.OWLExtendedObjectVisitor#visit(org.mindswap.pellet.owlapi.OWLInversePropertyAxiom)
  */
 public void visit(OWLInversePropertyAxiomImpl axiom) throws OWLException {
		axiom.getProperty().accept( this );
		LHS.addAll(objects);
		objects.clear();
		axiom.getInverseProperty().accept( this );
		RHS.addAll(objects);
 }

 /* (non-Javadoc)
  * @see org.mindswap.pellet.owlapi.OWLExtendedObjectVisitor#visit(org.mindswap.pellet.owlapi.OWLObjectPropertyInstance)
  */
 public void visit(OWLObjectPropertyInstance axiom) throws OWLException {
		axiom.getSubject().accept( this );
		axiom.getProperty().accept( this );
		axiom.getObject().accept( this );		
 }

 /* (non-Javadoc)
  * @see org.mindswap.pellet.owlapi.OWLExtendedObjectVisitor#visit(org.mindswap.pellet.owlapi.OWLDataPropertyInstance)
  */
 public void visit(OWLDataPropertyInstance axiom) throws OWLException {
		axiom.getSubject().accept( this );
		axiom.getProperty().accept( this );
		axiom.getObject().accept( this );		
 }

 /* (non-Javadoc)
  * @see org.mindswap.pellet.owlapi.OWLExtendedObjectVisitor#visit(org.mindswap.pellet.owlapi.OWLIndividualClassAxiom)
  */
 public void visit(OWLIndividualTypeAssertion axiom) throws OWLException {
		axiom.getIndividual().accept( this );
		axiom.getType().accept( this );		
 }
 
 public List getContainedObjects() {
 	return this.objects;
 }

 public List getRHS() {
 	return this.RHS;
 }
 
 public List getLHS() {
 	return this.LHS;
 }

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

⌨️ 快捷键说明

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