Protégé-OWL 3.4.8

edu.stanford.smi.protegex.owl.model.query
Class SPARQLQueryResults

java.lang.Object
  extended by edu.stanford.smi.protegex.owl.model.query.SPARQLQueryResults
All Implemented Interfaces:
QueryResults

public class SPARQLQueryResults
extends Object
implements QueryResults

Author:
Holger Knublauch

Constructor Summary
SPARQLQueryResults(OWLModel owlModel, com.hp.hpl.jena.query.Query query, com.hp.hpl.jena.query.ResultSet results)
           
 
Method Summary
static SPARQLQueryResults create(OWLModel owlModel, String queryString)
          Creates QueryResults from a given query string (which should already include prefix declarations).
static String createPrefixDeclarations(OWLModel owlModel)
          Creates the SPARQL PREFIX and BASE declarations for a given OWLModel.
 List getVariables()
          Gets a list of all variables that have been declared in the query.
 boolean hasNext()
          Checks if there are more results available.
 Map next()
          Gets the next results, where each result is a Map from variables to bindings.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SPARQLQueryResults

public SPARQLQueryResults(OWLModel owlModel,
                          com.hp.hpl.jena.query.Query query,
                          com.hp.hpl.jena.query.ResultSet results)
Method Detail

create

public static SPARQLQueryResults create(OWLModel owlModel,
                                        String queryString)
                                 throws Exception
Creates QueryResults from a given query string (which should already include prefix declarations).

Parameters:
owlModel - the OWLModel to operate on
queryString - a string in the SPARQL query language syntax (SELECT...)
Returns:
a new QueryResults object or an Exception if the query could not be handled
Throws:
Exception

createPrefixDeclarations

public static String createPrefixDeclarations(OWLModel owlModel)
Creates the SPARQL PREFIX and BASE declarations for a given OWLModel. This string can be used to start a new query.

Parameters:
owlModel - the OWLModel to get the prefixes of
Returns:
a prefix declaration string

getVariables

public List getVariables()
Description copied from interface: QueryResults
Gets a list of all variables that have been declared in the query. The variables are the keys in the Maps returned by the next() method.

Specified by:
getVariables in interface QueryResults
Returns:
a List of Objects (e.g. Strings)
See Also:
QueryResults.next()

hasNext

public boolean hasNext()
Description copied from interface: QueryResults
Checks if there are more results available.

Specified by:
hasNext in interface QueryResults
Returns:
true if there are more results

next

public Map next()
Description copied from interface: QueryResults
Gets the next results, where each result is a Map from variables to bindings. This method can only be called as long as hasNext() delivers true.

Specified by:
next in interface QueryResults
Returns:
a Map (keys are the members of the getVariables() call).
See Also:
QueryResults.getVariables()

Protégé-OWL 3.4.8

Submit a bug report or feature request
Copyright (c) 1998-2012 Stanford University.