com.hp.hpl.jena.query
Class ResultSetFactory

java.lang.Object
  extended by com.hp.hpl.jena.query.ResultSetFactory

public class ResultSetFactory
extends Object

ResultSetFactory - make result sets from places other than a query.


Constructor Summary
ResultSetFactory()
           
 
Method Summary
static ResultSetRewindable copyResults(ResultSet results)
          Take a copy of a result set - the result set returns is an in-memory copy.
static ResultSet create(QueryIterator queryIterator, List<String> vars)
          Build a result set from one of ARQ's lower level query iterator.
static ResultSet fromJSON(InputStream in)
          Read from an input stream which is the format of the SPARQL result set format in JSON.
static ResultSet fromRDF(com.hp.hpl.jena.rdf.model.Model model)
          Turns an RDF model, with properties and classses from the result set vocabulary, into a SPARQL result set.
static ResultSet fromSSE(InputStream in)
          Read from an input stream which is the format of the SPARQL result set format in SSE.
static ResultSet fromTSV(InputStream in)
          Read from an input stream which is the format of the SPARQL result set format in TSV.
static ResultSet fromXML(InputStream in)
          Read XML which is the format of the SPARQL result set format.
static ResultSet fromXML(String str)
          Read XML which is the format of the SPARQL result set format.
static ResultSet load(InputStream input, ResultsFormat format)
          Load a result set from input stream into a result set (memory backed).
static ResultSet load(String filenameOrURI)
          Load a result set from file or URL into a result set (memory backed).
static ResultSet load(String filenameOrURI, ResultsFormat format)
          Load a result set from file or URL into a result set (memory backed).
static com.hp.hpl.jena.rdf.model.Model loadAsModel(com.hp.hpl.jena.rdf.model.Model model, String filenameOrURI)
          Load a result set (or any other model) from file or URL
static com.hp.hpl.jena.rdf.model.Model loadAsModel(com.hp.hpl.jena.rdf.model.Model model, String filenameOrURI, ResultsFormat format)
          Load a result set (or any other model) from file or URL.
static com.hp.hpl.jena.rdf.model.Model loadAsModel(String filenameOrURI)
          Load a result set (or any other model) from file or URL
static com.hp.hpl.jena.rdf.model.Model loadAsModel(String filenameOrURI, ResultsFormat format)
          Load a result set (or any other model) from file or URL
static ResultSet makeResults(com.hp.hpl.jena.rdf.model.Model model)
          Turns an RDF model, with properties and classses from the result set vocabulary, into a SPARQL result set.
static ResultSetRewindable makeRewindable(com.hp.hpl.jena.rdf.model.Model model)
          Turns an RDF model, with properties and classses from the result set vocabulary, into a SPARQL result set which is rewindable (has a .reset()operation).
static ResultSetRewindable makeRewindable(ResultSet resultSet)
          Turn an existing result set into a rewindable one.
static ResultSet makeSorted(ResultSet resultSet, List<SortCondition> conditions)
          Sort an existing result set.
static SPARQLResult result(String filenameOrURI)
          Read in any kind of result kind (result set, boolean, graph) Guess the syntax based on filename/URL extension.
static SPARQLResult result(String filenameOrURI, ResultsFormat format)
          Read in any kind of result kind (result set, boolean, graph)
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ResultSetFactory

public ResultSetFactory()
Method Detail

load

public static ResultSet load(String filenameOrURI)
Load a result set from file or URL into a result set (memory backed).

Parameters:
filenameOrURI -
Returns:
ResultSet

load

public static ResultSet load(String filenameOrURI,
                             ResultsFormat format)
Load a result set from file or URL into a result set (memory backed).

Parameters:
filenameOrURI -
format -
Returns:
ResultSet

load

public static ResultSet load(InputStream input,
                             ResultsFormat format)
Load a result set from input stream into a result set (memory backed).

Parameters:
input -
format -
Returns:
ResultSet

loadAsModel

public static com.hp.hpl.jena.rdf.model.Model loadAsModel(String filenameOrURI)
Load a result set (or any other model) from file or URL

Parameters:
filenameOrURI -
Returns:
Model

loadAsModel

public static com.hp.hpl.jena.rdf.model.Model loadAsModel(com.hp.hpl.jena.rdf.model.Model model,
                                                          String filenameOrURI)
Load a result set (or any other model) from file or URL

Parameters:
model - Load into this model (returned)
filenameOrURI -
Returns:
Model

loadAsModel

public static com.hp.hpl.jena.rdf.model.Model loadAsModel(String filenameOrURI,
                                                          ResultsFormat format)
Load a result set (or any other model) from file or URL

Parameters:
filenameOrURI -
format -
Returns:
Model

loadAsModel

public static com.hp.hpl.jena.rdf.model.Model loadAsModel(com.hp.hpl.jena.rdf.model.Model model,
                                                          String filenameOrURI,
                                                          ResultsFormat format)
Load a result set (or any other model) from file or URL. Does not have to be a result set (e.g. CONSTRUCt results) but it does interpret the ResultSetFormat possibilities.

Parameters:
model - Load into this model (returned)
filenameOrURI -
format -
Returns:
Model

result

public static SPARQLResult result(String filenameOrURI)
Read in any kind of result kind (result set, boolean, graph) Guess the syntax based on filename/URL extension.


result

public static SPARQLResult result(String filenameOrURI,
                                  ResultsFormat format)
Read in any kind of result kind (result set, boolean, graph)


fromXML

public static ResultSet fromXML(InputStream in)
Read XML which is the format of the SPARQL result set format.

Parameters:
in - InputStream
Returns:
ResultSet

fromXML

public static ResultSet fromXML(String str)
Read XML which is the format of the SPARQL result set format.

Parameters:
str - String to process
Returns:
ResultSet

fromRDF

public static ResultSet fromRDF(com.hp.hpl.jena.rdf.model.Model model)
Turns an RDF model, with properties and classses from the result set vocabulary, into a SPARQL result set. The result set formed is a copy in memory.

Parameters:
model -
Returns:
ResultSet

fromJSON

public static ResultSet fromJSON(InputStream in)
Read from an input stream which is the format of the SPARQL result set format in JSON.

Parameters:
in - InputStream
Returns:
ResultSet

fromTSV

public static ResultSet fromTSV(InputStream in)
Read from an input stream which is the format of the SPARQL result set format in TSV.

Parameters:
in - InputStream
Returns:
ResultSet

fromSSE

public static ResultSet fromSSE(InputStream in)
Read from an input stream which is the format of the SPARQL result set format in SSE.

Parameters:
in - InputStream
Returns:
ResultSet

makeResults

public static ResultSet makeResults(com.hp.hpl.jena.rdf.model.Model model)
Turns an RDF model, with properties and classses from the result set vocabulary, into a SPARQL result set. The result set formed is a copy in memory.

Parameters:
model -
Returns:
ResultSet

makeRewindable

public static ResultSetRewindable makeRewindable(com.hp.hpl.jena.rdf.model.Model model)
Turns an RDF model, with properties and classses from the result set vocabulary, into a SPARQL result set which is rewindable (has a .reset()operation). The result set formed is a copy in memory.

Parameters:
model -
Returns:
ResultSetRewindable

makeRewindable

public static ResultSetRewindable makeRewindable(ResultSet resultSet)
Turn an existing result set into a rewindable one. May take a copy - uses up the result set passed in.

Parameters:
resultSet -
Returns:
ResultSetRewindable

makeSorted

public static ResultSet makeSorted(ResultSet resultSet,
                                   List<SortCondition> conditions)
Sort an existing result set. Experimental. The list of variables is a list of names (strings), with "x" for ascending in variable "x" and "-x" for descending in variable "x"

Parameters:
resultSet -
conditions -
Returns:
ResultSet

copyResults

public static ResultSetRewindable copyResults(ResultSet results)
Take a copy of a result set - the result set returns is an in-memory copy. It is not attached to the original query execution object which can be closed.

Parameters:
results -
Returns:
ResultSet

create

public static ResultSet create(QueryIterator queryIterator,
                               List<String> vars)
Build a result set from one of ARQ's lower level query iterator.

Parameters:
queryIterator -
vars - List of variables, by name, for the result set
Returns:
ResultSet


Licenced under the Apache License, Version 2.0