conceptdisjunction.java

来自「toocom源代码,主要应用在本体匹配方面!」· Java 代码 · 共 51 行

JAVA
51 行
字号
package toocom.ocgl;

import java.util.*;
import java.awt.Graphics;

/**
 * This class represents the disjunction between two concepts, that is no individual
 * can be instance of the two concepts. 
 *
 * @author Fr閐閞ic F黵st
 */
public class ConceptDisjunction extends AxiomSchemaTwo{
	
	public ConceptDisjunction(ConceptType c1,ConceptType c2){
		super(CGConstants.getConceptDisjunctionTerms(),c1,c2);
	}
	
	public void paint(Graphics g,Language l){
		GraphicsToolkit.drawLinkedCrossCircle(g,super.cp1.x,super.cp1.y,super.cp2.x,super.cp2.y,CGConstants.DISJUNCTION_COLOR,super.cp1.getBounds(g,l),super.cp2.getBounds(g,l));
	}
	
	/** Two primitives can be in disjunction if they are concepts, and if they are
	 *  not in isA relation. */	
	public boolean isValid(){
		return ((cp1 instanceof ConceptType) &&
			    (cp2 instanceof ConceptType) &&
			    !cp1.isA(cp2) && !cp2.isA(cp1));
	}
	
	public Axiom getAxiomForm(){
		return null;
	}
	
	public LinkedList getOperationalForm(Ontology onto,Language l){
		return new LinkedList();
	}
	
	/** Returns from the given list of concept types the list of those that can
	 *  be linked to the given concept type by a disjunction. */
	public static LinkedList getLinkablePrimitives(Collection conceptTypes, ConceptType ct){
		LinkedList result = new LinkedList();
		for(Iterator i = conceptTypes.iterator();i.hasNext();){
			ConceptType ctTemp = (ConceptType) i.next();
			ConceptDisjunction cd = new ConceptDisjunction(ct,ctTemp);
			if(cd.isValid()) result.add(ctTemp);
			cd.destroy();
		}
		return result;
	}
	
}

⌨️ 快捷键说明

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