com.hp.hpl.jena.rdf.arp
Class ARPOptions
java.lang.Object
com.hp.hpl.jena.rdf.arp.ARPOptions
- All Implemented Interfaces:
- ARPErrorNumbers
public class ARPOptions
- extends Object
- implements ARPErrorNumbers
The interface to set the various options on ARP.
User defined
implementations of this interface are not supported. This is a class rather
than an interface to have better backward compatibilitiy with earlier
versions, however constructing instances of this class is deprecated.
In addition, accessing the fields of ARPErrorNumbers
through this
class is not supported. The inheritance of this interface will be removed.
- Author:
- Jeremy J. Carroll
Fields inherited from interface com.hp.hpl.jena.rdf.arp.ARPErrorNumbers |
EM_ERROR, EM_FATAL, EM_IGNORE, EM_WARNING, ERR_ABOUTEACH_NOT_TOPLEVEL, ERR_BAD_RDF_ATTRIBUTE, ERR_BAD_RDF_ELEMENT, ERR_ENCODING_MISMATCH, ERR_GENERIC_IO, ERR_INTERNAL_ERROR, ERR_INTERRUPTED, ERR_LI_AS_TYPE, ERR_NOT_WHITESPACE, ERR_RESOLVING_AGAINST_MALFORMED_BASE, ERR_RESOLVING_AGAINST_RELATIVE_BASE, ERR_RESOLVING_URI_AGAINST_NULL_BASE, ERR_SAX_ERROR, ERR_SAX_FATAL_ERROR, ERR_STRING_NOT_NORMAL_FORM_C, ERR_SYNTAX_ERROR, ERR_UNABLE_TO_RECOVER, ERR_URI_NOT_NORMAL_FORM_C, ERR_UTF_ENCODING, IGN_DAML_COLLECTION, IGN_NO_BASE_URI_SPECIFIED, IGN_PRIVATE_XMLLANG, IGN_XMLBASE_SIGNIFICANT, IGN_XMLBASE_USED, WARN_BAD_NAME, WARN_BAD_NAMESPACE_URI, WARN_BAD_RDF_NAMESPACE_URI, WARN_BAD_XML, WARN_BAD_XML_NAMESPACE_URI, WARN_BAD_XMLLANG, WARN_BIG_FILE, WARN_DEPRECATED_XMLLANG, WARN_ENCODING_MISMATCH, WARN_IN_STRICT_MODE, WARN_LEGAL_REUSE_OF_ID, WARN_MALFORMED_URI, WARN_MALFORMED_XMLLANG, WARN_MINOR_INTERNAL_ERROR, WARN_NON_IANA_ENCODING, WARN_NONCANONICAL_IANA_NAME, WARN_NOT_RDF_NAMESPACE, WARN_PROCESSING_INSTRUCTION_IN_RDF, WARN_QNAME_AS_ID, WARN_RDF_NN_AS_TYPE, WARN_REDEFINITION_OF_ID, WARN_RELATIVE_NAMESPACE_URI_DEPRECATED, WARN_RELATIVE_URI, WARN_RESOLVING_URI_AGAINST_EMPTY_BASE, WARN_SAX_WARNING, WARN_STRING_COMPOSING_CHAR, WARN_STRING_NOT_NORMAL_FORM_C, WARN_UNKNOWN_PARSETYPE, WARN_UNKNOWN_RDF_ATTRIBUTE, WARN_UNKNOWN_RDF_ELEMENT, WARN_UNKNOWN_XML_ATTRIBUTE, WARN_UNQUALIFIED_ATTRIBUTE, WARN_UNQUALIFIED_ELEMENT, WARN_UNQUALIFIED_RDF_ATTRIBUTE, WARN_UNSUPPORTED_ENCODING, WARN_URI_COMPOSING_CHAR, WARN_XMLBASE_MISSING |
Method Summary |
ARPOptions |
copy()
Internal use only. |
static ARPOptions |
createNewOptions()
Internal use only |
boolean |
getEmbedding()
True if the embedding flag is set. |
int |
getErrorMode(int eCode)
Returns the error mode for the given error code. |
com.hp.hpl.jena.iri.IRIFactory |
getIRIFactory()
Get the IRI factory (and hence the IRI checking rules) |
static com.hp.hpl.jena.iri.IRIFactory |
getIRIFactoryGlobal()
Get the default (global) IRI factory (and hence the IRI checking rules) |
void |
setDefaultErrorMode()
Resets error mode to the default values:
many errors are reported as warnings, and resulting triples are produced. |
boolean |
setEmbedding(boolean embed)
Sets whether the XML document is only RDF, or contains RDF embedded in other XML. |
int |
setErrorMode(int errno,
int mode)
Sets or gets the error handling mode for a specific error condition. |
void |
setIRIFactory(com.hp.hpl.jena.iri.IRIFactory f)
Set the IRI factory (and hence the IRI checking rules) |
static void |
setIRIFactoryGlobal(com.hp.hpl.jena.iri.IRIFactory f)
Set the system-wide default IRI factory, which incorporates the checking rules. |
void |
setLaxErrorMode()
As many errors as possible are ignored. |
void |
setStrictErrorMode()
This sets strict conformance to the W3C Recommendations. |
void |
setStrictErrorMode(int nonErrorMode)
This method detects and prohibits errors according to
the W3C Recommendations. |
createNewOptions
public static ARPOptions createNewOptions()
- Internal use only
setErrorMode
public int setErrorMode(int errno,
int mode)
- Sets or gets the error handling mode for a specific error condition.
Changes that cannot be honoured are silently ignored.
Illegal error numbers may result in an ArrayIndexOutOfBoundsException but
are usually ignored.
Most conditions are associated with one or more specific resources or literals
formed during the parse.
Triples involving resource or literal associated with an error condition
are not produced.
The precise definition of 'associated with' is deliberately
undefined, and may change in future releases.
This method can be used to downgrade an error condition to
a warning, or to upgrade a warning to an error.
Such a change modifies which triples are produced.
When the condition is a violation of the RDF/XML Syntax (Revised) Recommendations,
and the error mode is ARPErrorNumbers.EM_IGNORE
or ARPErrorNumbers.EM_WARNING
,
the precise rules which ARP uses to generate triples for such ill-formed input are
not defined by any standard and are subject to change with future releases.
For input involving no errors, ARP creates triples in accordance with
the RDF/XML Syntax Revised Recommendation.
The mode can have one of the following four values.
ARPErrorNumbers.EM_IGNORE
- Ignore this condition. Produce triples.
ARPErrorNumbers.EM_WARNING
- Invoke ErrorHandler.warning() for this condition. Produce triples.
ARPErrorNumbers.EM_ERROR
- Invoke ErrorHandler.error() for this condition. Do not produce triples.
ARPErrorNumbers.EM_FATAL
- Aborts parse and invokes ErrorHandler.errorError() for this condition.
Do not produce triples.
In unusual situations, a few further warnings and errors may be reported.
- Parameters:
errno
- The specific error condition to change.mode
- The new mode for this condition.
- Returns:
- The old error mode for this condition.
setDefaultErrorMode
public void setDefaultErrorMode()
- Resets error mode to the default values:
many errors are reported as warnings, and resulting triples are produced.
setLaxErrorMode
public void setLaxErrorMode()
- As many errors as possible are ignored.
As many triples as possible are produced.
setStrictErrorMode
public void setStrictErrorMode()
- This sets strict conformance to the W3C Recommendations.
setStrictErrorMode
public void setStrictErrorMode(int nonErrorMode)
- This method detects and prohibits errors according to
the W3C Recommendations.
For other conditions, such as
ARPErrorNumbers.WARN_PROCESSING_INSTRUCTION_IN_RDF
, nonErrorMode is used.
- Parameters:
nonErrorMode
- The way of treating non-error conditions.
copy
public ARPOptions copy()
- Internal use only.
Copies this object.
- Returns:
- A copy.
setEmbedding
public boolean setEmbedding(boolean embed)
- Sets whether the XML document is only RDF, or contains RDF embedded in other XML.
The default is non-embedded mode.
Embedded mode also matches RDF documents that use the
rdf:RDF tag at the top-level.
Non-embeded mode matches RDF documents which omit that optional tag, and consist of a single rdf:Description or
typed node.
To find embedded RDF it is necessary to setEmbedding(true).
- Parameters:
embed
- true: Look for embedded RDF; or false: match a typed node or rdf:Description against the whole document (the default).
- Returns:
- Previous setting.
getErrorMode
public int getErrorMode(int eCode)
- Returns the error mode for the given error code.
- Parameters:
eCode
-
- Returns:
- One of
ARPErrorNumbers.EM_IGNORE
,
ARPErrorNumbers.EM_WARNING
,
ARPErrorNumbers.EM_ERROR
,
ARPErrorNumbers.EM_FATAL
getEmbedding
public boolean getEmbedding()
- True if the embedding flag is set.
Indicates that the parser should look for rdf:RDF
element, rather than treat the whole file as an RDF/XML
document (possibly without rdf:RDF element).
setIRIFactory
public void setIRIFactory(com.hp.hpl.jena.iri.IRIFactory f)
- Set the IRI factory (and hence the IRI checking rules)
getIRIFactory
public com.hp.hpl.jena.iri.IRIFactory getIRIFactory()
- Get the IRI factory (and hence the IRI checking rules)
setIRIFactoryGlobal
public static void setIRIFactoryGlobal(com.hp.hpl.jena.iri.IRIFactory f)
- Set the system-wide default IRI factory, which incorporates the checking rules.
By default, Jena provides checking in compliance with the RDF spec but
that is quite loose and allows strings that are not IRIs (the final
IRI spec came along after the RDF spec). Example: spaces are
strictly legal in RDF URIReferences but not in IRIs or URIs.
Note that options to the RDF/XML parser override this.
getIRIFactoryGlobal
public static com.hp.hpl.jena.iri.IRIFactory getIRIFactoryGlobal()
- Get the default (global) IRI factory (and hence the IRI checking rules)
Licenced under the Apache License, Version 2.0