KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > hp > hpl > jena > rdf > arp > ExtendedHandler


1 /*
2   (c) Copyright 2003, Plugged In Software
3   (c) Copyright 2003, 2004, 2005 Hewlett-Packard Development Company, LP
4   [See end of file]
5   $Id: ExtendedHandler.java,v 1.7 2005/02/21 12:09:05 andy_seaborne Exp $
6 */

7 package com.hp.hpl.jena.rdf.arp;
8
9 /**Extended callbacks from a reader to an RDF application.
10  * This reports:
11  * <ul>
12  * <li> when a blank node goes out of scope, allowing its anonymous
13  * ID to be freed by external applications.
14  * <li> when a rdf:RDF start and end tag is seen
15  * @author Simon Raboczi, Jeremy Carroll
16  *
17  *
18  */

19 public interface ExtendedHandler {
20     /** After this call, no more triples will be reported
21      * which use <code>bnode</code>.
22      * This is called exactly once for each blank nodes.
23      * Whether this includes nodes with an <code>rdf:nodeID</code>
24      * is controlled by {@link #discardNodesWithNodeID}.
25      *
26      *<p>
27      *The contract is robust against syntax errors in input,
28      *and exceptions being thrown by the StatementHandler.
29      * @param bnode A blank node going out of scope.
30      */

31     public void endBNodeScope(AResource bnode );
32     /**
33      * This method is used to modify the behaviour
34      * of ARP concerning its reporting of bnode scope
35      * {@link #endBNodeScope}.
36      * <p>
37      * If this returns true then blank nodes with an <code>rdf:nodeID</code>
38      * are not reported as they go out of scope at the end
39      * of file. This eliminates the unbounded memory cost
40      * of remembering such nodes.
41      * <p>
42      * If this returns false then the contract of
43      * {@link #endBNodeScope} is honoured uniformly
44      * independent of whether a blank node has a nodeID or not.
45      * <p>
46      * If this method returns different values during the parsing
47      * of a single file, then the behaviour is undefined.
48      * @return Desired behaviour of endBNodeScope.
49      */

50     public boolean discardNodesWithNodeID();
51     
52     /**
53      * Called when the &lt;rdf:RDF&gt; tag is seen.
54      * (Also called when there is an implicit start of RDF content
55      * when the file consists only of RDF but omits the rdf:RDF tag).
56      */

57     public void startRDF();
58     
59     /**
60      * Called when the &lt;/rdf:RDF&gt; tag is seen.
61      * (Also called when there is an implicit end of RDF content
62      * e.g. when the file consists only of RDF but omits the rdf:RDF tag,
63      * or if there is an unrecoverable syntax error mid-file).
64      *<p>
65      *Robust against syntax errors in input,
66      *and exceptions being thrown by the StatementHandler.
67      */

68     public void endRDF();
69     
70 }
71
72 /*
73  (c) Copyright 2003, 2004, 2005 Hewlett-Packard Development Company, LP
74  All rights reserved.
75
76  Redistribution and use in source and binary forms, with or without
77  modification, are permitted provided that the following conditions
78  are met:
79
80  1. Redistributions of source code must retain the above copyright
81  notice, this list of conditions and the following disclaimer.
82
83  2. Redistributions in binary form must reproduce the above copyright
84  notice, this list of conditions and the following disclaimer in the
85  documentation and/or other materials provided with the distribution.
86
87  3. The name of the author may not be used to endorse or promote products
88  derived from this software without specific prior written permission.
89
90  THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
91  IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
92  OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
93  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
94  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
95  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
96  DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
97  THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
98  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
99  THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
100  */
Popular Tags