Search in sources :

Example 6 with IteratorException

use of fr.lirmm.graphik.util.stream.IteratorException in project graal by graphik-team.

the class RDF4jStore method getTerms.

@Override
public Set<Term> getTerms() throws AtomSetException {
    TreeSet<Term> set = new TreeSet<Term>();
    CloseableIterator<Term> it = this.termsIterator();
    try {
        while (it.hasNext()) {
            set.add(it.next());
        }
    } catch (IteratorException e) {
        throw new AtomSetException("An error occurs during iteration over terms", e);
    }
    return set;
}
Also used : IteratorException(fr.lirmm.graphik.util.stream.IteratorException) TreeSet(java.util.TreeSet) AtomSetException(fr.lirmm.graphik.graal.api.core.AtomSetException) Term(fr.lirmm.graphik.graal.api.core.Term)

Example 7 with IteratorException

use of fr.lirmm.graphik.util.stream.IteratorException in project graal by graphik-team.

the class Neo4jStore method removeAll.

@Override
public boolean removeAll(CloseableIterator<? extends Atom> it) throws AtomSetException {
    boolean isChanged = false;
    this.checkTransaction();
    try {
        while (it.hasNext()) {
            isChanged = this.remove(it.next(), null) || isChanged;
        }
        this.successTransaction();
    } catch (IteratorException e) {
        throw new AtomSetException("An errors occurs while iterating atoms to remove", e);
    } finally {
        this.reloadTransaction();
    }
    return isChanged;
}
Also used : IteratorException(fr.lirmm.graphik.util.stream.IteratorException) AtomSetException(fr.lirmm.graphik.graal.api.core.AtomSetException)

Example 8 with IteratorException

use of fr.lirmm.graphik.util.stream.IteratorException in project graal by graphik-team.

the class Neo4jStore method getTerms.

@Override
@Deprecated
public Set<Term> getTerms(Type type) throws AtomSetException {
    TreeSet<Term> set = new TreeSet<Term>();
    CloseableIterator<Term> it = this.termsIterator(type);
    try {
        while (it.hasNext()) {
            set.add(it.next());
        }
    } catch (IteratorException e) {
        throw new AtomSetException("An errors occurs while iterating terms", e);
    }
    return set;
}
Also used : IteratorException(fr.lirmm.graphik.util.stream.IteratorException) TreeSet(java.util.TreeSet) AtomSetException(fr.lirmm.graphik.graal.api.core.AtomSetException) Term(fr.lirmm.graphik.graal.api.core.Term)

Example 9 with IteratorException

use of fr.lirmm.graphik.util.stream.IteratorException in project graal by graphik-team.

the class Neo4jStore method addAll.

@Override
public boolean addAll(CloseableIterator<? extends Atom> it) throws AtomSetException {
    boolean isChanged = false;
    this.checkTransaction();
    try {
        while (it.hasNext()) {
            isChanged = this.add(it.next(), null) || isChanged;
        }
        this.successTransaction();
    } catch (IteratorException e) {
        throw new AtomSetException("An errors occurs while iterating atoms to add", e);
    } finally {
        this.reloadTransaction();
    }
    return isChanged;
}
Also used : IteratorException(fr.lirmm.graphik.util.stream.IteratorException) AtomSetException(fr.lirmm.graphik.graal.api.core.AtomSetException)

Example 10 with IteratorException

use of fr.lirmm.graphik.util.stream.IteratorException in project graal by graphik-team.

the class AbstractRdbmsStore method clear.

@Override
public void clear() throws AtomSetException {
    CloseableIterator<Predicate> it = this.predicatesIterator();
    Statement stat = null;
    try {
        try {
            stat = this.createStatement();
            while (it.hasNext()) {
                Predicate p = it.next();
                this.removePredicate(stat, p);
            }
            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);
    }
}
Also used : IteratorException(fr.lirmm.graphik.util.stream.IteratorException) SQLException(java.sql.SQLException) Statement(java.sql.Statement) AtomSetException(fr.lirmm.graphik.graal.api.core.AtomSetException) Predicate(fr.lirmm.graphik.graal.api.core.Predicate)

Aggregations

IteratorException (fr.lirmm.graphik.util.stream.IteratorException)37 AtomSetException (fr.lirmm.graphik.graal.api.core.AtomSetException)24 Atom (fr.lirmm.graphik.graal.api.core.Atom)16 Term (fr.lirmm.graphik.graal.api.core.Term)14 HomomorphismException (fr.lirmm.graphik.graal.api.homomorphism.HomomorphismException)14 Substitution (fr.lirmm.graphik.graal.api.core.Substitution)13 Predicate (fr.lirmm.graphik.graal.api.core.Predicate)9 ConjunctiveQuery (fr.lirmm.graphik.graal.api.core.ConjunctiveQuery)8 TreeSet (java.util.TreeSet)8 InMemoryAtomSet (fr.lirmm.graphik.graal.api.core.InMemoryAtomSet)7 BacktrackException (fr.lirmm.graphik.graal.homomorphism.BacktrackException)6 CloseableIteratorAdapter (fr.lirmm.graphik.util.stream.CloseableIteratorAdapter)6 RuleApplicationException (fr.lirmm.graphik.graal.api.forward_chaining.RuleApplicationException)5 Variable (fr.lirmm.graphik.graal.api.core.Variable)4 SQLException (java.sql.SQLException)4 AtomSet (fr.lirmm.graphik.graal.api.core.AtomSet)3 Rule (fr.lirmm.graphik.graal.api.core.Rule)3 HomomorphismFactoryException (fr.lirmm.graphik.graal.api.homomorphism.HomomorphismFactoryException)3 DBTable (fr.lirmm.graphik.graal.store.rdbms.util.DBTable)3 SQLQuery (fr.lirmm.graphik.graal.store.rdbms.util.SQLQuery)3