org.trippi.impl.base
Class SynchronizedTriplestoreReader

java.lang.Object
  extended by org.trippi.impl.base.SynchronizedTriplestoreReader
All Implemented Interfaces:
TriplestoreReader
Direct Known Subclasses:
SynchronizedTriplestoreWriter

public class SynchronizedTriplestoreReader
extends java.lang.Object
implements TriplestoreReader

A TriplestoreReader that provides synchronized read access to a triplestore by means of a SynchronizedTriplestoreSession.

Author:
cwilper@cs.cornell.edu

Constructor Summary
SynchronizedTriplestoreReader(SynchronizedTriplestoreSession session, AliasManager aliasManager)
          Constructor.
 
Method Summary
 void close()
          Close the reader, releasing any resources.
 int countTriples(java.lang.String queryLang, java.lang.String tripleQuery, 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.
 void finalize()
          Ensure close() gets called at garbage collection time.
 TripleIterator findTriples(java.lang.String queryLang, java.lang.String tripleQuery, int limit, boolean distinct)
          Delegates to underlying session for non-basic queries.
 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 aliasMap)
          Set the default alias map for queries.
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SynchronizedTriplestoreReader

public SynchronizedTriplestoreReader(SynchronizedTriplestoreSession session,
                                     AliasManager aliasManager)
Constructor.

Parameters:
session - the session to use for reading.
Method Detail

getAliasMap

public java.util.Map getAliasMap()
Description copied from interface: TriplestoreReader
Get the default alias map for queries.

Specified by:
getAliasMap in interface TriplestoreReader

setAliasMap

public void setAliasMap(java.util.Map aliasMap)
Description copied from interface: TriplestoreReader
Set the default alias map for queries.

Specified by:
setAliasMap in interface TriplestoreReader

listTupleLanguages

public java.lang.String[] listTupleLanguages()
Description copied from interface: TriplestoreReader
List the supported query languages that return tuples.

Specified by:
listTupleLanguages in interface TriplestoreReader

listTripleLanguages

public java.lang.String[] listTripleLanguages()
Description copied from interface: TriplestoreReader
List the supported query languages that return triples.

Specified by:
listTripleLanguages in interface TriplestoreReader

countTuples

public int countTuples(java.lang.String queryLang,
                       java.lang.String tupleQuery,
                       int limit,
                       boolean distinct)
                throws TrippiException
Description copied from interface: TriplestoreReader
Get the number of tuples that would be returned via findTuples.

Specified by:
countTuples in interface TriplestoreReader
Throws:
TrippiException

findTuples

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

Specified by:
findTuples in interface TriplestoreReader
Parameters:
queryLang - the query language
tupleQuery - the text of the query
Throws:
TrippiException

countTriples

public int countTriples(java.lang.String queryLang,
                        java.lang.String tripleQuery,
                        int limit,
                        boolean distinct)
                 throws TrippiException
Description copied from interface: TriplestoreReader
Get the number of triples that would be returned via findTriples.

Specified by:
countTriples in interface TriplestoreReader
Throws:
TrippiException

findTriples

public TripleIterator findTriples(java.lang.String queryLang,
                                  java.lang.String tripleQuery,
                                  int limit,
                                  boolean distinct)
                           throws TrippiException
Delegates to underlying session for non-basic queries.

Specified by:
findTriples in interface TriplestoreReader
Parameters:
queryLang - the query language
tripleQuery - the text of the query
Throws:
TrippiException

countTriples

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

Specified by:
countTriples in interface TriplestoreReader
Throws:
TrippiException

findTriples

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

Specified by:
findTriples in interface TriplestoreReader
Throws:
TrippiException

countTriples

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

Specified by:
countTriples in interface TriplestoreReader
Throws:
TrippiException

findTriples

public TripleIterator findTriples(java.lang.String queryLang,
                                  java.lang.String tupleQuery,
                                  java.lang.String tripleTemplate,
                                  int limit,
                                  boolean distinct)
                           throws TrippiException
Description copied from interface: TriplestoreReader
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.

Specified by:
findTriples in interface TriplestoreReader
Parameters:
queryLang - the query language
tupleQuery - the text of the query
tripleTemplate - the template used to construct the triples
Throws:
TrippiException
See Also:
TriplePattern

close

public void close()
           throws TrippiException
Description copied from interface: TriplestoreReader
Close the reader, releasing any resources.

Specified by:
close in interface TriplestoreReader
Throws:
TrippiException

finalize

public void finalize()
              throws TrippiException
Ensure close() gets called at garbage collection time.

Overrides:
finalize in class java.lang.Object
Throws:
TrippiException