Search in sources :

Example 1 with Ontology

use of fr.lirmm.graphik.graal.api.core.Ontology in project graal by graphik-team.

the class DefaultOntologyTest method testAddSameRuleTwice.

/**
 * Test method for
 * {@link fr.lirmm.graphik.graal.core.ruleset.DefaultOntology#add(Rule)}.
 */
@Test
public void testAddSameRuleTwice() {
    // given
    Ontology onto = new DefaultOntology();
    // when
    onto.add(same1);
    onto.add(same1);
    // then
    Assert.assertEquals(1, onto.size());
}
Also used : Ontology(fr.lirmm.graphik.graal.api.core.Ontology) Test(org.junit.Test)

Example 2 with Ontology

use of fr.lirmm.graphik.graal.api.core.Ontology in project graal by graphik-team.

the class DefaultOntologyTest method testContains.

/**
 * Test method for
 * {@link fr.lirmm.graphik.graal.core.ruleset.DefaultOntology#contains(fr.lirmm.graphik.graal.api.core.Rule)}.
 */
@Test
public void testContains() {
    // given
    Ontology onto = new DefaultOntology();
    onto.add(r1);
    // when
    boolean b = onto.contains(r1);
    // then
    Assert.assertTrue(b);
}
Also used : Ontology(fr.lirmm.graphik.graal.api.core.Ontology) Test(org.junit.Test)

Example 3 with Ontology

use of fr.lirmm.graphik.graal.api.core.Ontology in project graal by graphik-team.

the class DefaultOntologyTest method testRemove.

/**
 * Test method for
 * {@link fr.lirmm.graphik.graal.core.ruleset.DefaultOntology#remove(fr.lirmm.graphik.graal.api.core.Rule)}.
 */
@Test
public void testRemove() {
    // given
    Ontology onto = new DefaultOntology();
    onto.add(r1);
    onto.remove(r1);
    // when
    Set<String> ruleNames = onto.getRuleNames();
    // then
    Assert.assertTrue(ruleNames.isEmpty());
}
Also used : Ontology(fr.lirmm.graphik.graal.api.core.Ontology) Test(org.junit.Test)

Example 4 with Ontology

use of fr.lirmm.graphik.graal.api.core.Ontology in project graal by graphik-team.

the class DefaultOntologyTest method testIterator_empty.

/**
 * Test method for
 * {@link fr.lirmm.graphik.graal.core.ruleset.DefaultOntology#iterator()}.
 */
@Test
public void testIterator_empty() {
    // given
    Ontology onto = new DefaultOntology();
    // when
    Iterator<Rule> it = onto.iterator();
    // then
    Assert.assertFalse(it.hasNext());
}
Also used : Ontology(fr.lirmm.graphik.graal.api.core.Ontology) Rule(fr.lirmm.graphik.graal.api.core.Rule) DefaultRule(fr.lirmm.graphik.graal.core.DefaultRule) Test(org.junit.Test)

Example 5 with Ontology

use of fr.lirmm.graphik.graal.api.core.Ontology in project graal by graphik-team.

the class DefaultOntologyTest method testSize.

/**
 * Test method for
 * {@link fr.lirmm.graphik.graal.core.ruleset.DefaultOntology#size()}.
 */
@Test
public void testSize() {
    // given
    Ontology onto = new DefaultOntology();
    onto.add(r1);
    onto.add(noName);
    onto.add(r1);
    // when
    int size = onto.size();
    // then
    Assert.assertEquals(2, size);
}
Also used : Ontology(fr.lirmm.graphik.graal.api.core.Ontology) Test(org.junit.Test)

Aggregations

Ontology (fr.lirmm.graphik.graal.api.core.Ontology)13 Test (org.junit.Test)13 Rule (fr.lirmm.graphik.graal.api.core.Rule)3 DefaultRule (fr.lirmm.graphik.graal.core.DefaultRule)2 DefaultOntology (fr.lirmm.graphik.graal.core.ruleset.DefaultOntology)2 InMemoryAtomSet (fr.lirmm.graphik.graal.api.core.InMemoryAtomSet)1 Chase (fr.lirmm.graphik.graal.api.forward_chaining.Chase)1 KnowledgeBase (fr.lirmm.graphik.graal.api.kb.KnowledgeBase)1 DefaultInMemoryGraphStore (fr.lirmm.graphik.graal.core.atomset.graph.DefaultInMemoryGraphStore)1 BreadthFirstChase (fr.lirmm.graphik.graal.forward_chaining.BreadthFirstChase)1