org.openrdf.query
Class QueryResultUtil

java.lang.Object
  extended by org.openrdf.query.QueryResultUtil

public class QueryResultUtil
extends Object

Class offering utility methods related to query results.

Author:
Arjohn Kampman

Constructor Summary
QueryResultUtil()
           
 
Method Summary
static boolean bindingSetsCompatible(BindingSet bs1, BindingSet bs2)
          Check whether two BindingSets are compatible.
static boolean equals(GraphQueryResult result1, GraphQueryResult result2)
           
static boolean equals(TupleQueryResult tqr1, TupleQueryResult tqr2)
          Compares the two query results by converting them to graphs and returns true if they are equal.
static boolean isSubset(TupleQueryResult tqr1, TupleQueryResult tqr2)
           
static void report(GraphQueryResult gqr, RDFHandler rdfHandler)
          Reports a graph query result to an RDFHandler.
static void report(TupleQueryResult tqr, TupleQueryResultHandler handler)
          Reports a tuple query result to a TupleQueryResultHandler.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

QueryResultUtil

public QueryResultUtil()
Method Detail

report

public static void report(TupleQueryResult tqr,
                          TupleQueryResultHandler handler)
                   throws TupleQueryResultHandlerException,
                          QueryEvaluationException
Reports a tuple query result to a TupleQueryResultHandler.

Parameters:
tqr - The query result to report.
handler - The handler to report the query result to.
Throws:
TupleQueryResultHandlerException - If such an exception is thrown by the used query result writer.
QueryEvaluationException

report

public static void report(GraphQueryResult gqr,
                          RDFHandler rdfHandler)
                   throws RDFHandlerException,
                          QueryEvaluationException
Reports a graph query result to an RDFHandler.

Parameters:
gqr - The query result to report.
rdfHandler - The handler to report the query result to.
Throws:
RDFHandlerException - If such an exception is thrown by the used RDF writer.
QueryEvaluationException

equals

public static boolean equals(TupleQueryResult tqr1,
                             TupleQueryResult tqr2)
                      throws QueryEvaluationException
Compares the two query results by converting them to graphs and returns true if they are equal. QueryResults are equal if they contain the same set of BindingSet and have the headers. Blank nodes identifiers are not relevant for equality, they are mapped from one model to the other by using the attached properties. Note that the method consumes both query results fully.

Throws:
QueryEvaluationException

isSubset

public static boolean isSubset(TupleQueryResult tqr1,
                               TupleQueryResult tqr2)
                        throws QueryEvaluationException
Throws:
QueryEvaluationException

equals

public static boolean equals(GraphQueryResult result1,
                             GraphQueryResult result2)
                      throws QueryEvaluationException
Throws:
QueryEvaluationException

bindingSetsCompatible

public static boolean bindingSetsCompatible(BindingSet bs1,
                                            BindingSet bs2)
Check whether two BindingSets are compatible. Two binding sets are compatible if they have equal values for each binding name that occurs in both binding sets.



Copyright © 2001-2009 Aduna. All Rights Reserved.