use of fr.lirmm.graphik.graal.api.core.Predicate in project graal by graphik-team.
the class PrefixMapperTest method testInverseMap.
/**
* Test method for {@link fr.lirmm.graphik.graal.core.mapper.AbstractMapper#inverse()}.
*/
@Test
public void testInverseMap() {
// Given
Predicate p = new Predicate("prefix#p", 1);
Mapper mapper = new PrefixMapper("prefix#");
// When
Predicate mapped = mapper.inverse().map(p);
// Then
Assert.assertEquals(new Predicate("p", 1), mapped);
}
use of fr.lirmm.graphik.graal.api.core.Predicate in project graal by graphik-team.
the class PrefixMapperTest method testMapPredicate.
/**
* Test method for {@link fr.lirmm.graphik.graal.core.mapper.PrefixMapper#map(fr.lirmm.graphik.graal.api.core.Predicate)}.
*/
@Test
public void testMapPredicate() {
// Given
Predicate p = new Predicate("p", 1);
Mapper mapper = new PrefixMapper("prefix#");
// When
Predicate mapped = mapper.map(p);
// Then
Assert.assertEquals(new Predicate("prefix#p", 1), mapped);
}
use of fr.lirmm.graphik.graal.api.core.Predicate in project graal by graphik-team.
the class PrefixMapperTest method testInverseUnmap.
/**
* Test method for {@link fr.lirmm.graphik.graal.core.mapper.AbstractMapper#inverse()}.
*/
@Test
public void testInverseUnmap() {
// Given
Predicate p = new Predicate("p", 1);
Mapper mapper = new PrefixMapper("prefix#");
// When
Predicate mapped = mapper.inverse().unmap(p);
// Then
Assert.assertEquals(new Predicate("prefix#p", 1), mapped);
}
use of fr.lirmm.graphik.graal.api.core.Predicate in project graal by graphik-team.
the class AtomTest method constructorTest.
@Test
public void constructorTest() {
Predicate predicate = new Predicate("pred", 3);
Term[] terms = new Term[3];
terms[0] = new DefaultVariable("X");
terms[1] = new DefaultConstant("a");
terms[2] = new DefaultConstant("b");
Atom atom = new DefaultAtom(predicate, Arrays.asList(terms));
Assert.assertTrue(atom.getPredicate().equals(predicate));
Assert.assertTrue(atom.getTerm(0).equals(terms[0]));
Assert.assertTrue(atom.getTerm(1).equals(terms[1]));
Assert.assertTrue(atom.getTerm(2).equals(terms[2]));
Assert.assertTrue("The list eiuae ", atom.getTerms().equals(Arrays.asList(terms)));
}
use of fr.lirmm.graphik.graal.api.core.Predicate in project graal by graphik-team.
the class AtomTest method setterTest.
@Test
public void setterTest() {
Predicate predicate = new Predicate("pred", 3);
Term[] terms = new Term[3];
terms[0] = new DefaultVariable("X");
terms[1] = new DefaultConstant("a");
terms[2] = new DefaultConstant("b");
Atom atom = new DefaultAtom(predicate, Arrays.asList(terms));
Term newTerm = new DefaultConstant("new");
Predicate newPredicate = new Predicate("newPred", 3);
atom.setPredicate(newPredicate);
Assert.assertTrue(atom.getPredicate().equals(newPredicate));
atom.setTerm(2, newTerm);
Assert.assertTrue(atom.getTerm(2).equals(newTerm));
}
Aggregations