📄 negativeconstraint.java
字号:
package toocom.ocgl;
import java.util.*;
import java.io.IOException;
/**
* This class represents the CG negative constraints.
*
* @author Fr閐閞ic F黵st
*/
public class NegativeConstraint extends Constraint{
public NegativeConstraint(Terms t){
super(t);
}
/** Constructs a negative constraint with the terms of the given implication and with
* concepts and relations that appear in the given implication. */
public NegativeConstraint(ConceptualImplication ci){
super(ci.getTerms());
this.hypothesisConcepts = ci.getHypothesisConcepts();
this.conclusionConcepts = ci.getPureConclusionConcepts();
this.hypothesisRelations = ci.getHypothesisRelations();
this.conclusionRelations = ci.getConclusionRelations();
}
private Graph getGraphForm(){
Graph result = new Graph(this.getTerms());
Hashtable conceptLink = new Hashtable();
for(Iterator i = this.getAllConcepts().iterator();i.hasNext();){
Concept c = (Concept) i.next();
Concept cBis = c.cloneConcept();
result.addConcept(cBis);
conceptLink.put(c,cBis);
}
for(Iterator i = this.getAllRelations().iterator();i.hasNext();){
Relation r = (Relation) i.next();
Relation rBis = r.cloneRelation();
for(int index = 1;index <= rBis.getType().getArity();index ++){
Concept cTemp = r.getLinkedConcept(index);
if(cTemp != null){
rBis.setLinkedConcept((Concept) conceptLink.get(cTemp),index);
}
}
result.addRelation(rBis);
}
return result;
}
/** 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{
return client.getGraphProjections(onto,this.getGraphForm(),g,l);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -