de.fuberlin.wiwiss.ng4j.trix
Interface ParserCallback

All Known Implementing Classes:
JenaRDFReader, JenaRDFReaderWithExtensions, TriXReader, TriXReaderWithExtensions

public interface ParserCallback

Callback that is fed by TriXParser with graphs and triples from a TriX file (see TriX specification). Implement this if you want to do something with data from TriX files.

A TriX file contains zero or more named graphs, each of whom might contain zero or more triples. For each graph, first startGraph(java.util.List) is called, then all triples are processed, then endGraph() is called. Processing of triples works like this: For each triple within a graph, first one of the subjectXXX methods is called (for example, subjectURI(java.lang.String)), then predicate(java.lang.String) is called, and finally one of the objectXXX methods is called (for example, objectPlainLiteral(java.lang.String, java.lang.String)).

Graphs and triples are processed in the same order as they are encountered in the file.

Author:
Richard Cyganiak (richard@cyganiak.de)

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 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.
 

Method Detail

startGraph

void startGraph(List uris)
Called at the beginning of each trix:graph element.

Parameters:
uris - zero or more names of the graph, as strings

endGraph

void endGraph()
Called at the end of each trix:graph element


subjectURI

void subjectURI(String uri)
Called for each trix:triple element whose subject is a trix:uri.

Parameters:
uri - the subject URI of the triple

subjectBNode

void subjectBNode(String id)
Called for each trix:triple element whose subject is a trix:id.

Parameters:
id - the subject blank node ID of the triple

subjectPlainLiteral

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

Parameters:
value - the subject literal value of the triple
lang - the language tag of the subject literal, or null if none was given

subjectTypedLiteral

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

Parameters:
value - the subject literal value of the triple
datatypeURI - the datatype URI of the subject literal

predicate

void predicate(String uri)
Called for the predicate of each trix:triple.

Parameters:
uri - the predicate URI of the triple.

objectURI

void objectURI(String uri)
Called for each trix:triple element whose object is a trix:uri.

Parameters:
uri - the object URI of the triple

objectBNode

void objectBNode(String id)
Called for each trix:triple element whose object is a trix:id.

Parameters:
id - the object blank node ID of the triple

objectPlainLiteral

void objectPlainLiteral(String value,
                        String lang)
Called for each trix:triple element whose object is a trix:plainLiteral.

Parameters:
value - the object literal value of the triple
lang - the language tag of the object literal, or null if none was given

objectTypedLiteral

void objectTypedLiteral(String value,
                        String datatypeURI)
Called for each trix:triple element whose object is a trix:typedLiteral.

Parameters:
value - the object literal value of the triple
datatypeURI - the datatype URI of the object literal