⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 relationtransitivity.java

📁 toocom源代码,主要应用在本体匹配方面!
💻 JAVA
字号:
package toocom.ocgl;

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

/**
 * This class represents the transitivity of a relation.
 *
 * @author Fr閐閞ic F黵st
 */
public class RelationTransitivity extends AxiomSchemaOne{
	
	public RelationTransitivity(RelationType r){
		super(CGConstants.getRelationTransitivityTerms(),r);
	}
		
	/** A primitive can be transitive if it is a relation, if its arity is 2, if the two 
	 *  concepts of its signature are defined and have the same type. */
	public boolean isValid(){
		return (super.cp instanceof RelationType) &&
				(((RelationType) super.cp).getArity() == 2) &&
				(((RelationType) super.cp).getSignature().getConceptType(1) != null) &&
				(((RelationType) super.cp).getSignature().getConceptType(2) != null) &&
				((RelationType) super.cp).getSignature().getConceptType(1).equals(((RelationType) super.cp).getSignature().getConceptType(2));
	}
	
	public Axiom getAxiomForm(){
		Axiom axiom = new Axiom(CGConstants.getRelationReflexivityTerms());
		axiom.getTerms().appendWithSeparator(((RelationType) super.cp).getTerms()," - ");
		Relation r1 = new Relation((RelationType) super.cp);
		Relation r2 = new Relation((RelationType) super.cp);
		Relation r3 = new Relation((RelationType) super.cp);
		ConceptType ct = ((RelationType) super.cp).getSignature().getConceptType(1);
		Concept c1 = new Concept(ct);
		Concept c2 = new Concept(ct);
		Concept c3 = new Concept(ct);
		r1.setLinkedConcept(c1,1);
		r1.setLinkedConcept(c2,2);
		r2.setLinkedConcept(c2,1);
		r2.setLinkedConcept(c3,2);
		r3.setLinkedConcept(c1,1);
		r3.setLinkedConcept(c3,2);
		axiom.addHypothesisConcept(c1);
		axiom.addHypothesisConcept(c2);
		axiom.addHypothesisConcept(c3);
		axiom.addHypothesisRelation(r1);
		axiom.addHypothesisRelation(r2);
		axiom.addConclusionRelation(r3);
		return axiom;
	}
	
	public LinkedList getOperationalForm(Ontology onto,Language l){
		return new LinkedList();
	}
	
	public void paint(Graphics g,Language l){
		g.setColor(CGConstants.TRANSITIVITY_COLOR);
		g.drawString("T",super.cp.x - (CGConstants.PROPERTY_SYMBOLS_SPACING * 8),super.cp.y - (CGConstants.PROPERTY_SYMBOLS_SPACING * 4));	
	}
	
}

⌨️ 快捷键说明

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