Search in sources :

Example 1 with SparqlConjunctiveQueryWriter

use of fr.lirmm.graphik.graal.io.sparql.SparqlConjunctiveQueryWriter 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);
}
Also used : StringWriter(java.io.StringWriter) AtomSetException(fr.lirmm.graphik.graal.api.core.AtomSetException) TupleQuery(org.eclipse.rdf4j.query.TupleQuery) IOException(java.io.IOException) TupleQueryResult(org.eclipse.rdf4j.query.TupleQueryResult) ConjunctiveQuery(fr.lirmm.graphik.graal.api.core.ConjunctiveQuery) SparqlConjunctiveQueryWriter(fr.lirmm.graphik.graal.io.sparql.SparqlConjunctiveQueryWriter)

Aggregations

AtomSetException (fr.lirmm.graphik.graal.api.core.AtomSetException)1 ConjunctiveQuery (fr.lirmm.graphik.graal.api.core.ConjunctiveQuery)1 SparqlConjunctiveQueryWriter (fr.lirmm.graphik.graal.io.sparql.SparqlConjunctiveQueryWriter)1 IOException (java.io.IOException)1 StringWriter (java.io.StringWriter)1 TupleQuery (org.eclipse.rdf4j.query.TupleQuery)1 TupleQueryResult (org.eclipse.rdf4j.query.TupleQueryResult)1