KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > hp > hpl > jena > xmloutput > RDFXMLWriterI


1 /*
2  * (c) Copyright 2002, 2003, 2004, 2005 Hewlett-Packard Development Company, LP
3  * [see end of file]
4  */

5
6 package com.hp.hpl.jena.xmloutput;
7
8 import com.hp.hpl.jena.rdf.model.RDFWriter;
9 import com.hp.hpl.jena.vocabulary.*;
10
11 /**
12  *
13  * This interface only adds documentation to {@link RDFWriter}.
14  * The documentation identifies the properties that can be
15  * set on RDF/XML and RDF/XML-ABBREV writers.
16  * @author jjc
17  *
18  */

19 public interface RDFXMLWriterI extends RDFWriter {
20     /** Suppress a compiler warning. */
21    Object JavaDoc _NotInteresting = RDFSyntax.parseCollection;
22     
23
24 /** Sets properties on this writer.
25
26  <TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0">
27  <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
28  <TD COLSPAN=4><FONT SIZE="+2">
29  <B>Properties to Control RDF/XML Output</B></FONT></TD>
30  </TR>
31  <tr BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor">
32  <th>Property Name</th>
33  <th>Description</th>
34  <th>Value class</th>
35  <th>Legal Values</th>
36  </tr>
37  <tr BGCOLOR="white" CLASS="TableRowColor">
38 <td>xmlbase</td>
39 <td>The value for xml:base in the
40  file as a string.</td><td>String</td>
41 <td>a URI string, or null (default)</td></tr>
42  <tr BGCOLOR="white" CLASS="TableRowColor">
43  <td>longId</td>
44  <td> Whether to use long or short id's for anon
45  resources. Short id's are easier to read and are the default, but can run
46  out of memory on very large models.</td>
47 <td>String or Boolean</td>
48 <td>
49 "true", "false" (default)
50  </td>
51 </tr>
52  <tr BGCOLOR="white" CLASS="TableRowColor">
53  <td>allowBadURIs</td>
54  <td>URIs in the graph are, by default, checked prior to
55 serialization.</td>
56 <td>String or Boolean</td>
57 <td>
58 "true", "false" (default)
59  </td>
60 </tr>
61  <tr BGCOLOR="white" CLASS="TableRowColor">
62  <td>relativeURIs</td>
63 <td>
64 What sort of relative URIs should be used.
65 A comma separate list of options:
66     <dl>
67     <dt>same-document
68     <dd>same-document references (e.g. "" or "#foo")
69     <dt>network
70     <dd>network paths e.g. "//example.org/foo" omitting the URI scheme
71     <dt>absolute
72     <dd>absolute paths e.g. "/foo" omitting the scheme and authority
73     <dt>relative
74     <dd>relative path not begining in "../"
75     <dt>parent
76     <dd>relative path begining in "../"
77     <dt>grandparent
78     <dd>relative path begining in "../../"
79     </dl>
80 The default value is "same-document, absolute, relative, parent".
81 To switch off relative URIs use the value "".
82     Relative URIs of any of these types are output where possible if
83  and only if the option has been specified.
84 </td>
85 <td>String</td>
86 <td></td>
87 </tr>
88   <tr BGCOLOR="white" CLASS="TableRowColor">
89  <td>showXmlDeclaration</td>
90  <dd>can be true, false or "default" (null)
91  <td>If true, an XML Declaration is included in the output, if false
92   no XML declaration is included.
93   The default behaviour only gives an XML Declaration when
94   asked to write to an OutputStreamWriter that uses some
95   encoding other than UTF-8 or UTF-16.
96 In this case the encoding is shown
97   in the XML declaration.
98 To ensure that the encoding attribute is shown in the XML declaration
99 either use the <code><b>write(Model,Writer,String)</b></code>
100 variant with an appropriate OutputStreamWriter or set this option
101 to false write the declaration to an OutputStream before calling
102 <code><b>write(Model,OutputStream,String)</b></code>.
103 </td>
104 <td>true, "true", false, "false" or "default"</td>
105 </tr>
106   <tr BGCOLOR="white" CLASS="TableRowColor">
107  <td>tab</td>
108  <td>The number of spaces with which to indent XML child elements.</td>
109 <td>String or Integer</td>
110 <td>positive integer "2" is the default</td>
111 </tr>
112   <tr BGCOLOR="white" CLASS="TableRowColor">
113  <td>width</td>
114  <td>A guide to the num of cols before inserting an arbitrary newline.</td>
115 <td>String or Integer</td>
116 <td>positive integer "60" is the default</td>
117 </tr>
118   <tr BGCOLOR="white" CLASS="TableRowColor">
119  <td>attributeQuoteChar</td>
120 <td>How to write XML attributes.</td>
121 <td>String</td>
122 <td>"\"" or "'"</td>
123 </tr>
124   <tr BGCOLOR="white" CLASS="TableRowColor">
125  <td>blockRules</td>
126  <td>
127  A list of Resource or a String being a comma separated list
128  of fragment
129  IDs from
130  <a HREF="http://www.w3.org/TR/rdf-syntax-grammar">
131  http://www.w3.org/TR/rdf-syntax-grammar</a> indicating
132  grammar rules that will not be used.
133  Rules that can be avoided are:
134  <ul>
135  <li><a HREF="http://www.w3.org/TR/rdf-syntax-grammar#section-Reification"
136  >section-Reification</a> ({@link RDFSyntax#sectionReification})</li>
137  <li><a HREF="http://www.w3.org/TR/rdf-syntax-grammar#section-List-Expand"
138  >section-List-Expand</a> ({@link RDFSyntax#sectionListExpand})</li>
139  <li><a HREF="http://www.w3.org/TR/rdf-syntax-grammar#parseTypeLiteralPropertyElt">parseTypeLiteralPropertyElt</a>
140  ({@link RDFSyntax#parseTypeLiteralPropertyElt})</li>
141  <li><a HREF="http://www.w3.org/TR/rdf-syntax-grammar#parseTypeResourcePropertyElt">parseTypeResourcePropertyElt</a>
142  ({@link RDFSyntax#parseTypeLiteralPropertyElt})</li>
143  <li><a HREF="http://www.w3.org/TR/rdf-syntax-grammar#parseTypeCollectionPropertyElt">parseTypeCollectionPropertyElt</a>
144  ({@link RDFSyntax#parseTypeCollectionPropertyElt})</li>
145  <li><a HREF="http://www.w3.org/TR/rdf-syntax-grammar#idAttr">idAttr</a>
146  ({@link RDFSyntax#idAttr})</li>
147  <li><a HREF="http://www.w3.org/TR/rdf-syntax-grammar#propertyAttr">propertyAttr</a>
148  ({@link RDFSyntax#propertyAttr})</li>
149  </ul>
150  In addition "daml:collection" ({@link DAML_OIL#collection})
151  can be blocked. Blocking <a HREF=
152  "http://www.w3.org/TR/rdf-syntax-grammar#idAttr">idAttr</a> also blocks
153  <a HREF="http://www.w3.org/TR/rdf-syntax-grammar#section-Reification"
154  >section-Reification</a>.
155  By default <a HREF="http://www.w3.org/TR/rdf-syntax-grammar#propertyAttr">propertyAttr</a>
156  is blocked.
157  For the basic writer (RDF/XML) only
158  <a HREF="http://www.w3.org/TR/rdf-syntax-grammar#parseTypeLiteralPropertyElt">parseTypeLiteralPropertyElt</a>
159  has any affect, since none of the other rules are implemented by that writer.
160 </td><td>Resource[] or String</td><td></td>
161  
162  <tr BGCOLOR="white" CLASS="TableRowColor">
163  <td>prettyTypes</td>
164  <td>Only for the RDF/XML-ABBREV writer.
165 This a list of
166  the types of the principal objects in the model. The writer
167   will tend to create RDF/XML with resources of these types at the
168   top level.
169  <br />
170  Example usage showing the default value:
171   <pre>
172  w.setProperty("prettyTypes",
173       new Resource[]{
174             DAML_OIL.Ontology,
175             OWL.Ontology,
176             DAML_OIL.Datatype,
177             OWL.Datatype,
178             RDFS.Datatype,
179             DAML_OIL.Class,
180             RDFS.Class,
181             OWL.Class,
182             DAML_OIL.Property,
183             OWL.ObjectProperty,
184             RDF.Property,
185             DAML_OIL.ObjectProperty,
186             OWL.DatatypeProperty,
187             DAML_OIL.DatatypeProperty,
188             OWL.TransitiveProperty,
189             OWL.SymmetricProperty,
190             OWL.FunctionalProperty,
191             OWL.InverseFunctionalProperty,
192             DAML_OIL.TransitiveProperty,
193             DAML_OIL.UnambiguousProperty,
194             DAML_OIL.UniqueProperty,
195           });
196   </pre>
197   </td><td>Resource[]</td><td></td>
198 </tr>
199 </table>
200  * @param propName One of "xmlBase", "LongId", "allowBadURIs",
201  * "relativeURIs","showXMLDeclaration", "tab", "attributeQuoteChar",
202  * "blockRules", "prettyTypes"
203  * @param propValue A String, Boolean, Integer, Resource[] as appropriate.
204  * @return the old value for this property, or <code>null</code>
205  * if no value was set.
206  */

207  Object JavaDoc setProperty(
208     String JavaDoc propName,
209     Object JavaDoc propValue);
210
211 }
212
213 /*
214  * (c) Copyright 2002, 2003, 2004, 2005 Hewlett-Packard Development Company, LP
215  * All rights reserved.
216  *
217  * Redistribution and use in source and binary forms, with or without
218  * modification, are permitted provided that the following conditions
219  * are met:
220  * 1. Redistributions of source code must retain the above copyright
221  * notice, this list of conditions and the following disclaimer.
222  * 2. Redistributions in binary form must reproduce the above copyright
223  * notice, this list of conditions and the following disclaimer in the
224  * documentation and/or other materials provided with the distribution.
225  * 3. The name of the author may not be used to endorse or promote products
226  * derived from this software without specific prior written permission.
227  *
228  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
229  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
230  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
231  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
232  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
233  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
234  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
235  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
236  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
237  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
238  */

239
240
Popular Tags