org.openrdf.rio.helpers
Class StatementCollector

java.lang.Object
  extended by org.openrdf.rio.helpers.RDFHandlerBase
      extended by org.openrdf.rio.helpers.StatementCollector
All Implemented Interfaces:
RDFHandler

public class StatementCollector
extends RDFHandlerBase

A RDFHandler that can be used to collect reported statements in collections.

Author:
Arjohn Kampman

Constructor Summary
StatementCollector()
          Creates a new StatementCollector that uses a new ArrayList to store the reported statements and a new LinkedHashMap to store the reported namespaces.
StatementCollector(java.util.Collection<Statement> statements)
          Creates a new StatementCollector that stores reported statements in the supplied collection and that uses a new LinkedHashMap to store the reported namespaces.
StatementCollector(java.util.Collection<Statement> statements, java.util.Map<java.lang.String,java.lang.String> namespaces)
          Creates a new StatementCollector that stores reported statements and namespaces in the supplied containers.
 
Method Summary
 void clear()
          Clear the set of collected statements.
 java.util.Map<java.lang.String,java.lang.String> getNamespaces()
          Gets the map that contains the collected namespaces.
 java.util.Collection<Statement> getStatements()
          Gets the collection that contains the collected statements.
 void handleNamespace(java.lang.String prefix, java.lang.String uri)
          Handles a namespace declaration/definition.
 void handleStatement(Statement st)
          Handles a statement.
 
Methods inherited from class org.openrdf.rio.helpers.RDFHandlerBase
endRDF, handleComment, startRDF
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StatementCollector

public StatementCollector()
Creates a new StatementCollector that uses a new ArrayList to store the reported statements and a new LinkedHashMap to store the reported namespaces.


StatementCollector

public StatementCollector(java.util.Collection<Statement> statements)
Creates a new StatementCollector that stores reported statements in the supplied collection and that uses a new LinkedHashMap to store the reported namespaces.


StatementCollector

public StatementCollector(java.util.Collection<Statement> statements,
                          java.util.Map<java.lang.String,java.lang.String> namespaces)
Creates a new StatementCollector that stores reported statements and namespaces in the supplied containers.

Method Detail

clear

public void clear()
Clear the set of collected statements.


getStatements

public java.util.Collection<Statement> getStatements()
Gets the collection that contains the collected statements.


getNamespaces

public java.util.Map<java.lang.String,java.lang.String> getNamespaces()
Gets the map that contains the collected namespaces.


handleNamespace

public void handleNamespace(java.lang.String prefix,
                            java.lang.String uri)
                     throws RDFHandlerException
Description copied from interface: RDFHandler
Handles a namespace declaration/definition. A namespace declaration associates a (short) prefix string with the namespace's URI. The prefix for default namespaces, which do not have an associated prefix, are represented as empty strings.

Specified by:
handleNamespace in interface RDFHandler
Overrides:
handleNamespace in class RDFHandlerBase
Parameters:
prefix - The prefix for the namespace, or an empty string in case of a default namespace.
uri - The URI that the prefix maps to.
Throws:
RDFHandlerException - If the RDF handler has encountered an unrecoverable error.

handleStatement

public void handleStatement(Statement st)
Description copied from interface: RDFHandler
Handles a statement.

Specified by:
handleStatement in interface RDFHandler
Overrides:
handleStatement in class RDFHandlerBase
Parameters:
st - The statement.


Copyright © 2001-2010 Aduna. All Rights Reserved.