use of fr.lirmm.graphik.graal.api.core.Predicate in project graal by graphik-team.
the class IDCompilation method computeSaturation.
private void computeSaturation() {
// deep copy of conditions
Map<Predicate, TreeMap<Predicate, LinkedList<IDCondition>>> conditionsTmp = deepCopyMapMapList(this.conditions);
// p -> q
Predicate p, q;
for (Map.Entry<Predicate, TreeMap<Predicate, LinkedList<IDCondition>>> e : conditionsTmp.entrySet()) {
q = e.getKey();
for (Map.Entry<Predicate, LinkedList<IDCondition>> map : e.getValue().entrySet()) {
p = map.getKey();
for (IDCondition conditionPQ : map.getValue()) {
computeSaturation(conditionsTmp, p, q, conditionPQ);
}
}
}
}
use of fr.lirmm.graphik.graal.api.core.Predicate in project graal by graphik-team.
the class DefaultOntology method resetVocabulary.
// /////////////////////////////////////////////////////////////////////////
// OBJECT OVERRIDE METHODS
// /////////////////////////////////////////////////////////////////////////
// /////////////////////////////////////////////////////////////////////////
// PRIVATE METHODS
// /////////////////////////////////////////////////////////////////////////
/**
*/
private void resetVocabulary() {
// reset vocabulary
this.vocabulary = new TreeSet<Predicate>();
for (Rule r : this) {
this.vocabulary.addAll(r.getBody().getPredicates());
this.vocabulary.addAll(r.getHead().getPredicates());
}
}
use of fr.lirmm.graphik.graal.api.core.Predicate in project graal by graphik-team.
the class AdHocRdbmsStore method clear.
@Override
public void clear() throws AtomSetException {
try {
Statement stat = null;
CloseableIterator<Predicate> it = this.predicatesIterator();
try {
stat = this.createStatement();
while (it.hasNext()) {
Predicate p = it.next();
this.removePredicate(stat, p);
}
stat.execute(String.format(TRUNCATE_TABLE, PREDICATE_TABLE_NAME));
stat.execute(String.format(TRUNCATE_TABLE, TERMS_TABLE));
stat.close();
this.getConnection().commit();
} catch (IteratorException e) {
this.getConnection().rollback();
throw new AtomSetException(e);
} catch (SQLException e) {
this.getConnection().rollback();
throw new AtomSetException(e);
} finally {
if (stat != null)
stat.close();
}
} catch (SQLException e) {
throw new AtomSetException(e);
}
}
use of fr.lirmm.graphik.graal.api.core.Predicate in project graal by graphik-team.
the class MarkedVariableSet method firstStep.
/**
* for each rule Ri and for each variable v occuring in its body, if v does
* not occur in all atoms of its head, mark (each occurrence of) v in its
* body;
*/
private void firstStep() {
for (MarkedRule markedRule : this.markedRuleSet) {
// put rule in the map
CloseableIteratorWithoutException<Atom> it = markedRule.rule.getHead().iterator();
while (it.hasNext()) {
Atom atom = it.next();
Predicate p = atom.getPredicate();
LinkedList<MarkedRule> set = map.get(p);
if (set == null) {
set = new LinkedList<MarkedRule>();
map.put(p, set);
}
set.add(markedRule);
}
// mark the rule
testRule(markedRule);
}
}
use of fr.lirmm.graphik.graal.api.core.Predicate in project graal by graphik-team.
the class OWLPropertyExpressionVisitorImpl method visit.
@Override
public InMemoryAtomSet visit(OWLObjectProperty property) {
Predicate p = GraalUtils.createPredicate(property);
Atom a = DefaultAtomFactory.instance().create(p, glueVariable1, glueVariable2);
return GraalUtils.createAtomSet(a);
}
Aggregations