org.fcrepo.server.resourceIndex
Class ResourceIndexImpl

java.lang.Object
  extended by org.fcrepo.server.resourceIndex.ResourceIndexImpl
All Implemented Interfaces:
ResourceIndex, org.trippi.TriplestoreReader, org.trippi.TriplestoreWriter

public class ResourceIndexImpl
extends Object
implements ResourceIndex

Implementation of the ResourceIndex.

Author:
Chris Wilper

Field Summary
 
Fields inherited from interface org.fcrepo.server.resourceIndex.ResourceIndex
INDEX_LEVEL_OFF, INDEX_LEVEL_ON
 
Constructor Summary
ResourceIndexImpl(org.trippi.TriplestoreConnector connector, TripleGenerator generator, int indexLevel, boolean syncUpdates)
           
 
Method Summary
 void add(List<org.jrdf.graph.Triple> triples, boolean flush)
          
 void add(org.jrdf.graph.Triple triple, boolean flush)
          
 void add(org.trippi.TripleIterator triples, boolean flush)
          
 void addObject(DOReader reader)
          Adds the appripriate triples implied by the given object to the ResourceIndex.
 void close()
          
 int countTriples(String queryLang, String tripleQuery, int limit, boolean distinct)
          
 int countTriples(String queryLang, String tupleQuery, String tripleTemplate, int limit, boolean distinct)
          
 int countTriples(org.jrdf.graph.SubjectNode subject, org.jrdf.graph.PredicateNode predicate, org.jrdf.graph.ObjectNode object, int limit)
          
 int countTuples(String queryLang, String tupleQuery, int limit, boolean distinct)
          
 void delete(List<org.jrdf.graph.Triple> triples, boolean flush)
          
 void delete(org.jrdf.graph.Triple triple, boolean flush)
          
 void delete(org.trippi.TripleIterator triples, boolean flush)
          
 void deleteObject(DOReader oldReader)
          Removes the triples implied by a given object from the ResourceIndex.
 void export(OutputStream out, org.trippi.RDFFormat format)
          Exports all triples in the RI.
 List<org.trippi.TripleUpdate> findBufferedUpdates(org.jrdf.graph.SubjectNode subject, org.jrdf.graph.PredicateNode predicate, org.jrdf.graph.ObjectNode object, int updateType)
          
 org.trippi.TripleIterator findTriples(String queryLang, String tripleQuery, int limit, boolean distinct)
          
 org.trippi.TripleIterator findTriples(String queryLang, String tupleQuery, String tripleTemplate, int limit, boolean distinct)
          
 org.trippi.TripleIterator findTriples(org.jrdf.graph.SubjectNode subject, org.jrdf.graph.PredicateNode predicate, org.jrdf.graph.ObjectNode object, int limit)
          
 org.trippi.TupleIterator findTuples(String queryLang, String tupleQuery, int limit, boolean distinct)
          
 void flushBuffer()
          
 Map<String,String> getAliasMap()
          
 int getBufferSize()
          
 int getIndexLevel()
          Gets the index level of the ResourceIndex.
 String[] listTripleLanguages()
          
 String[] listTupleLanguages()
          
 void modifyObject(DOReader oldReader, DOReader newReader)
          Updates any appropriate triples implied a modified object.
 void setAliasMap(Map<String,String> aliasToPrefix)
          
 void setFlushErrorHandler(org.trippi.FlushErrorHandler h)
          
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ResourceIndexImpl

public ResourceIndexImpl(org.trippi.TriplestoreConnector connector,
                         TripleGenerator generator,
                         int indexLevel,
                         boolean syncUpdates)
Method Detail

getIndexLevel

public int getIndexLevel()
Gets the index level of the ResourceIndex.

Specified by:
getIndexLevel in interface ResourceIndex
Returns:
the current index level of the RI, which is either INDEX_LEVEL_OFF or INDEX_LEVEL_ON.

addObject

public void addObject(DOReader reader)
               throws ResourceIndexException
Adds the appripriate triples implied by the given object to the ResourceIndex.

Specified by:
addObject in interface ResourceIndex
Parameters:
reader - The given object to index.
Throws:
ResourceIndexException - If the triples can't be added for any reason.

modifyObject

public void modifyObject(DOReader oldReader,
                         DOReader newReader)
                  throws ResourceIndexException
Updates any appropriate triples implied a modified object.

Specified by:
modifyObject in interface ResourceIndex
Parameters:
oldReader - Pre-modification version of the oject.
newReader - Post-modification version of the object.
Throws:
ResourceIndexException - If the triples can't be updated for any reason.

deleteObject

public void deleteObject(DOReader oldReader)
                  throws ResourceIndexException
Removes the triples implied by a given object from the ResourceIndex.

Specified by:
deleteObject in interface ResourceIndex
Parameters:
oldReader - Object whose triples shall be removed from the index.
Throws:
ResourceIndexException - If the triples can't be removed for any reason.

export

public void export(OutputStream out,
                   org.trippi.RDFFormat format)
            throws ResourceIndexException
Exports all triples in the RI.

Specified by:
export in interface ResourceIndex
Parameters:
out - the output stream to which the RDF should be written. The caller is responsible for eventually closing this stream.
format - the output format (RDF_XML, TURTLE, N_TRIPLESs, etc).
Throws:
ResourceIndexException - if triples in the RI cannot be serialized for any reason.

setAliasMap

public void setAliasMap(Map<String,String> aliasToPrefix)
                 throws org.trippi.TrippiException

Specified by:
setAliasMap in interface org.trippi.TriplestoreReader
Throws:
org.trippi.TrippiException

getAliasMap

public Map<String,String> getAliasMap()
                               throws org.trippi.TrippiException

Specified by:
getAliasMap in interface org.trippi.TriplestoreReader
Throws:
org.trippi.TrippiException

findTuples

public org.trippi.TupleIterator findTuples(String queryLang,
                                           String tupleQuery,
                                           int limit,
                                           boolean distinct)
                                    throws org.trippi.TrippiException

Specified by:
findTuples in interface org.trippi.TriplestoreReader
Throws:
org.trippi.TrippiException

countTuples

public int countTuples(String queryLang,
                       String tupleQuery,
                       int limit,
                       boolean distinct)
                throws org.trippi.TrippiException

Specified by:
countTuples in interface org.trippi.TriplestoreReader
Throws:
org.trippi.TrippiException

findTriples

public org.trippi.TripleIterator findTriples(String queryLang,
                                             String tripleQuery,
                                             int limit,
                                             boolean distinct)
                                      throws org.trippi.TrippiException

Specified by:
findTriples in interface org.trippi.TriplestoreReader
Throws:
org.trippi.TrippiException

countTriples

public int countTriples(String queryLang,
                        String tripleQuery,
                        int limit,
                        boolean distinct)
                 throws org.trippi.TrippiException

Specified by:
countTriples in interface org.trippi.TriplestoreReader
Throws:
org.trippi.TrippiException

findTriples

public org.trippi.TripleIterator findTriples(org.jrdf.graph.SubjectNode subject,
                                             org.jrdf.graph.PredicateNode predicate,
                                             org.jrdf.graph.ObjectNode object,
                                             int limit)
                                      throws org.trippi.TrippiException

Specified by:
findTriples in interface org.trippi.TriplestoreReader
Throws:
org.trippi.TrippiException

countTriples

public int countTriples(org.jrdf.graph.SubjectNode subject,
                        org.jrdf.graph.PredicateNode predicate,
                        org.jrdf.graph.ObjectNode object,
                        int limit)
                 throws org.trippi.TrippiException

Specified by:
countTriples in interface org.trippi.TriplestoreReader
Throws:
org.trippi.TrippiException

findTriples

public org.trippi.TripleIterator findTriples(String queryLang,
                                             String tupleQuery,
                                             String tripleTemplate,
                                             int limit,
                                             boolean distinct)
                                      throws org.trippi.TrippiException

Specified by:
findTriples in interface org.trippi.TriplestoreReader
Throws:
org.trippi.TrippiException

countTriples

public int countTriples(String queryLang,
                        String tupleQuery,
                        String tripleTemplate,
                        int limit,
                        boolean distinct)
                 throws org.trippi.TrippiException

Specified by:
countTriples in interface org.trippi.TriplestoreReader
Throws:
org.trippi.TrippiException

listTupleLanguages

public String[] listTupleLanguages()

Specified by:
listTupleLanguages in interface org.trippi.TriplestoreReader

listTripleLanguages

public String[] listTripleLanguages()

Specified by:
listTripleLanguages in interface org.trippi.TriplestoreReader

close

public void close()
           throws org.trippi.TrippiException

Specified by:
close in interface org.trippi.TriplestoreReader
Throws:
org.trippi.TrippiException

add

public void add(List<org.jrdf.graph.Triple> triples,
                boolean flush)
         throws IOException,
                org.trippi.TrippiException

Specified by:
add in interface org.trippi.TriplestoreWriter
Throws:
IOException
org.trippi.TrippiException

add

public void add(org.trippi.TripleIterator triples,
                boolean flush)
         throws IOException,
                org.trippi.TrippiException

Specified by:
add in interface org.trippi.TriplestoreWriter
Throws:
IOException
org.trippi.TrippiException

add

public void add(org.jrdf.graph.Triple triple,
                boolean flush)
         throws IOException,
                org.trippi.TrippiException

Specified by:
add in interface org.trippi.TriplestoreWriter
Throws:
IOException
org.trippi.TrippiException

delete

public void delete(List<org.jrdf.graph.Triple> triples,
                   boolean flush)
            throws IOException,
                   org.trippi.TrippiException

Specified by:
delete in interface org.trippi.TriplestoreWriter
Throws:
IOException
org.trippi.TrippiException

delete

public void delete(org.trippi.TripleIterator triples,
                   boolean flush)
            throws IOException,
                   org.trippi.TrippiException

Specified by:
delete in interface org.trippi.TriplestoreWriter
Throws:
IOException
org.trippi.TrippiException

delete

public void delete(org.jrdf.graph.Triple triple,
                   boolean flush)
            throws IOException,
                   org.trippi.TrippiException

Specified by:
delete in interface org.trippi.TriplestoreWriter
Throws:
IOException
org.trippi.TrippiException

flushBuffer

public void flushBuffer()
                 throws IOException,
                        org.trippi.TrippiException

Specified by:
flushBuffer in interface org.trippi.TriplestoreWriter
Throws:
IOException
org.trippi.TrippiException

setFlushErrorHandler

public void setFlushErrorHandler(org.trippi.FlushErrorHandler h)

Specified by:
setFlushErrorHandler in interface org.trippi.TriplestoreWriter

getBufferSize

public int getBufferSize()

Specified by:
getBufferSize in interface org.trippi.TriplestoreWriter

findBufferedUpdates

public List<org.trippi.TripleUpdate> findBufferedUpdates(org.jrdf.graph.SubjectNode subject,
                                                         org.jrdf.graph.PredicateNode predicate,
                                                         org.jrdf.graph.ObjectNode object,
                                                         int updateType)

Specified by:
findBufferedUpdates in interface org.trippi.TriplestoreWriter


Copyright © 2011 DuraSpace. All Rights Reserved.