org.trippi.impl.base
Class SynchronizedTriplestoreSession

java.lang.Object
  extended by org.trippi.impl.base.SynchronizedTriplestoreSession
All Implemented Interfaces:
TriplestoreSession

public class SynchronizedTriplestoreSession
extends java.lang.Object
implements TriplestoreSession

A synchronized read/write session to an RDF database. If a session doesn't support writes, the add and delete methods will throw UnsupportedOperationException (an unchecked exception).

Author:
cwilper@cs.cornell.edu

Constructor Summary
SynchronizedTriplestoreSession(TriplestoreSession session)
           
 
Method Summary
 void add(java.util.Set triples)
          Add the given triples to the store.
 void close()
          Wait in line
 void delete(java.util.Set triples)
          Delete the given triples from the store.
 TripleIterator findTriples(java.lang.String lang, java.lang.String queryText)
           
 TripleIterator findTriples(org.jrdf.graph.SubjectNode subject, org.jrdf.graph.PredicateNode predicate, org.jrdf.graph.ObjectNode object)
           
 java.lang.String[] listTripleLanguages()
           
 java.lang.String[] listTupleLanguages()
           
 TupleIterator query(java.lang.String queryText, java.lang.String language)
          Perform a tuple query against the store.
 void releaseLock()
          If the current thread is at position zero, remove it from the queue.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SynchronizedTriplestoreSession

public SynchronizedTriplestoreSession(TriplestoreSession session)
Method Detail

add

public void add(java.util.Set triples)
         throws java.lang.UnsupportedOperationException,
                TrippiException
Description copied from interface: TriplestoreSession
Add the given triples to the store.

Specified by:
add in interface TriplestoreSession
Parameters:
triples - a Set of Triple objects.
Throws:
java.lang.UnsupportedOperationException - if modifications are not supported.
TrippiException - if adding to the store otherwise failed.

delete

public void delete(java.util.Set triples)
            throws java.lang.UnsupportedOperationException,
                   TrippiException
Description copied from interface: TriplestoreSession
Delete the given triples from the store.

Specified by:
delete in interface TriplestoreSession
Parameters:
triples - a Set of Triple objects.
Throws:
java.lang.UnsupportedOperationException - if modifications are not supported.
TrippiException - if deleting from the store failed.

query

public TupleIterator query(java.lang.String queryText,
                           java.lang.String language)
                    throws TrippiException
Description copied from interface: TriplestoreSession
Perform a tuple query against the store.

Specified by:
query in interface TriplestoreSession
Parameters:
queryText - the text of the query
language - the query language
Throws:
TrippiException

findTriples

public TripleIterator findTriples(java.lang.String lang,
                                  java.lang.String queryText)
                           throws TrippiException
Specified by:
findTriples in interface TriplestoreSession
Throws:
TrippiException

findTriples

public TripleIterator findTriples(org.jrdf.graph.SubjectNode subject,
                                  org.jrdf.graph.PredicateNode predicate,
                                  org.jrdf.graph.ObjectNode object)
                           throws TrippiException
Specified by:
findTriples in interface TriplestoreSession
Throws:
TrippiException

listTupleLanguages

public java.lang.String[] listTupleLanguages()
Specified by:
listTupleLanguages in interface TriplestoreSession

listTripleLanguages

public java.lang.String[] listTripleLanguages()
Specified by:
listTripleLanguages in interface TriplestoreSession

close

public void close()
           throws TrippiException
Wait in line

Specified by:
close in interface TriplestoreSession
Throws:
TrippiException

releaseLock

public void releaseLock()
If the current thread is at position zero, remove it from the queue.