Search in sources :

Example 21 with InMemoryAtomSet

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

the class OWLAxiomParser method visit.

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

Example 22 with InMemoryAtomSet

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

the class OWLEquivalentClassExpressionVisitorImpl method objectMinCardinality0.

@Override
public InMemoryAtomSet objectMinCardinality0(OWLObjectMinCardinality arg) {
    InMemoryAtomSet atomset = GraalUtils.createAtomSet();
    atomset.add(new DefaultAtom(Predicate.TOP, glueVariable));
    return atomset;
}
Also used : DefaultAtom(fr.lirmm.graphik.graal.core.DefaultAtom) InMemoryAtomSet(fr.lirmm.graphik.graal.api.core.InMemoryAtomSet)

Example 23 with InMemoryAtomSet

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

the class OWLEquivalentClassExpressionVisitorImpl method dataMinCardinality1.

@Override
public InMemoryAtomSet dataMinCardinality1(OWLDataMinCardinality arg) {
    Variable newGlueVariable = varGen.getFreshSymbol();
    InMemoryAtomSet atomset = arg.getProperty().accept(new OWLPropertyExpressionVisitorImpl(glueVariable, newGlueVariable));
    atomset.addAll(arg.getFiller().accept(new OWLEquivalentDataRangeVisitorImpl(newGlueVariable)));
    return atomset;
}
Also used : Variable(fr.lirmm.graphik.graal.api.core.Variable) InMemoryAtomSet(fr.lirmm.graphik.graal.api.core.InMemoryAtomSet)

Example 24 with InMemoryAtomSet

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

the class OWLEquivalentClassExpressionVisitorImpl method visit.

@Override
public InMemoryAtomSet visit(OWLObjectSomeValuesFrom arg) {
    Term newGlueVariable = varGen.getFreshSymbol();
    InMemoryAtomSet atomset = arg.getProperty().accept(new OWLPropertyExpressionVisitorImpl(glueVariable, newGlueVariable));
    if (!arg.getFiller().equals(DF.getOWLThing())) {
        atomset.addAll(arg.getFiller().accept(new OWLEquivalentClassExpressionVisitorImpl(this.prefixManager, varGen, newGlueVariable)));
    }
    return atomset;
}
Also used : InMemoryAtomSet(fr.lirmm.graphik.graal.api.core.InMemoryAtomSet) Term(fr.lirmm.graphik.graal.api.core.Term)

Example 25 with InMemoryAtomSet

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

the class Utils method isMoreGeneralThan.

/**
 * Returns true if AtomSet h is more general than AtomSet f, and mark all
 * the atom of h if h is a marked fact; else return false
 *
 * @param h
 * @param f
 * @param compilation
 * @return true if AtomSet h is more general than AtomSet f, and mark all
 * the atom of h if h is a marked fact, false otherwise.
 */
public static boolean isMoreGeneralThan(InMemoryAtomSet h, InMemoryAtomSet f, RulesCompilation compilation) {
    boolean moreGen = false;
    if (testInclu && AtomSetUtils.contains(f, h)) {
        moreGen = true;
    } else {
        try {
            InMemoryAtomSet fCopy = Utils.getSafeCopy(f);
            moreGen = PureHomomorphism.instance().exist(h, fCopy, compilation);
        } catch (HomomorphismException e) {
        }
    }
    return moreGen;
}
Also used : HomomorphismException(fr.lirmm.graphik.graal.api.homomorphism.HomomorphismException) InMemoryAtomSet(fr.lirmm.graphik.graal.api.core.InMemoryAtomSet)

Aggregations

InMemoryAtomSet (fr.lirmm.graphik.graal.api.core.InMemoryAtomSet)122 Substitution (fr.lirmm.graphik.graal.api.core.Substitution)40 Atom (fr.lirmm.graphik.graal.api.core.Atom)38 LinkedListAtomSet (fr.lirmm.graphik.graal.core.atomset.LinkedListAtomSet)35 Test (org.junit.Test)35 Term (fr.lirmm.graphik.graal.api.core.Term)31 Rule (fr.lirmm.graphik.graal.api.core.Rule)25 ConjunctiveQuery (fr.lirmm.graphik.graal.api.core.ConjunctiveQuery)23 LinkedList (java.util.LinkedList)22 DefaultInMemoryGraphStore (fr.lirmm.graphik.graal.core.atomset.graph.DefaultInMemoryGraphStore)21 Variable (fr.lirmm.graphik.graal.api.core.Variable)19 HomomorphismException (fr.lirmm.graphik.graal.api.homomorphism.HomomorphismException)10 DefaultNegativeConstraint (fr.lirmm.graphik.graal.core.DefaultNegativeConstraint)10 DefaultAtom (fr.lirmm.graphik.graal.core.DefaultAtom)9 Theory (org.junit.experimental.theories.Theory)9 AtomSet (fr.lirmm.graphik.graal.api.core.AtomSet)8 DefaultConjunctiveQueryWithNegatedParts (fr.lirmm.graphik.graal.core.DefaultConjunctiveQueryWithNegatedParts)8 IteratorException (fr.lirmm.graphik.util.stream.IteratorException)8 OWL2Parser (fr.lirmm.graphik.graal.io.owl.OWL2Parser)7 Predicate (fr.lirmm.graphik.graal.api.core.Predicate)6