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

📄 positiveconstraint.java

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

import java.util.*;
import java.io.IOException;

/**
 * This class represents the CG positive constraints. 
 * 
 * @author Fr閐閞ic F黵st
 */
 public class PositiveConstraint extends Constraint{
 	
 	public PositiveConstraint(Terms t){
 		super(t);
 	}
 	
 	/** Constructs a positive constraint with the terms of the given implication and with
 	 *  concepts and relations that appear in the given implication. */
 	public PositiveConstraint(ConceptualImplication ci){
 		super(ci.getTerms());
 		this.hypothesisConcepts = ci.getHypothesisConcepts();
		this.conclusionConcepts = ci.getPureConclusionConcepts();
		this.hypothesisRelations = ci.getHypothesisRelations();
		this.conclusionRelations = ci.getConclusionRelations();
 	}

 	/** Returns the list of projections in the graph that break the constraint. */
 	public LinkedList getConstraintProjections(Graph g,CogitantClient client,Ontology onto,Language l) throws IOException{
 		LinkedList result = new LinkedList();
 		LinkedList hypProjs = client.getGraphProjections(onto,this.getHypothesisPart(),g,l);
 		LinkedList conProjs = client.getGraphProjections(onto,this.getConclusionPart(),g,l);
 		for(Iterator i = hypProjs.iterator();i.hasNext();){
 			Projection p = (Projection) i.next();
 			boolean control = false;
 			for(Iterator j = conProjs.iterator();j.hasNext() && !control;){
 				Projection q = (Projection) j.next();
 				boolean sameContacts = true;
 				for(Iterator k = this.getHypothesisConclusionConcepts().iterator();k.hasNext() && sameContacts;){
 					Concept c = (Concept) k.next();
 					if(p.getCorrespondance(c.getId()) != q.getCorrespondance(c.getId())) sameContacts = false; 
 				}
 				if(sameContacts) control = true;
 			}
 			if(!control) result.add(p);
 		}
 		return result; 		
 	} 	
 	
 }
	

⌨️ 快捷键说明

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