use of fr.lirmm.graphik.graal.api.core.Predicate in project graal by graphik-team.
the class IDCompilation method isImplied.
@Override
public boolean isImplied(Atom father, Atom son) {
Predicate predB = son.getPredicate();
Predicate predH = father.getPredicate();
List<IDCondition> conds = getConditions(predB, predH);
for (IDCondition cond : conds) {
if (cond.imply(son.getTerms(), father.getTerms())) {
return true;
}
}
return false;
}
use of fr.lirmm.graphik.graal.api.core.Predicate in project graal by graphik-team.
the class LinkedListAtomSet method getPredicates.
// /////////////////////////////////////////////////////////////////////////
// PUBLIC METHODS
// /////////////////////////////////////////////////////////////////////////
@Override
public Set<Predicate> getPredicates() {
Set<Predicate> predicates = new HashSet<Predicate>();
CloseableIteratorWithoutException<Atom> it = this.iterator();
while (it.hasNext()) {
Atom a = it.next();
predicates.add(a.getPredicate());
}
return predicates;
}
use of fr.lirmm.graphik.graal.api.core.Predicate in project graal by graphik-team.
the class OWLEquivalentClassExpressionVisitorImpl method visit.
// /////////////////////////////////////////////////////////////////////////
// PUBLIC METHODS
// /////////////////////////////////////////////////////////////////////////
@Override
public InMemoryAtomSet visit(OWLClass arg) {
Predicate p = GraalUtils.createPredicate(arg);
Atom a = DefaultAtomFactory.instance().create(p, glueVariable);
return GraalUtils.createAtomSet(a);
}
use of fr.lirmm.graphik.graal.api.core.Predicate in project graal by graphik-team.
the class AbstractRDFListener method handleStatement.
@Override
public void handleStatement(Statement st) {
if (LOGGER.isDebugEnabled()) {
LOGGER.debug(st.toString());
}
Predicate predicate = new Predicate(new DefaultURI(st.getPredicate().toString()), 2);
Term subject = DefaultTermFactory.instance().createConstant(new DefaultURI(st.getSubject().toString()));
Term object;
fr.lirmm.graphik.util.URI datatype;
if (st.getObject() instanceof Literal) {
Literal l = (Literal) st.getObject();
if (l.getDatatype() == null) {
datatype = URIUtils.RDF_LANG_STRING;
} else {
datatype = new fr.lirmm.graphik.util.DefaultURI(l.getDatatype().getNamespace(), l.getDatatype().getLocalName());
}
String value = l.getLabel();
if (datatype.equals(URIUtils.RDF_LANG_STRING)) {
value += "@" + l.getLanguage();
}
object = DefaultTermFactory.instance().createLiteral(datatype, value);
} else {
object = DefaultTermFactory.instance().createConstant(new DefaultURI(st.getObject().toString()));
}
DefaultAtom a = new DefaultAtom(predicate, subject, object);
this.createAtom(a);
}
use of fr.lirmm.graphik.graal.api.core.Predicate in project graal by graphik-team.
the class PrefixMapperTest method testUnmapPredicate.
/**
* Test method for {@link fr.lirmm.graphik.graal.core.mapper.PrefixMapper#unmap(fr.lirmm.graphik.graal.api.core.Predicate)}.
*/
@Test
public void testUnmapPredicate() {
// Given
Predicate p = new Predicate("prefix#p", 1);
Mapper mapper = new PrefixMapper("prefix#");
// When
Predicate mapped = mapper.unmap(p);
// Then
Assert.assertEquals(new Predicate("p", 1), mapped);
}
Aggregations