de.fuberlin.wiwiss.ng4j.trix
Class JenaRDFReaderWithExtensions

java.lang.Object
  extended by de.fuberlin.wiwiss.ng4j.trix.JenaRDFReaderWithExtensions
All Implemented Interfaces:
RDFReader, ParserCallback

public class JenaRDFReaderWithExtensions
extends Object
implements RDFReader, ParserCallback

Simple RDFReader that adds support for the TriX syntax (see TriX specification) to the Jena framework. Does not support TriX's named graph features. It adds all statements from the first graph to a Jena model, ignoring its name if present, and ignoring all further graphs if present.

Author:
Richard Cyganiak (richard@cyganiak.de)

Constructor Summary
JenaRDFReaderWithExtensions()
           
 
Method Summary
 void endGraph()
          Called at the end of each trix:graph element
 void objectBNode(String id)
          Called for each trix:triple element whose object is a trix:id.
 void objectPlainLiteral(String value, String lang)
          Called for each trix:triple element whose object is a trix:plainLiteral.
 void objectTypedLiteral(String value, String datatypeURI)
          Called for each trix:triple element whose object is a trix:typedLiteral.
 void objectURI(String uri)
          Called for each trix:triple element whose object is a trix:uri.
 void predicate(String uri)
          Called for the predicate of each trix:triple.
 void read(Model model, InputStream r, String base)
           
 void read(Model model, Reader r, String base)
           
 void read(Model model, String url)
           
 RDFErrorHandler setErrorHandler(RDFErrorHandler errHandler)
           
 Object setProperty(String propName, Object propValue)
           
 void startGraph(List uris)
          Called at the beginning of each trix:graph element.
 void subjectBNode(String id)
          Called for each trix:triple element whose subject is a trix:id.
 void subjectPlainLiteral(String value, String lang)
          Called for each trix:triple element whose subject is a trix:plainLiteral.
 void subjectTypedLiteral(String value, String datatypeURI)
          Called for each trix:triple element whose subject is a trix:typedLiteral.
 void subjectURI(String uri)
          Called for each trix:triple element whose subject is a trix:uri.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JenaRDFReaderWithExtensions

public JenaRDFReaderWithExtensions()
Method Detail

read

public void read(Model model,
                 Reader r,
                 String base)
Specified by:
read in interface RDFReader

read

public void read(Model model,
                 InputStream r,
                 String base)
Specified by:
read in interface RDFReader

read

public void read(Model model,
                 String url)
Specified by:
read in interface RDFReader

setProperty

public Object setProperty(String propName,
                          Object propValue)
Specified by:
setProperty in interface RDFReader

setErrorHandler

public RDFErrorHandler setErrorHandler(RDFErrorHandler errHandler)
Specified by:
setErrorHandler in interface RDFReader

startGraph

public void startGraph(List uris)
Description copied from interface: ParserCallback
Called at the beginning of each trix:graph element.

Specified by:
startGraph in interface ParserCallback
Parameters:
uris - zero or more names of the graph, as strings

endGraph

public void endGraph()
Description copied from interface: ParserCallback
Called at the end of each trix:graph element

Specified by:
endGraph in interface ParserCallback

subjectURI

public void subjectURI(String uri)
Description copied from interface: ParserCallback
Called for each trix:triple element whose subject is a trix:uri.

Specified by:
subjectURI in interface ParserCallback
Parameters:
uri - the subject URI of the triple

subjectBNode

public void subjectBNode(String id)
Description copied from interface: ParserCallback
Called for each trix:triple element whose subject is a trix:id.

Specified by:
subjectBNode in interface ParserCallback
Parameters:
id - the subject blank node ID of the triple

subjectPlainLiteral

public void subjectPlainLiteral(String value,
                                String lang)
Description copied from interface: ParserCallback
Called for each trix:triple element whose subject is a trix:plainLiteral. Note that RDF doesn't allow literals as subjects, but TriX does.

Specified by:
subjectPlainLiteral in interface ParserCallback
Parameters:
value - the subject literal value of the triple
lang - the language tag of the subject literal, or null if none was given

subjectTypedLiteral

public void subjectTypedLiteral(String value,
                                String datatypeURI)
Description copied from interface: ParserCallback
Called for each trix:triple element whose subject is a trix:typedLiteral. Note that RDF doesn't allow literals as subjects, but TriX does.

Specified by:
subjectTypedLiteral in interface ParserCallback
Parameters:
value - the subject literal value of the triple
datatypeURI - the datatype URI of the subject literal

predicate

public void predicate(String uri)
Description copied from interface: ParserCallback
Called for the predicate of each trix:triple.

Specified by:
predicate in interface ParserCallback
Parameters:
uri - the predicate URI of the triple.

objectURI

public void objectURI(String uri)
Description copied from interface: ParserCallback
Called for each trix:triple element whose object is a trix:uri.

Specified by:
objectURI in interface ParserCallback
Parameters:
uri - the object URI of the triple

objectBNode

public void objectBNode(String id)
Description copied from interface: ParserCallback
Called for each trix:triple element whose object is a trix:id.

Specified by:
objectBNode in interface ParserCallback
Parameters:
id - the object blank node ID of the triple

objectPlainLiteral

public void objectPlainLiteral(String value,
                               String lang)
Description copied from interface: ParserCallback
Called for each trix:triple element whose object is a trix:plainLiteral.

Specified by:
objectPlainLiteral in interface ParserCallback
Parameters:
value - the object literal value of the triple
lang - the language tag of the object literal, or null if none was given

objectTypedLiteral

public void objectTypedLiteral(String value,
                               String datatypeURI)
Description copied from interface: ParserCallback
Called for each trix:triple element whose object is a trix:typedLiteral.

Specified by:
objectTypedLiteral in interface ParserCallback
Parameters:
value - the object literal value of the triple
datatypeURI - the datatype URI of the object literal