001: /*
002: * (c) Copyright 2002, 2003, 2004, 2005, 2006, 2007, 2008 Hewlett-Packard Development Company, LP
003: * [see end of file]
004: */
005:
006: package com.hp.hpl.jena.xmloutput;
007:
008: import com.hp.hpl.jena.rdf.model.RDFWriter;
009: import com.hp.hpl.jena.vocabulary.DAML_OIL;
010: import com.hp.hpl.jena.vocabulary.RDFSyntax;
011:
012: /**
013: *
014: * This interface only adds documentation to {@link RDFWriter}.
015: * The documentation identifies the properties that can be
016: * set on RDF/XML and RDF/XML-ABBREV writers.
017: * @author jjc
018: *
019: */
020: public interface RDFXMLWriterI extends RDFWriter {
021: /** Suppress a compiler warning. */
022: Object _NotInteresting = RDFSyntax.parseCollection;
023:
024: /** Sets properties on this writer.
025:
026: <TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0">
027: <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
028: <TD COLSPAN=4><FONT SIZE="+2">
029: <B>Properties to Control RDF/XML Output</B></FONT></TD>
030: </TR>
031: <tr BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor">
032: <th>Property Name</th>
033: <th>Description</th>
034: <th>Value class</th>
035: <th>Legal Values</th>
036: </tr>
037: <tr BGCOLOR="white" CLASS="TableRowColor">
038: <td>xmlbase</td>
039: <td>The value for xml:base in the
040: file as a string.</td><td>String</td>
041: <td>a URI string, or null (default)</td></tr>
042: <tr BGCOLOR="white" CLASS="TableRowColor">
043: <td>longId</td>
044: <td> Whether to use long or short id's for anon
045: resources. Short id's are easier to read and are the default, but can run
046: out of memory on very large models.</td>
047: <td>String or Boolean</td>
048: <td>
049: "true", "false" (default)
050: </td>
051: </tr>
052: <tr BGCOLOR="white" CLASS="TableRowColor">
053: <td>allowBadURIs</td>
054: <td>URIs in the graph are, by default, checked prior to
055: serialization.</td>
056: <td>String or Boolean</td>
057: <td>
058: "true", "false" (default)
059: </td>
060: </tr>
061: <tr BGCOLOR="white" CLASS="TableRowColor">
062: <td>relativeURIs</td>
063: <td>
064: What sort of relative URIs should be used.
065: A comma separate list of options:
066: <dl>
067: <dt>same-document
068: <dd>same-document references (e.g. "" or "#foo")
069: <dt>network
070: <dd>network paths e.g. "//example.org/foo" omitting the URI scheme
071: <dt>absolute
072: <dd>absolute paths e.g. "/foo" omitting the scheme and authority
073: <dt>relative
074: <dd>relative path not begining in "../"
075: <dt>parent
076: <dd>relative path begining in "../"
077: <dt>grandparent
078: <dd>relative path begining in "../../"
079: </dl>
080: The default value is "same-document, absolute, relative, parent".
081: To switch off relative URIs use the value "".
082: Relative URIs of any of these types are output where possible if
083: and only if the option has been specified.
084: </td>
085: <td>String</td>
086: <td></td>
087: </tr>
088: <tr BGCOLOR="white" CLASS="TableRowColor">
089: <td>showXmlDeclaration</td>
090: <dd>can be true, false or "default" (null)
091: <td>If true, an XML Declaration is included in the output, if false
092: no XML declaration is included.
093: The default behaviour only gives an XML Declaration when
094: asked to write to an OutputStreamWriter that uses some
095: encoding other than UTF-8 or UTF-16.
096: In this case the encoding is shown
097: in the XML declaration.
098: To ensure that the encoding attribute is shown in the XML declaration
099: 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:
107: <tr BGCOLOR="white" CLASS="TableRowColor">
108: <td>showDoctypeDeclaration</td>
109: <td>If true, an XML Doctype declaration is included in the output.
110: This declaration includes a !ENTITY declaration for each
111: prefix mapping in the model, and any attribute value that
112: starts with the URI of that mapping is written as starting
113: with the corresponding entity invocation. Warning:
114: <i>experimental</i>.</td>
115: <td>String or Boolean</td>
116: <td>true, false, "true", "false"</td>
117: </tr>
118:
119: <tr BGCOLOR="white" CLASS="TableRowColor">
120: <td>tab</td>
121: <td>The number of spaces with which to indent XML child elements.</td>
122: <td>String or Integer</td>
123: <td>positive integer "2" is the default</td>
124: </tr>
125: <tr BGCOLOR="white" CLASS="TableRowColor">
126: <td>width</td>
127: <td>A guide to the num of cols before inserting an arbitrary newline.</td>
128: <td>String or Integer</td>
129: <td>positive integer "60" is the default</td>
130: </tr>
131: <tr BGCOLOR="white" CLASS="TableRowColor">
132: <td>attributeQuoteChar</td>
133: <td>How to write XML attributes.</td>
134: <td>String</td>
135: <td>"\"" or "'"</td>
136: </tr>
137: <tr BGCOLOR="white" CLASS="TableRowColor">
138: <td>blockRules</td>
139: <td>
140: A list of Resource or a String being a comma separated list
141: of fragment
142: IDs from
143: <a href="http://www.w3.org/TR/rdf-syntax-grammar">
144: http://www.w3.org/TR/rdf-syntax-grammar</a> indicating
145: grammar rules that will not be used.
146: Rules that can be avoided are:
147: <ul>
148: <li><a href="http://www.w3.org/TR/rdf-syntax-grammar#section-Reification"
149: >section-Reification</a> ({@link RDFSyntax#sectionReification})</li>
150: <li><a href="http://www.w3.org/TR/rdf-syntax-grammar#section-List-Expand"
151: >section-List-Expand</a> ({@link RDFSyntax#sectionListExpand})</li>
152: <li><a href="http://www.w3.org/TR/rdf-syntax-grammar#parseTypeLiteralPropertyElt">parseTypeLiteralPropertyElt</a>
153: ({@link RDFSyntax#parseTypeLiteralPropertyElt})</li>
154: <li><a href="http://www.w3.org/TR/rdf-syntax-grammar#parseTypeResourcePropertyElt">parseTypeResourcePropertyElt</a>
155: ({@link RDFSyntax#parseTypeLiteralPropertyElt})</li>
156: <li><a href="http://www.w3.org/TR/rdf-syntax-grammar#parseTypeCollectionPropertyElt">parseTypeCollectionPropertyElt</a>
157: ({@link RDFSyntax#parseTypeCollectionPropertyElt})</li>
158: <li><a href="http://www.w3.org/TR/rdf-syntax-grammar#idAttr">idAttr</a>
159: ({@link RDFSyntax#idAttr})</li>
160: <li><a href="http://www.w3.org/TR/rdf-syntax-grammar#propertyAttr">propertyAttr</a>
161: ({@link RDFSyntax#propertyAttr})</li>
162: </ul>
163: In addition "daml:collection" ({@link DAML_OIL#collection})
164: can be blocked. Blocking <a href=
165: "http://www.w3.org/TR/rdf-syntax-grammar#idAttr">idAttr</a> also blocks
166: <a href="http://www.w3.org/TR/rdf-syntax-grammar#section-Reification"
167: >section-Reification</a>.
168: By default <a href="http://www.w3.org/TR/rdf-syntax-grammar#propertyAttr">propertyAttr</a>
169: is blocked.
170: For the basic writer (RDF/XML) only
171: <a href="http://www.w3.org/TR/rdf-syntax-grammar#parseTypeLiteralPropertyElt">parseTypeLiteralPropertyElt</a>
172: has any affect, since none of the other rules are implemented by that writer.
173: </td><td>Resource[] or String</td><td></td>
174:
175: <tr BGCOLOR="white" CLASS="TableRowColor">
176: <td>prettyTypes</td>
177: <td>Only for the RDF/XML-ABBREV writer.
178: This is a list of
179: the types of the principal objects in the model. The writer
180: will tend to create RDF/XML with resources of these types at the
181: top level.
182: <br />
183: Example usage showing the default value:
184: <pre>
185: w.setProperty("prettyTypes",
186: new Resource[]{
187: DAML_OIL.Ontology,
188: OWL.Ontology,
189: DAML_OIL.Datatype,
190: OWL.Datatype,
191: RDFS.Datatype,
192: DAML_OIL.Class,
193: RDFS.Class,
194: OWL.Class,
195: DAML_OIL.Property,
196: OWL.ObjectProperty,
197: RDF.Property,
198: DAML_OIL.ObjectProperty,
199: OWL.DatatypeProperty,
200: DAML_OIL.DatatypeProperty,
201: OWL.TransitiveProperty,
202: OWL.SymmetricProperty,
203: OWL.FunctionalProperty,
204: OWL.InverseFunctionalProperty,
205: DAML_OIL.TransitiveProperty,
206: DAML_OIL.UnambiguousProperty,
207: DAML_OIL.UniqueProperty,
208: });
209: </pre>
210: </td><td>Resource[]</td><td></td>
211: </tr>
212: </table>
213: * @param propName One of "xmlBase", "longId", "allowBadURIs",
214: * "relativeURIs","showXMLDeclaration", "tab", "attributeQuoteChar",
215: * "blockRules", "prettyTypes", "showDoctypeDeclaration", "width"
216: * @param propValue A String, Boolean, Integer, Resource[] as appropriate.
217: * @return the old value for this property, or <code>null</code>
218: * if no value was set.
219: */
220: Object setProperty(String propName, Object propValue);
221:
222: }
223:
224: /*
225: * (c) Copyright 2002, 2003, 2004, 2005, 2006, 2007, 2008 Hewlett-Packard Development Company, LP
226: * All rights reserved.
227: *
228: * Redistribution and use in source and binary forms, with or without
229: * modification, are permitted provided that the following conditions
230: * are met:
231: * 1. Redistributions of source code must retain the above copyright
232: * notice, this list of conditions and the following disclaimer.
233: * 2. Redistributions in binary form must reproduce the above copyright
234: * notice, this list of conditions and the following disclaimer in the
235: * documentation and/or other materials provided with the distribution.
236: * 3. The name of the author may not be used to endorse or promote products
237: * derived from this software without specific prior written permission.
238: *
239: * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
240: * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
241: * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
242: * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
243: * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
244: * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
245: * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
246: * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
247: * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
248: * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
249: */
|