public final class UTLFParser extends Object implements org.jrdf.parser.ConfigurableParser
org.xml.sax.driver property.
This parser is not thread-safe, therefore it's public methods are
synchronized.
To parse a document using this parser:
Graph jrdfGraph = new GraphImpl(); Parser parser = new UTLFParser(jrdfGraph.getElementFactory()); parser.setStatementHandler(myStatementHandler); parser.setParseErrorListener(myParseErrorListener); parser.setVerifyData(true); parser.setStopAtFirstError(false); // Parse the data from inputStream, resolving any relative URIs against http://foo/bar: parser.parse(inputStream, "http://foo/bar");
| Modifier and Type | Class and Description |
|---|---|
(package private) static interface |
UTLFParser.Element |
(package private) static class |
UTLFParser.NodeElement |
(package private) static class |
UTLFParser.PropertyElement |
| Modifier and Type | Field and Description |
|---|---|
(package private) boolean |
preserveBNodeIds
Flag indicating whether the parser should preserve bnode identifiers specified
in the source.
|
(package private) boolean |
verifyData
Flag indicating whether the parser should check the data it parses.
|
| Constructor and Description |
|---|
UTLFParser(org.jrdf.graph.GraphElementFactory graphElementFactory)
Creates a new UTLFParser that will use the supplied GraphElementFactory to create objects for resources,
bNodes and literals.
|
UTLFParser(org.jrdf.graph.GraphElementFactory graphElementFactory,
org.jrdf.map.MapFactory creator)
Creates a new UTLFParser that will use the supplied BlankNodeFactoryCreator and create a new map to be used
by the generic ParserBlankNodeFactoryImpl.
|
UTLFParser(org.jrdf.graph.GraphElementFactory valueFactory,
org.jrdf.parser.ParserBlankNodeFactory parserBlankNodeFactory)
Creates a new UTLFParser that will use the supplied GraphElementFactory
to create objects for resources, bNodes and literals.
|
| Modifier and Type | Method and Description |
|---|---|
(package private) void |
emptyElement(String namespaceURI,
String localName,
String qName,
Atts atts) |
(package private) void |
endElement(String namespaceURI,
String localName,
String qName) |
boolean |
getParseStandAloneDocuments()
Returns whether the parser is currently in a mode to parse stand-alone
RDF documents.
|
void |
parse(InputStream in,
String baseURI)
Parses the data from the supplied InputStream, using the supplied
BASE_URI to resolve any relative URI references.
|
void |
parse(Reader reader,
String baseURI)
Parses the data from the supplied Reader, using the supplied BASE_URI
to resolve any relative URI references.
|
(package private) void |
sendError(String msg) |
(package private) void |
sendFatalError(String msg) |
(package private) void |
sendWarning(String msg) |
(package private) void |
setBaseURI(URI baseURI) |
void |
setDatatypeHandling(int datatypeHandling) |
void |
setNamespaceListener(org.jrdf.parser.NamespaceListener nl) |
void |
setParseErrorListener(org.jrdf.parser.ParseErrorListener el) |
void |
setParseLocationListener(org.jrdf.parser.ParseLocationListener ll) |
void |
setParseStandAloneDocuments(boolean standAloneDocs) |
void |
setPreserveBNodeIds(boolean preserveBNodeIds) |
void |
setStatementHandler(org.jrdf.parser.StatementHandler sh) |
void |
setStopAtFirstError(boolean stopAtFirstError) |
void |
setVerifyData(boolean verifyData) |
(package private) void |
setXmlLang(String xmlLang) |
(package private) void |
startElement(String namespaceURI,
String localName,
String qName,
Atts atts) |
(package private) void |
text(String text) |
boolean verifyData
boolean preserveBNodeIds
public UTLFParser(org.jrdf.graph.GraphElementFactory graphElementFactory)
throws org.jrdf.graph.GraphException
graphElementFactory - A GraphElementFactory.org.jrdf.graph.GraphException - Graph Exceptionpublic UTLFParser(org.jrdf.graph.GraphElementFactory graphElementFactory,
org.jrdf.map.MapFactory creator)
throws org.jrdf.graph.GraphException
graphElementFactory - A GraphElementFactory.creator - A BlankNodeFactoryCreator.org.jrdf.graph.GraphException - Graph Exceptionpublic UTLFParser(org.jrdf.graph.GraphElementFactory valueFactory,
org.jrdf.parser.ParserBlankNodeFactory parserBlankNodeFactory)
throws org.jrdf.graph.GraphException
valueFactory - A GraphElementFactory.parserBlankNodeFactory - A ParserBlankNodeFactory.org.jrdf.graph.GraphException - Graph Exceptionpublic void setStatementHandler(org.jrdf.parser.StatementHandler sh)
setStatementHandler in interface org.jrdf.parser.StatementHandlerConfigurationpublic void setParseErrorListener(org.jrdf.parser.ParseErrorListener el)
setParseErrorListener in interface org.jrdf.parser.ParserConfigurationpublic void setParseLocationListener(org.jrdf.parser.ParseLocationListener ll)
setParseLocationListener in interface org.jrdf.parser.ParserConfigurationpublic void setNamespaceListener(org.jrdf.parser.NamespaceListener nl)
setNamespaceListener in interface org.jrdf.parser.ParserConfigurationpublic void setVerifyData(boolean verifyData)
setVerifyData in interface org.jrdf.parser.ParserConfigurationpublic void setPreserveBNodeIds(boolean preserveBNodeIds)
setPreserveBNodeIds in interface org.jrdf.parser.ParserConfigurationpublic void setStopAtFirstError(boolean stopAtFirstError)
setStopAtFirstError in interface org.jrdf.parser.ParserConfigurationpublic void setDatatypeHandling(int datatypeHandling)
setDatatypeHandling in interface org.jrdf.parser.ParserConfigurationpublic void setParseStandAloneDocuments(boolean standAloneDocs)
setParseStandAloneDocuments in interface org.jrdf.parser.ParserConfigurationpublic boolean getParseStandAloneDocuments()
setParseStandAloneDocuments(boolean)public void parse(InputStream in, String baseURI) throws IOException, org.jrdf.parser.ParseException, org.jrdf.parser.StatementHandlerException
parse in interface org.jrdf.parser.Parserin - The InputStream from which to read the data.baseURI - The URI associated with the data in the InputStream.IOException - If an I/O error occurred while data was read
from the InputStream.org.jrdf.parser.ParseException - If the parser has found an unrecoverable
parse error.org.jrdf.parser.StatementHandlerException - If the configured statement handler
encountered an unrecoverable error.IllegalArgumentException - If the supplied input stream or
base URI is null.public void parse(Reader reader, String baseURI) throws IOException, org.jrdf.parser.ParseException, org.jrdf.parser.StatementHandlerException
parse in interface org.jrdf.parser.Parserreader - The Reader from which to read the data.baseURI - The URI associated with the data in the InputStream.IOException - If an I/O error occurred while data was read
from the InputStream.org.jrdf.parser.ParseException - If the parser has found an unrecoverable
parse error.org.jrdf.parser.StatementHandlerException - If the configured statement handler
has encountered an unrecoverable error.IllegalArgumentException - If the supplied reader or base URI
is null.void setBaseURI(URI baseURI)
void setXmlLang(String xmlLang)
void startElement(String namespaceURI, String localName, String qName, Atts atts) throws SAXException
SAXExceptionvoid endElement(String namespaceURI, String localName, String qName) throws SAXException
SAXExceptionvoid emptyElement(String namespaceURI, String localName, String qName, Atts atts) throws SAXException
SAXExceptionvoid text(String text) throws SAXException
SAXExceptionvoid sendWarning(String msg)
void sendError(String msg) throws SAXException
SAXExceptionvoid sendFatalError(String msg) throws SAXException
SAXExceptionEDB Working Group at Mon Dec 15 16:45:05 JST 2025