use of fr.lirmm.graphik.graal.rulesetanalyser.Analyser in project graal by graphik-team.
the class DefaultKnowledgeBase method analyse.
protected void analyse() {
if (!this.isAnalysed) {
this.analysedRuleSet = new AnalyserRuleSet(this.ruleset);
Map<String, RuleSetProperty> properties = new HashMap<>();
if (this.approach != Approach.REWRITING_ONLY) {
properties.putAll(RuleSetPropertyHierarchy.generatePropertyMapSpecializationOf(FESProperty.instance()));
}
if (this.approach != Approach.SATURATION_ONLY) {
properties.putAll(RuleSetPropertyHierarchy.generatePropertyMapSpecializationOf(FUSProperty.instance()));
}
this.analyse = new Analyser(analysedRuleSet);
this.analyse.setProperties(properties.values());
this.isAnalysed = true;
}
}
use of fr.lirmm.graphik.graal.rulesetanalyser.Analyser in project graal by graphik-team.
the class PropertyTest method ruleAnalyserTest.
@Test
public void ruleAnalyserTest() {
Analyser analyser;
analyser = new Analyser();
analyser.setRuleSet(rSet0);
analyser.setProperties(properties);
Map<String, Integer> p = analyser.ruleSetProperties();
assertEquals(-1, p.get(s.getLabel()).intValue());
assertEquals(1, p.get(wa.getLabel()).intValue());
assertEquals(1, p.get(ws.getLabel()).intValue());
assertEquals(1, p.get(wg.getLabel()).intValue());
assertEquals(1, p.get(jfg.getLabel()).intValue());
analyser = new Analyser();
analyser.setRuleSet(rSet1);
analyser.setProperties(properties);
p = analyser.ruleSetProperties();
assertEquals(1, p.get(s.getLabel()).intValue());
assertEquals(-1, p.get(wa.getLabel()).intValue());
assertEquals(1, p.get(ws.getLabel()).intValue());
assertEquals(1, p.get(wg.getLabel()).intValue());
assertEquals(1, p.get(jfg.getLabel()).intValue());
analyser = new Analyser();
analyser.setRuleSet(rSet3);
analyser.setProperties(properties);
p = analyser.ruleSetProperties();
assertEquals(-1, p.get(s.getLabel()).intValue());
assertEquals(-1, p.get(wa.getLabel()).intValue());
assertEquals(1, p.get(ws.getLabel()).intValue());
assertEquals(-1, p.get(wg.getLabel()).intValue());
assertEquals(-1, p.get(jfg.getLabel()).intValue());
}
Aggregations