org.ontoware.rdf2go.model
Interface Sparqlable

All Known Subinterfaces:
Model, ModelSet, QueryableModel

public interface Sparqlable

Interface for SPARQL and other query languages.

Author:
voelkel

Method Summary
 ClosableIterable<Statement> queryConstruct(java.lang.String query, java.lang.String querylanguage)
           
 QueryResultTable querySelect(java.lang.String query, java.lang.String querylanguage)
          returns results for queries in other query languages as a QueryResultTable as supported by underlying implementation.
 boolean sparqlAsk(java.lang.String query)
          SPARQL ask queries
 ClosableIterable<Statement> sparqlConstruct(java.lang.String query)
           
 ClosableIterable<Statement> sparqlDescribe(java.lang.String query)
          Iterator must be auto-close, i.e. when last element is fetched, the implementation must call close().
 QueryResultTable sparqlSelect(java.lang.String queryString)
          returns results for SPARQL Select queries, as supported by underlying implementation.
 

Method Detail

sparqlSelect

QueryResultTable sparqlSelect(java.lang.String queryString)
                              throws MalformedQueryException,
                                     ModelRuntimeException
returns results for SPARQL Select queries, as supported by underlying implementation. For some implementations (Sesame) it is urgently necessary to iterate over all statements of the returned iterator in order to close resources properly. Iterator must be auto-close, i.e. when last element is fetched, the implementation must call close().

Parameters:
queryString - The SPARQL select query string
Returns:
a QueryResultTable
Throws:
ModelRuntimeException - if an error happens when executing the query
MalformedQueryException - if the query is not a valid SPARQL SELECT query

querySelect

QueryResultTable querySelect(java.lang.String query,
                             java.lang.String querylanguage)
                             throws QueryLanguageNotSupportedException,
                                    MalformedQueryException,
                                    ModelRuntimeException
returns results for queries in other query languages as a QueryResultTable as supported by underlying implementation. For some implementations (Sesame) it is urgently necessary to iterate over all statements of the returned iterator in order to close resources properly. Iterator must be auto-close, i.e. when last element is fetched, the implementation must call close().

Parameters:
queryString - The select query string
Returns:
a QueryResultTable
Throws:
ModelRuntimeException - if the execution throws an exception
QueryLanguageNotSupportedException - if the given query langauge is not supported
MalformedQueryException - if the query is not a valid query in the given query language

sparqlConstruct

ClosableIterable<Statement> sparqlConstruct(java.lang.String query)
                                            throws ModelRuntimeException,
                                                   MalformedQueryException
Returns:
results for SPARQL Construct queries, as supported by underlying implementation. Iterator is auto-close, i.e. when last element is fetched, the implementation must call close().
Throws:
ModelRuntimeException - if the execution throws an exception
MalformedQueryException - if the query is not a valid SPARQL CONSTRUCT query

queryConstruct

ClosableIterable<Statement> queryConstruct(java.lang.String query,
                                           java.lang.String querylanguage)
                                           throws QueryLanguageNotSupportedException,
                                                  MalformedQueryException,
                                                  ModelRuntimeException
Parameters:
query -
querylanguage -
Returns:
results for other construct-like queries, as supported by underlying implementation. Iterator is auto-close, i.e. when last element is fetched, the implementation must call close().
Throws:
ModelRuntimeException - if the execution throws an exception
QueryLanguageNotSupportedException - if the adapter can't understand the given query language
MalformedQueryException - if the query is not a valid construct query in the given query language

sparqlAsk

boolean sparqlAsk(java.lang.String query)
                  throws ModelRuntimeException,
                         MalformedQueryException
SPARQL ask queries

Parameters:
query - a SPARQL AKS query
Returns:
the query result as true or false
Throws:
ModelRuntimeException - if the execution throws an exception
MalformedQueryException - if the query is not a valid SPARQL ASK query

sparqlDescribe

ClosableIterable<Statement> sparqlDescribe(java.lang.String query)
                                           throws ModelRuntimeException
Iterator must be auto-close, i.e. when last element is fetched, the implementation must call close(). This means a regular user can call this method without calling close(), if all elements are consumed.

Parameters:
query -
Returns:
a ClosableIterable over all statements returned by this query
Throws:
ModelRuntimeException - if the execution throws an exception
MalformedQueryException - if the query is not a valid SPARQL DESCRIBE query


Copyright © 2005-2008 FZI - Forschungszentrum Informatik | Karlsruhe | Germany. All Rights Reserved.