01: /*
02: * Copyright Aduna (http://www.aduna-software.com/) (c) 1997-2006.
03: *
04: * Licensed under the Aduna BSD-style license.
05: */
06: package org.openrdf.rio;
07:
08: import org.openrdf.model.Statement;
09:
10: /**
11: * An interface defining methods related to RDF data handling.
12: * <tt>RDFHandler</tt> is both used as a "consumer" and as a "producer"
13: * interface. As such it can be used both as an interface for receiving RDF
14: * data, for example by listening to the results of an RDF parser, and as an
15: * interface for reporting RDF data, for example to an object that serializes
16: * RDF data to an RDF/XML document.
17: */
18: public interface RDFHandler {
19:
20: /**
21: * Signals the start of the RDF data. This method is called before any data
22: * is reported.
23: *
24: * @throws RDFHandlerException
25: * If the RDF handler has encountered an unrecoverable error.
26: */
27: public void startRDF() throws RDFHandlerException;
28:
29: /**
30: * Signals the end of the RDF data. This method is called when all data has
31: * been reported.
32: *
33: * @throws RDFHandlerException
34: * If the RDF handler has encountered an unrecoverable error.
35: */
36: public void endRDF() throws RDFHandlerException;
37:
38: /**
39: * Handles a namespace declaration/definition. A namespace declaration
40: * associates a (short) prefix string with the namespace's URI. The prefix
41: * for default namespaces, which do not have an associated prefix, are
42: * represented as empty strings.
43: *
44: * @param prefix
45: * The prefix for the namespace, or an empty string in case of a
46: * default namespace.
47: * @param uri
48: * The URI that the prefix maps to.
49: * @throws RDFHandlerException
50: * If the RDF handler has encountered an unrecoverable error.
51: */
52: public void handleNamespace(String prefix, String uri)
53: throws RDFHandlerException;
54:
55: /**
56: * Handles a statement.
57: *
58: * @param st
59: * The statement.
60: * @throws RDFHandlerException
61: * If the RDF handler has encountered an unrecoverable error.
62: */
63: public void handleStatement(Statement st)
64: throws RDFHandlerException;
65:
66: /**
67: * Handles a comment.
68: *
69: * @param comment
70: * The comment.
71: * @throws RDFHandlerException
72: * If the RDF handler has encountered an unrecoverable error.
73: */
74: public void handleComment(String comment)
75: throws RDFHandlerException;
76: }
|