Mentions légales du service

Skip to content
Snippets Groups Projects
Commit c19a3db7 authored by Federico Ulliana's avatar Federico Ulliana
Browse files

added encoders

parent e62e4f31
No related branches found
No related tags found
1 merge request!68Resolve "add explanation module"
package fr.boreal.explanation.tracker_gri.encoders;
import fr.boreal.explanation.api.encoders.GSATEncodingResult_GRI;
import fr.boreal.explanation.kb_gri.encoders.AbstractGSATEncoder_KBGRI;
import fr.boreal.model.kb.api.KnowledgeBase;
import fr.boreal.model.logicalElements.api.Atom;
public class FactSupportGSATEncoder_TrackerGRI extends AbstractGSATEncoder_TrackerGRI {
@Override
int getStartingGroupNumber() {
return 1;
}
/**
* This is used to configure the main algorithm in AbstractKBtoGSATEncoder
* For fact-support the rule are all in one group (group 1). Therefore, this method always return 1.
* @return 1
*/
@Override
public int computeRuleID() {
return 1;
}
/**
* This is used to configure the main algorithm in AbstractKBtoGSATEncoder
* For fact-support encoder each REL fact makes in a singleton group.
* Therefore, this method increment the group number and uses it as the factID.
* @return int relAtomGroup
*/
@Override
public int computeRelAtomGroupID() {
nbGroup++;
int relAtomGroup = nbGroup;
return relAtomGroup;
}
/**
* This is used to configure the main algorithm in AbstractKBtoGSATEncoder
* For fact-support encoder we don't need to record rules so this method always returns false
* @return false
*/
@Override
public boolean needRule() {
return false;
}
/**
* This is used to configure the main algorithm in AbstractKBtoGSATEncoder
* For fact-support encoder we need to record facts so this method always returns true
* @return ture
*/
@Override
public boolean needFact() {
return true;
}
}
package fr.boreal.explanation.tracker_gri.encoders;
public class RuleSupportKBGSATEncoder_TrackerGRI extends AbstractGSATEncoder_TrackerGRI {
int getStartingGroupNumber() {
return 2;
}
/**
* This is used to configure the main algorithm in AbstractKBtoGSATEncoder
* For rule-support encoder all groundings of the same rule are in the same group.
* Therefore, this method increment the group number and uses it as the ruleID shared across all groundings.
* @return int currentRuleID
*/
@Override
public int computeRuleID() {
nbGroup++;
int currentRuleID = nbGroup;
return currentRuleID;
}
/**
* This is used to configure the main algorithm in AbstractKBtoGSATEncoder
* For rule-support encoder all REL facts form 1 group (Group 1)
* Therefore this method always return 1
* @return 1
*/
@Override
public int computeRelAtomGroupID() {
return 1;
}
/**
* This is used to configure the main algorithm in AbstractKBtoGSATEncoder
* For rule-support we need to record ruleID so the method return true
* @return true
*/
@Override
public boolean needRule() {
return true;
}
/**
* This is used to configure the main algorithm in AbstractKBtoGSATEncoder
* For rule-support we don't need to record factID so the method returns false
* @return false
*/
@Override
public boolean needFact() {
return false;
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment