| 
 | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.vivoweb.harvester.util.repo.JenaConnect
public abstract class JenaConnect
Connection Helper for Jena Models
| Field Summary | |
|---|---|
| protected static java.util.HashMap<java.lang.String,com.hp.hpl.jena.sparql.resultset.ResultSetFormat> | formatSymbolsRDF formats | 
| Constructor Summary | |
|---|---|
| JenaConnect() | |
| Method Summary | |
|---|---|
| abstract  void | close()Closes the model and the jdbc connection | 
|  boolean | containsURI(java.lang.String uri)Checks if the model contains the given uri | 
|  boolean | executeAskQuery(java.lang.String queryString)Executes a sparql describe query against the JENA model and returns the description result model | 
|  JenaConnect | executeConstructQuery(java.lang.String queryString)Executes a sparql construct query against the JENA model and returns the constructed result model | 
|  JenaConnect | executeDescribeQuery(java.lang.String queryString)Executes a sparql describe query against the JENA model and returns the description result model | 
|  void | executeQuery(java.lang.String queryParam,
             java.lang.String resultFormatParam,
             boolean datasetMode)Execute a Query and output result to System.out | 
|  void | executeQuery(java.lang.String queryParam,
             java.lang.String resultFormatParam,
             java.io.OutputStream output,
             boolean datasetMode)Execute a Query | 
|  com.hp.hpl.jena.query.ResultSet | executeSelectQuery(java.lang.String queryString)Executes a sparql select query against the JENA model and returns the selected result set | 
|  com.hp.hpl.jena.query.ResultSet | executeSelectQuery(java.lang.String queryString,
                   boolean copyResultSet)Executes a sparql select query against the JENA model and returns the selected result set | 
|  void | executeUpdateQuery(java.lang.String queryString)Executes a sparql update query against the JENA model | 
|  void | exportRdfToFile(java.lang.String fileName)Export the RDF to a file | 
|  void | exportRdfToStream(java.io.OutputStream out)Export all RDF | 
|  java.lang.String | exportRdfToString()Export all RDF | 
| abstract  com.hp.hpl.jena.query.Dataset | getDataSet()Get the dataset for this connection Can be very expensive when using RDB connections (SDB, TDB, and Mem are fine) | 
|  com.hp.hpl.jena.rdf.model.Model | getJenaModel()Accessor for Jena Model | 
|  java.lang.String | getModelName()Get the modelName | 
|  boolean | isEmpty()Is this model empty | 
|  void | loadRdfFromFile(java.lang.String fileName,
                java.lang.String namespace,
                java.lang.String language)Load the RDF from a file | 
|  void | loadRdfFromJC(JenaConnect jc)Load in RDF from a model | 
|  int | loadRdfFromRH(RecordHandler rh,
              java.lang.String namespace)Adds all records in a RecordHandler to the model | 
|  void | loadRdfFromStream(java.io.InputStream in,
                  java.lang.String namespace,
                  java.lang.String language)Load in RDF | 
|  void | loadRdfFromString(java.lang.String rdf,
                  java.lang.String namespace,
                  java.lang.String language)Load in RDF | 
| static void | main(java.lang.String... args)Main method | 
| abstract  JenaConnect | neighborConnectClone(java.lang.String newModelName)Factory (connects to the same jena triple store as another jena connect, but uses a different named model) | 
| static JenaConnect | parseConfig(java.io.File configFile)Config File Based Factory | 
| static JenaConnect | parseConfig(java.io.File configFile,
            java.util.Map<java.lang.String,java.lang.String> overrideParams)Config File Based Factory | 
| static JenaConnect | parseConfig(org.apache.commons.vfs.FileObject configFile)Config File Based Factory | 
| static JenaConnect | parseConfig(org.apache.commons.vfs.FileObject configFile,
            java.util.Map<java.lang.String,java.lang.String> overrideParams)Config File Based Factory that overrides parameters | 
| static JenaConnect | parseConfig(java.io.InputStream configStream,
            java.util.Map<java.lang.String,java.lang.String> overrideParams)Config Stream Based Factory that overrides parameters | 
| static JenaConnect | parseConfig(java.lang.String configFileName)Config File Based Factory | 
| static JenaConnect | parseConfig(java.lang.String configFileName,
            java.util.Map<java.lang.String,java.lang.String> overrideParams)Config File Based Factory | 
|  void | printParameters()Output the jena model information | 
|  void | removeRdfFromFile(java.lang.String fileName,
                  java.lang.String namespace,
                  java.lang.String language)Remove the RDF from a file | 
|  void | removeRdfFromJC(JenaConnect inputJC)Remove RDF from another JenaConnect | 
|  int | removeRdfFromRH(RecordHandler rh,
                java.lang.String namespace)Removes all records in a RecordHandler from the model | 
|  void | removeRdfFromStream(java.io.InputStream in,
                    java.lang.String namespace,
                    java.lang.String language)Remove RDF from an input stream | 
| protected  void | setJenaModel(com.hp.hpl.jena.rdf.model.Model jena)Setter | 
| protected  void | setModelName(java.lang.String modelName)Set the modelName | 
|  int | size()Get the size of a jena model | 
| abstract  void | truncate()Remove all statements from model | 
| Methods inherited from class java.lang.Object | 
|---|
| clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait | 
| Field Detail | 
|---|
protected static java.util.HashMap<java.lang.String,com.hp.hpl.jena.sparql.resultset.ResultSetFormat> formatSymbols
| Constructor Detail | 
|---|
public JenaConnect()
| Method Detail | 
|---|
public abstract JenaConnect neighborConnectClone(java.lang.String newModelName)
                                          throws java.io.IOException
newModelName - the model name to use
java.io.IOException - unable to secure db connection
public static JenaConnect parseConfig(java.io.InputStream configStream,
                                      java.util.Map<java.lang.String,java.lang.String> overrideParams)
                               throws java.io.IOException
configStream - the config input streamoverrideParams - the parameters to override the file with
java.io.IOException - error connecting
public static JenaConnect parseConfig(org.apache.commons.vfs.FileObject configFile)
                               throws java.io.IOException
configFile - the vfs config file descriptor
java.io.IOException - error connecting
public static JenaConnect parseConfig(org.apache.commons.vfs.FileObject configFile,
                                      java.util.Map<java.lang.String,java.lang.String> overrideParams)
                               throws java.io.IOException
configFile - the vfs config file descriptoroverrideParams - the parameters to override the file with
java.io.IOException - error connecting
public static JenaConnect parseConfig(java.io.File configFile)
                               throws java.io.IOException
configFile - the config file descriptor
java.io.IOException - error connecting
public static JenaConnect parseConfig(java.io.File configFile,
                                      java.util.Map<java.lang.String,java.lang.String> overrideParams)
                               throws java.io.IOException
configFile - the config file descriptoroverrideParams - the parameters to override the file with
java.io.IOException - error connecting
public static JenaConnect parseConfig(java.lang.String configFileName)
                               throws java.io.IOException
configFileName - the config file path
java.io.IOException - xml parse error
public static JenaConnect parseConfig(java.lang.String configFileName,
                                      java.util.Map<java.lang.String,java.lang.String> overrideParams)
                               throws java.io.IOException
configFileName - the config file pathoverrideParams - the parameters to override the file with
java.io.IOException - xml parse errorpublic int size()
public abstract com.hp.hpl.jena.query.Dataset getDataSet()
                                                  throws java.io.IOException
java.io.IOException - error connecting
public void loadRdfFromStream(java.io.InputStream in,
                              java.lang.String namespace,
                              java.lang.String language)
in - input stream to read rdf fromnamespace - the base uri to use for imported urislanguage - the language the rdf is in. Predefined values for lang are "RDF/XML", "N-TRIPLE", "TURTLE" (or
        "TTL") and "N3". null represents the default language, "RDF/XML". "RDF/XML-ABBREV" is a synonym for
        "RDF/XML"
public void loadRdfFromFile(java.lang.String fileName,
                            java.lang.String namespace,
                            java.lang.String language)
                     throws org.apache.commons.vfs.FileSystemException
fileName - the file to read fromnamespace - the base uri to use for imported urislanguage - the language the rdf is in. Predefined values for lang are "RDF/XML", "N-TRIPLE", "TURTLE" (or
        "TTL") and "N3". null represents the default language, "RDF/XML". "RDF/XML-ABBREV" is a synonym for
        "RDF/XML"
org.apache.commons.vfs.FileSystemException - error accessing file
public void loadRdfFromString(java.lang.String rdf,
                              java.lang.String namespace,
                              java.lang.String language)
rdf - rdf stringnamespace - the base uri to use for imported urislanguage - the language the rdf is in. Predefined values for lang are "RDF/XML", "N-TRIPLE", "TURTLE" (or
        "TTL") and "N3". null represents the default language, "RDF/XML". "RDF/XML-ABBREV" is a synonym for
        "RDF/XML"public void loadRdfFromJC(JenaConnect jc)
jc - the model to load in
public void exportRdfToStream(java.io.OutputStream out)
                       throws java.io.IOException
out - output stream to write rdf to
java.io.IOException - error writing to stream
public java.lang.String exportRdfToString()
                                   throws java.io.IOException
java.io.IOException - error writing to string
public void exportRdfToFile(java.lang.String fileName)
                     throws java.io.IOException
fileName - the file to write to
java.io.IOException - error writing to filepublic void removeRdfFromJC(JenaConnect inputJC)
inputJC - the Model to read from
public void removeRdfFromStream(java.io.InputStream in,
                                java.lang.String namespace,
                                java.lang.String language)
                         throws java.io.IOException
in - input stream to read rdf fromnamespace - the base uri to use for imported urislanguage - the language the rdf is in. Predefined values for lang are "RDF/XML", "N-TRIPLE", "TURTLE" (or
        "TTL") and "N3". null represents the default language, "RDF/XML". "RDF/XML-ABBREV" is a synonym for
        "RDF/XML"
java.io.IOException - error connecting
public void removeRdfFromFile(java.lang.String fileName,
                              java.lang.String namespace,
                              java.lang.String language)
                       throws java.io.IOException
fileName - the file to read fromnamespace - the base uri to use for imported urislanguage - the language the rdf is in. Predefined values for lang are "RDF/XML", "N-TRIPLE", "TURTLE" (or
        "TTL") and "N3". null represents the default language, "RDF/XML". "RDF/XML-ABBREV" is a synonym for
        "RDF/XML"
java.io.IOException - error connecting
public int removeRdfFromRH(RecordHandler rh,
                           java.lang.String namespace)
                    throws java.io.IOException
rh - the RecordHandler to pull records fromnamespace - the base uri to use for imported uris
java.io.IOException - error connecting
public int loadRdfFromRH(RecordHandler rh,
                         java.lang.String namespace)
rh - the RecordHandler to pull records fromnamespace - the base uri to use for imported uris
public abstract void close()
public com.hp.hpl.jena.query.ResultSet executeSelectQuery(java.lang.String queryString)
queryString - the query to execute against the model
public com.hp.hpl.jena.query.ResultSet executeSelectQuery(java.lang.String queryString,
                                                          boolean copyResultSet)
queryString - the query to execute against the modelcopyResultSet - copy the resultset
public JenaConnect executeConstructQuery(java.lang.String queryString)
                                  throws java.io.IOException
queryString - the query to execute against the model
java.io.IOException - error connecting
public JenaConnect executeDescribeQuery(java.lang.String queryString)
                                 throws java.io.IOException
queryString - the query to execute against the model
java.io.IOException - error connectingpublic boolean executeAskQuery(java.lang.String queryString)
queryString - the query to execute against the model
public void executeUpdateQuery(java.lang.String queryString)
queryString - the query to execute against the model
public void executeQuery(java.lang.String queryParam,
                         java.lang.String resultFormatParam,
                         boolean datasetMode)
                  throws java.io.IOException
queryParam - the queryresultFormatParam - the format to return the results in ('RS_RDF',etc for select queries / 'RDF/XML',etc for
        construct/describe queries)datasetMode - run against dataset rather than model
java.io.IOException - error writing to output
public void executeQuery(java.lang.String queryParam,
                         java.lang.String resultFormatParam,
                         java.io.OutputStream output,
                         boolean datasetMode)
                  throws java.io.IOException
queryParam - the queryresultFormatParam - the format to return the results in ('RS_TEXT' default for select queries / 'RDF/XML'
        default for construct/describe queries)output - output stream to write to - null uses System.outdatasetMode - run against dataset rather than model
java.io.IOException - error writing to outputpublic com.hp.hpl.jena.rdf.model.Model getJenaModel()
protected void setJenaModel(com.hp.hpl.jena.rdf.model.Model jena)
jena - the new modelpublic boolean containsURI(java.lang.String uri)
uri - the uri to check for
public abstract void truncate()
protected void setModelName(java.lang.String modelName)
modelName - the model namepublic java.lang.String getModelName()
public boolean isEmpty()
public void printParameters()
public static void main(java.lang.String... args)
args - commandline arguments| 
 | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||