Search in sources :

Example 31 with AtomSet

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

the class OWLAxiomParser method visit.

@Override
public Iterable<? extends Object> visit(OWLObjectPropertyAssertionAxiom arg) {
    freeVarGen.setIndex(0);
    Term a = GraalUtils.createTerm(arg.getSubject());
    Term b = GraalUtils.createTerm(arg.getObject());
    AtomSet atomset = arg.getProperty().accept(new OWLPropertyExpressionVisitorImpl(a, b));
    return Collections.singleton(atomset);
}
Also used : LinkedListAtomSet(fr.lirmm.graphik.graal.core.atomset.LinkedListAtomSet) AtomSet(fr.lirmm.graphik.graal.api.core.AtomSet) InMemoryAtomSet(fr.lirmm.graphik.graal.api.core.InMemoryAtomSet) Term(fr.lirmm.graphik.graal.api.core.Term)

Example 32 with AtomSet

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

the class BreadthFirstChase method dispatchNewData.

// /////////////////////////////////////////////////////////////////////////
// PRIVATE CLASS
// /////////////////////////////////////////////////////////////////////////
protected void dispatchNewData(Collection<Atom> newData) throws ChaseException {
    for (Atom a : newData) {
        Predicate p = a.getPredicate();
        for (Rule r : ruleSet.getRulesByBodyPredicate(p)) {
            if (linearRuleCheck(r)) {
                AtomSet set = nextRulesToCheck.get(r);
                if (set == null) {
                    set = new DefaultInMemoryGraphStore();
                    nextRulesToCheck.put(r, set);
                }
                try {
                    set.add(a);
                } catch (AtomSetException e) {
                    throw new ChaseException("Exception while adding data into a tmp store", e);
                }
            } else {
                nextRulesToCheck.put(r, atomSet);
            }
        }
    }
}
Also used : AtomSet(fr.lirmm.graphik.graal.api.core.AtomSet) AtomSetException(fr.lirmm.graphik.graal.api.core.AtomSetException) Rule(fr.lirmm.graphik.graal.api.core.Rule) DefaultInMemoryGraphStore(fr.lirmm.graphik.graal.core.atomset.graph.DefaultInMemoryGraphStore) ChaseException(fr.lirmm.graphik.graal.api.forward_chaining.ChaseException) Atom(fr.lirmm.graphik.graal.api.core.Atom) Predicate(fr.lirmm.graphik.graal.api.core.Predicate)

Aggregations

AtomSet (fr.lirmm.graphik.graal.api.core.AtomSet)32 InMemoryAtomSet (fr.lirmm.graphik.graal.api.core.InMemoryAtomSet)18 ConjunctiveQuery (fr.lirmm.graphik.graal.api.core.ConjunctiveQuery)14 Substitution (fr.lirmm.graphik.graal.api.core.Substitution)13 Test (org.junit.Test)13 RuleSet (fr.lirmm.graphik.graal.api.core.RuleSet)11 DefaultInMemoryGraphStore (fr.lirmm.graphik.graal.core.atomset.graph.DefaultInMemoryGraphStore)11 LinkedListRuleSet (fr.lirmm.graphik.graal.core.ruleset.LinkedListRuleSet)11 Atom (fr.lirmm.graphik.graal.api.core.Atom)9 DefaultConjunctiveQuery (fr.lirmm.graphik.graal.core.DefaultConjunctiveQuery)9 LinkedListAtomSet (fr.lirmm.graphik.graal.core.atomset.LinkedListAtomSet)9 Rule (fr.lirmm.graphik.graal.api.core.Rule)7 RulesCompilation (fr.lirmm.graphik.graal.api.core.RulesCompilation)7 HomomorphismWithCompilation (fr.lirmm.graphik.graal.api.homomorphism.HomomorphismWithCompilation)7 Theory (org.junit.experimental.theories.Theory)7 AtomSetException (fr.lirmm.graphik.graal.api.core.AtomSetException)5 Term (fr.lirmm.graphik.graal.api.core.Term)5 ChaseException (fr.lirmm.graphik.graal.api.forward_chaining.ChaseException)5 CPUTimeProfiler (fr.lirmm.graphik.util.profiler.CPUTimeProfiler)5 TripleStore (fr.lirmm.graphik.graal.api.store.TripleStore)4