org.trippi
Interface TriplestoreReader

All Known Subinterfaces:
TriplestoreWriter
All Known Implementing Classes:
ConcurrentTriplestoreReader, ConcurrentTriplestoreWriter, SynchronizedTriplestoreReader, SynchronizedTriplestoreWriter

public interface TriplestoreReader

An interface to an RDF store that provides query and dump access.

Author:
cwilper@cs.cornell.edu

Method Summary
 void close()
          Close the reader, releasing any resources.
 int countTriples(java.lang.String queryLang, java.lang.String tupleQuery, int limit, boolean distinct)
          Get the number of triples that would be returned via findTriples.
 int countTriples(java.lang.String queryLang, java.lang.String tupleQuery, java.lang.String tripleTemplate, int limit, boolean distinct)
          Get the number of triples that would be returned via findTriples.
 int countTriples(org.jrdf.graph.SubjectNode subject, org.jrdf.graph.PredicateNode predicate, org.jrdf.graph.ObjectNode object, int limit)
          Get the number of triples that would be returned via findTriples.
 int countTuples(java.lang.String queryLang, java.lang.String tupleQuery, int limit, boolean distinct)
          Get the number of tuples that would be returned via findTuples.
 TripleIterator findTriples(java.lang.String queryLang, java.lang.String tupleQuery, int limit, boolean distinct)
          Perform a triple query on the store in a specific language.
 TripleIterator findTriples(java.lang.String queryLang, java.lang.String tupleQuery, java.lang.String tripleTemplate, int limit, boolean distinct)
          Perform a tuple query on the store and return an iterator over the triples generated by applying the given triple template to the tuples.
 TripleIterator findTriples(org.jrdf.graph.SubjectNode subject, org.jrdf.graph.PredicateNode predicate, org.jrdf.graph.ObjectNode object, int limit)
          Perform a triple query on the store given a triple pattern where null means "any".
 TupleIterator findTuples(java.lang.String queryLang, java.lang.String tupleQuery, int limit, boolean distinct)
          Perform a tuple query on the store and return an iterator over the tuples.
 java.util.Map getAliasMap()
          Get the default alias map for queries.
 java.lang.String[] listTripleLanguages()
          List the supported query languages that return triples.
 java.lang.String[] listTupleLanguages()
          List the supported query languages that return tuples.
 void setAliasMap(java.util.Map aliasToPrefix)
          Set the default alias map for queries.
 

Method Detail

setAliasMap

void setAliasMap(java.util.Map aliasToPrefix)
                 throws TrippiException
Set the default alias map for queries.

Throws:
TrippiException

getAliasMap

java.util.Map getAliasMap()
                          throws TrippiException
Get the default alias map for queries.

Throws:
TrippiException

findTuples

TupleIterator findTuples(java.lang.String queryLang,
                         java.lang.String tupleQuery,
                         int limit,
                         boolean distinct)
                         throws TrippiException
Perform a tuple query on the store and return an iterator over the tuples.

Parameters:
queryLang - the query language
tupleQuery - the text of the query
Throws:
TrippiException

countTuples

int countTuples(java.lang.String queryLang,
                java.lang.String tupleQuery,
                int limit,
                boolean distinct)
                throws TrippiException
Get the number of tuples that would be returned via findTuples.

Throws:
TrippiException

findTriples

TripleIterator findTriples(java.lang.String queryLang,
                           java.lang.String tupleQuery,
                           int limit,
                           boolean distinct)
                           throws TrippiException
Perform a triple query on the store in a specific language.

Implementations must support the "spo" query language, where a query consists of a single triple pattern with any number of components unspecified, as indicated by an asterisk.

The following example calls demonstrate the syntax of the "spo" query language.

     // Match with three fixed values
     findTriples("spo", "<urn:uri1> <urn:uri2> <urn:uri3>");
     findTriples("spo", "<urn:uri1> <urn:uri2> 'Hello'");
     findTriples("spo", "<urn:uri1> <urn:uri2> 'Hola'@es");
     findTriples("spo", "<urn:uri1> <urn:uri2> '10'^^xsd:int");

     // Match with one fixed value
     findTriples("spo", "<urn:uri1> * *");
     findTriples("spo", "* <urn:uri2> *");
     findTriples("spo", "* * <urn:uri3>");

     // Match with two fixed values
     findTriples("spo", "* <urn:uri2> <urn:uri3>");
     findTriples("spo", "<urn:uri1> * <urn:uri3>");
     findTriples("spo", "<urn:uri1> <urn:uri2> *");

     // Match everything
     findTriples("spo", "* * *");
 

Parameters:
queryLang - the query language
tupleQuery - the text of the query
Throws:
TrippiException

countTriples

int countTriples(java.lang.String queryLang,
                 java.lang.String tupleQuery,
                 int limit,
                 boolean distinct)
                 throws TrippiException
Get the number of triples that would be returned via findTriples.

Throws:
TrippiException

findTriples

TripleIterator findTriples(org.jrdf.graph.SubjectNode subject,
                           org.jrdf.graph.PredicateNode predicate,
                           org.jrdf.graph.ObjectNode object,
                           int limit)
                           throws TrippiException
Perform a triple query on the store given a triple pattern where null means "any".

Throws:
TrippiException

countTriples

int countTriples(org.jrdf.graph.SubjectNode subject,
                 org.jrdf.graph.PredicateNode predicate,
                 org.jrdf.graph.ObjectNode object,
                 int limit)
                 throws TrippiException
Get the number of triples that would be returned via findTriples.

Throws:
TrippiException

findTriples

TripleIterator findTriples(java.lang.String queryLang,
                           java.lang.String tupleQuery,
                           java.lang.String tripleTemplate,
                           int limit,
                           boolean distinct)
                           throws TrippiException
Perform a tuple query on the store and return an iterator over the triples generated by applying the given triple template to the tuples.

A triple template is a series of triple patterns used to generate a graph from a group of tuples. See the TriplePattern documentation for more detail.

Parameters:
queryLang - the query language
tupleQuery - the text of the query
tripleTemplate - the template used to construct the triples
Throws:
TrippiException
See Also:
TriplePattern

countTriples

int countTriples(java.lang.String queryLang,
                 java.lang.String tupleQuery,
                 java.lang.String tripleTemplate,
                 int limit,
                 boolean distinct)
                 throws TrippiException
Get the number of triples that would be returned via findTriples.

Throws:
TrippiException

listTupleLanguages

java.lang.String[] listTupleLanguages()
List the supported query languages that return tuples.


listTripleLanguages

java.lang.String[] listTripleLanguages()
List the supported query languages that return triples.


close

void close()
           throws TrippiException
Close the reader, releasing any resources.

Throws:
TrippiException