Search in sources :

Example 1 with GraphImpl

use of org.eclipse.rdf4j.model.impl.GraphImpl in project rdf4j by eclipse.

the class DAWGTestResultSetUtil method toGraph.

public static Graph toGraph(TupleQueryResult tqr) throws QueryEvaluationException {
    Graph graph = new GraphImpl();
    DAWGTestResultSetWriter writer = new DAWGTestResultSetWriter(new StatementCollector(graph));
    try {
        writer.startQueryResult(tqr.getBindingNames());
        while (tqr.hasNext()) {
            writer.handleSolution(tqr.next());
        }
        writer.endQueryResult();
    } catch (TupleQueryResultHandlerException e) {
        // StatementCollector, foud a bug?
        throw new RuntimeException(e);
    }
    return graph;
}
Also used : Graph(org.eclipse.rdf4j.model.Graph) TupleQueryResultHandlerException(org.eclipse.rdf4j.query.TupleQueryResultHandlerException) GraphImpl(org.eclipse.rdf4j.model.impl.GraphImpl) StatementCollector(org.eclipse.rdf4j.rio.helpers.StatementCollector)

Aggregations

Graph (org.eclipse.rdf4j.model.Graph)1 GraphImpl (org.eclipse.rdf4j.model.impl.GraphImpl)1 TupleQueryResultHandlerException (org.eclipse.rdf4j.query.TupleQueryResultHandlerException)1 StatementCollector (org.eclipse.rdf4j.rio.helpers.StatementCollector)1