KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > hp > hpl > jena > rdf > model > RDFReader


1 /*
2  * (c) Copyright 2000, 2001, 2002, 2003, 2004, 2005 Hewlett-Packard Development Company, LP
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions
7  * are met:
8  * 1. Redistributions of source code must retain the above copyright
9  * notice, this list of conditions and the following disclaimer.
10  * 2. Redistributions in binary form must reproduce the above copyright
11  * notice, this list of conditions and the following disclaimer in the
12  * documentation and/or other materials provided with the distribution.
13  * 3. The name of the author may not be used to endorse or promote products
14  * derived from this software without specific prior written permission.
15
16  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
17  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
18  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
19  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
20  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
21  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
25  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26  *
27  * $Id: RDFReader.java,v 1.9 2005/02/21 12:14:22 andy_seaborne Exp $
28  */

29
30 package com.hp.hpl.jena.rdf.model;
31
32 import java.io.Reader JavaDoc;
33 import java.io.InputStream JavaDoc;
34
35 /** An <code>RDFReader</code> reads a serialized represenation of RDF,
36  * e.g. RDF/XML, n-triple or n3 and adds the statements to a model.
37  *
38  * @author bwm
39  * @version $Revision: 1.9 $
40  */

41 public interface RDFReader {
42
43     /**
44      * It is usually a mistake to use this method.
45      * Read serialized RDF from a <code>Reader</code> and add the statements to a
46      * <code>Model</code>. It is generally better to use an InputStream if
47      * possible. {@link #read(Model,InputStream,String)}, otherwise there is a
48      * danger of a mismatch between the character encoding of say the FileReader
49      * and the character encoding of the data in the file.
50      * @param model The model to which statements are added.
51      * @param r the reader from which to read
52      * @param base The base to use when converting relative to absolute URI's.
53      * The base URI may be null if there are no relative URIs to convert.
54      * A base URI of "" may permit relative URIs to be used in the
55      * model unconverted.
56      */

57     public void read(Model model, Reader JavaDoc r, String JavaDoc base) ;
58
59     /** Read serialized RDF from an <code>InputStream</code> and add the statements
60      * to a <code>Model</code>.
61      * @param model The model to which statements are added.
62      * @param r The InputStream from which to read
63      * @param base The base to use when converting relative to absolute URI's.
64      * The base URI may be null if there are no relative URIs to convert.
65      * A base URI of "" may permit relative URIs to be used in the
66      * model unconverted.
67      */

68     public void read(Model model, InputStream JavaDoc r, String JavaDoc base);
69
70     /** Read serialized RDF from a url and add the statements to a model.
71      * @param model the model to which statements should be added
72      * @param url the url, as a string, from which the serialized RDF
73      * should be read.
74      */

75     public void read(Model model, String JavaDoc url) ;
76
77     /** Set the value of a reader property.
78      *
79      * <p>The behaviour of a reader may be influenced by setting property values.
80      * The properties and there effects may depend on the individual reader
81      * implementation.</p>
82      * <p>An RDFReader's behaviour can be influenced by defining property values
83      * interpreted by that particular reader class. The values for such
84      * properties can be changed by calling this method. </p>
85      *
86      * <p>No standard properties are defined. For the properties recognised
87      * by any particular reader implementation, see the the documentation for
88      * that implementation. </p>
89      * <p> The built-in RDFReaders have properties as defined by:
90  * <dl>
91  * <dt>N3</dt><dt>N-TRIPLE</dt>
92  * <dd>No properties.</dd>
93  * <dt>RDF/XML</dt><dt>RDF/XML-ABBREV</dt>
94  * <dd>See {@link com.hp.hpl.jena.rdf.arp.JenaReader#setProperty(String,Object)}
95  * </dl>
96      * @param propName the name of the property
97      * @param propValue the value of the property
98      * @return the previous value of the property, or <code>null</code>
99      * if there wasn't one
100      */

101     public Object JavaDoc setProperty(String JavaDoc propName, Object JavaDoc propValue);
102     /** Set an error handler for the reader
103      * @param errHandler the new error handler
104      * @return the previous error handler
105      */

106     public RDFErrorHandler setErrorHandler(RDFErrorHandler errHandler);
107     
108 }
109
Popular Tags