use of fr.lirmm.graphik.graal.api.core.AtomSetException in project graal by graphik-team.
the class AbstractRdbmsStore method remove.
@Override
public boolean remove(Atom atom) {
boolean res = true;
Statement statement = null;
try {
statement = this.createStatement();
this.remove(statement, atom);
statement.executeBatch();
this.getConnection().commit();
} catch (SQLException e) {
res = false;
} catch (AtomSetException e) {
res = false;
} finally {
if (statement != null) {
try {
statement.close();
} catch (SQLException e) {
res = false;
}
}
}
return res;
}
use of fr.lirmm.graphik.graal.api.core.AtomSetException in project graal by graphik-team.
the class RDF4jStore method match.
@Override
public CloseableIterator<Atom> match(Atom atom) throws AtomSetException {
ConjunctiveQuery query = DefaultConjunctiveQueryFactory.instance().create(atom);
StringWriter s = new StringWriter();
SparqlConjunctiveQueryWriter w = new SparqlConjunctiveQueryWriter(s, this.utils.getURIzer());
try {
w.write(query);
w.close();
} catch (IOException e1) {
throw new AtomSetException("Error while converting to SPARQL " + atom, e1);
}
TupleQuery sparqlQuery = this.connection.prepareTupleQuery(s.toString());
TupleQueryResult result = sparqlQuery.evaluate();
return new TupleQueryResultAtomIterator(result, atom, utils);
}
use of fr.lirmm.graphik.graal.api.core.AtomSetException in project graal by graphik-team.
the class RDF4jStore method getPredicates.
@Override
public Set<Predicate> getPredicates() throws AtomSetException {
TreeSet<Predicate> set = new TreeSet<Predicate>();
CloseableIterator<Predicate> it = this.predicatesIterator();
try {
while (it.hasNext()) {
set.add(it.next());
}
} catch (IteratorException e) {
throw new AtomSetException("An error occurs during iteration over predicates", e);
}
return set;
}
use of fr.lirmm.graphik.graal.api.core.AtomSetException 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;
}
use of fr.lirmm.graphik.graal.api.core.AtomSetException 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;
}
Aggregations