edu.utdallas.paged.mem.util
Class PagedNTripleWriter

java.lang.Object
  extended by com.hp.hpl.jena.rdf.model.impl.NTripleWriter
      extended by edu.utdallas.paged.mem.util.PagedNTripleWriter
All Implemented Interfaces:
com.hp.hpl.jena.rdf.model.RDFWriter

public class PagedNTripleWriter
extends com.hp.hpl.jena.rdf.model.impl.NTripleWriter

A class that is used to convert a Triple stored in memory into a N-Triple that is stored in the Lucene indices

Author:
vaibhav

Field Summary
static long oid
          A static variable that determines the position of a Node in the object Lucene index
static long pid
          A static variable that determines the position of a Node in the predicate Lucene index
static long sid
          A static variable that determines the position of a Node in the subject Lucene index
 
Fields inherited from interface com.hp.hpl.jena.rdf.model.RDFWriter
NSPREFIXPROPBASE
 
Constructor Summary
PagedNTripleWriter()
           
 
Method Summary
 boolean updateIndex(java.io.File f, org.apache.lucene.index.IndexReader reader, org.apache.lucene.search.Searcher searcher, java.lang.String uri, java.lang.String triples, org.apache.lucene.index.IndexWriter writer, boolean isSubjectIndex, boolean isPredicateIndex, boolean isObjectIndex)
          Method that updates the Lucene index for a URI by adding triples for that URI
static java.lang.String writeNTriple(com.hp.hpl.jena.graph.Triple t)
          Method that converts a Triple into its N-Triple representation
static java.lang.String writeString(java.lang.String s, java.lang.String writer)
          Method that converts a literal string into its appropriate N-Triple representation
 boolean writeTriple(java.io.File f, java.lang.String uri, java.lang.String triples, org.apache.lucene.index.IndexWriter writer, boolean isSubjectIndex, boolean isPredicateIndex, boolean isObjectIndex)
          Method that writes a URI and its associated triples to a Lucene index
 
Methods inherited from class com.hp.hpl.jena.rdf.model.impl.NTripleWriter
getPrefixFor, setErrorHandler, setNsPrefix, setProperty, write, write, write
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

sid

public static long sid
A static variable that determines the position of a Node in the subject Lucene index


pid

public static long pid
A static variable that determines the position of a Node in the predicate Lucene index


oid

public static long oid
A static variable that determines the position of a Node in the object Lucene index

Constructor Detail

PagedNTripleWriter

public PagedNTripleWriter()
Method Detail

writeTriple

public boolean writeTriple(java.io.File f,
                           java.lang.String uri,
                           java.lang.String triples,
                           org.apache.lucene.index.IndexWriter writer,
                           boolean isSubjectIndex,
                           boolean isPredicateIndex,
                           boolean isObjectIndex)
Method that writes a URI and its associated triples to a Lucene index

Parameters:
f - - the directory for the Lucene indices
uri - - the given URI
triples - - the triples associated with a URI
writer - - the Lucene index writer
isSubjectIndex - - true if this a subject index, false otherwise
isPredicateIndex - - true if this a predicate index, false otherwise
isObjectIndex - - true if this an object index, false otherwise
Returns:
true, if the Lucene index was updated, false otherwise

updateIndex

public boolean updateIndex(java.io.File f,
                           org.apache.lucene.index.IndexReader reader,
                           org.apache.lucene.search.Searcher searcher,
                           java.lang.String uri,
                           java.lang.String triples,
                           org.apache.lucene.index.IndexWriter writer,
                           boolean isSubjectIndex,
                           boolean isPredicateIndex,
                           boolean isObjectIndex)
                    throws java.io.IOException
Method that updates the Lucene index for a URI by adding triples for that URI

Parameters:
f - - the directory for the Lucene indices
reader - - the Lucene index reader
searcher - - the Lucene index searcher
uri - - the given URI
triples - - the triples associated with a URI
writer - - the Lucene index writer
isSubjectIndex - - true if this a subject index, false otherwise
isPredicateIndex - - true if this a predicate index, false otherwise
isObjectIndex - - true if this an object index, false otherwise
Returns:
true, if the index was updated, false otherwise
Throws:
java.io.IOException

writeNTriple

public static java.lang.String writeNTriple(com.hp.hpl.jena.graph.Triple t)
Method that converts a Triple into its N-Triple representation

Parameters:
t - - the Triple t
Returns:
a N-Triple representation of the Triple as a string

writeString

public static java.lang.String writeString(java.lang.String s,
                                           java.lang.String writer)
Method that converts a literal string into its appropriate N-Triple representation

Parameters:
s - - the literal string
writer - - a string that holds the N-Triple representation
Returns:
an appropriate representation of the given literal string