use of fr.lirmm.graphik.graal.api.core.Predicate in project graal by graphik-team.
the class OWLPropertyExpressionVisitorImpl method visit.
@Override
public InMemoryAtomSet visit(OWLObjectInverseOf property) {
Predicate p = GraalUtils.createPredicate(property.getInverse());
Atom a = DefaultAtomFactory.instance().create(p, glueVariable2, glueVariable1);
return GraalUtils.createAtomSet(a);
}
use of fr.lirmm.graphik.graal.api.core.Predicate in project graal by graphik-team.
the class OWLPropertyExpressionVisitorImpl method visit.
@Override
public InMemoryAtomSet visit(OWLDataProperty property) {
Predicate p = GraalUtils.createPredicate(property);
Atom a = DefaultAtomFactory.instance().create(p, glueVariable1, glueVariable2);
return GraalUtils.createAtomSet(a);
}
use of fr.lirmm.graphik.graal.api.core.Predicate in project graal by graphik-team.
the class NoTripleStoreTest method arityTest.
@Theory
public void arityTest(AtomSet store) throws AtomSetException, IteratorException, ParseException {
Assume.assumeFalse(store instanceof TripleStore);
Atom toAdd = DlgpParser.parseAtom("<P>(a).");
Predicate toCheck = new Predicate("P", 2);
store.add(toAdd);
CloseableIterator<?> it = store.termsByPredicatePosition(toCheck, 1);
Assert.assertFalse(it.hasNext());
it = store.atomsByPredicate(toCheck);
Assert.assertFalse(it.hasNext());
it = store.match(DlgpParser.parseAtom("<p>(X,Y)."));
Assert.assertFalse(it.hasNext());
}
use of fr.lirmm.graphik.graal.api.core.Predicate in project graal by graphik-team.
the class NaturalRDBMSStore method termsIterator.
@Override
@Deprecated
public CloseableIterator<Term> termsIterator(Type type) throws AtomSetException {
Set<Term> terms = new TreeSet<Term>();
CloseableIterator<Predicate> predIt = this.predicatesIterator();
try {
while (predIt.hasNext()) {
Predicate p = predIt.next();
for (int i = 0; i < p.getArity(); ++i) {
CloseableIterator<Term> termIt = this.termsByPredicatePosition(p, i);
while (termIt.hasNext()) {
Term t = termIt.next();
if (type.equals(t.getType())) {
terms.add(t);
}
}
}
}
} catch (IteratorException e) {
throw new AtomSetException(e);
}
return new CloseableIteratorAdapter<Term>(terms.iterator());
}
use of fr.lirmm.graphik.graal.api.core.Predicate in project graal by graphik-team.
the class NaturalRDBMSStore method termsIterator.
@Override
public CloseableIterator<Term> termsIterator() throws AtomSetException {
Set<Term> terms = new TreeSet<Term>();
CloseableIterator<Predicate> predIt = this.predicatesIterator();
try {
while (predIt.hasNext()) {
Predicate p = predIt.next();
for (int i = 0; i < p.getArity(); ++i) {
CloseableIterator<Term> termIt = this.termsByPredicatePosition(p, i);
while (termIt.hasNext()) {
terms.add(termIt.next());
}
}
}
} catch (IteratorException e) {
throw new AtomSetException(e);
}
return new CloseableIteratorAdapter<Term>(terms.iterator());
}
Aggregations