Search in sources :

Example 1 with Analyser

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;
    }
}
Also used : HashMap(java.util.HashMap) Analyser(fr.lirmm.graphik.graal.rulesetanalyser.Analyser) RuleSetProperty(fr.lirmm.graphik.graal.rulesetanalyser.property.RuleSetProperty) AnalyserRuleSet(fr.lirmm.graphik.graal.rulesetanalyser.util.AnalyserRuleSet)

Example 2 with Analyser

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());
}
Also used : Analyser(fr.lirmm.graphik.graal.rulesetanalyser.Analyser) Test(org.junit.Test)

Aggregations

Analyser (fr.lirmm.graphik.graal.rulesetanalyser.Analyser)2 RuleSetProperty (fr.lirmm.graphik.graal.rulesetanalyser.property.RuleSetProperty)1 AnalyserRuleSet (fr.lirmm.graphik.graal.rulesetanalyser.util.AnalyserRuleSet)1 HashMap (java.util.HashMap)1 Test (org.junit.Test)1