edu.stanford.db.rdf.syntax.generic
Class TripleParser
java.lang.Object
|
+--org.xml.sax.helpers.DefaultHandler
|
+--edu.stanford.db.xml.util.GenericParser
|
+--edu.stanford.db.rdf.syntax.generic.GenericXML2RDF
|
+--edu.stanford.db.rdf.syntax.generic.TripleParser
- All Implemented Interfaces:
- ContentHandler, DTDHandler, EntityResolver, ErrorHandler, RDFParser
- public class TripleParser
- extends GenericXML2RDF
Field Summary |
static java.lang.String |
NS
|
Method Summary |
protected Statement |
createStatement(Resource subject,
Resource predicate,
RDFNode object)
|
void |
endDocument()
Receive notification of the end of a document. |
void |
endElement(java.lang.String uri,
java.lang.String local,
java.lang.String qname)
Receive notification of the end of an element. |
static void |
main(java.lang.String[] args)
|
void |
startDocument()
Receive notification of the beginning of a document. |
void |
startElement(java.lang.String uri,
java.lang.String local,
java.lang.String qname,
Attributes attr)
Receive notification of the beginning of an element. |
Methods inherited from class edu.stanford.db.xml.util.GenericParser |
_endElement, _startElement, addError, addNamespace, addWarning, characters, create, createElement, createQName, createXMLReader, createXMLReader, getDefaultParserClass, getInputSource, getNamespaces, getParserClass, getSourceURI, initXMLParser, preserveWhiteSpace, resolveEntity, setErrorHandler |
Methods inherited from class org.xml.sax.helpers.DefaultHandler |
endPrefixMapping, error, fatalError, ignorableWhitespace, notationDecl, processingInstruction, setDocumentLocator, skippedEntity, startPrefixMapping, unparsedEntityDecl, warning |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
NS
public static final java.lang.String NS
TripleParser
public TripleParser()
startDocument
public void startDocument()
throws SAXException
- Description copied from interface:
ContentHandler
- Receive notification of the beginning of a document.
The SAX parser will invoke this method only once, before any
other methods in this interface or in DTDHandler
(except for setDocumentLocator
).
- Overrides:
startDocument
in class org.xml.sax.helpers.DefaultHandler
- Following copied from interface:
org.xml.sax.ContentHandler
- Throws:
SAXException
- Any SAX exception, possibly
wrapping another exception.- See Also:
ContentHandler.endDocument()
endDocument
public void endDocument()
throws SAXException
- Description copied from interface:
ContentHandler
- Receive notification of the end of a document.
The SAX parser will invoke this method only once, and it will
be the last method invoked during the parse. The parser shall
not invoke this method until it has either abandoned parsing
(because of an unrecoverable error) or reached the end of
input.
- Overrides:
endDocument
in class org.xml.sax.helpers.DefaultHandler
- Following copied from interface:
org.xml.sax.ContentHandler
- Throws:
SAXException
- Any SAX exception, possibly
wrapping another exception.- See Also:
ContentHandler.startDocument()
startElement
public void startElement(java.lang.String uri,
java.lang.String local,
java.lang.String qname,
Attributes attr)
throws SAXException
- Description copied from interface:
ContentHandler
- Receive notification of the beginning of an element.
The Parser will invoke this method at the beginning of every
element in the XML document; there will be a corresponding
endElement
event for every startElement event
(even when the element is empty). All of the element's content will be
reported, in order, before the corresponding endElement
event.
This event allows up to three name components for each
element:
- the Namespace URI;
- the local name; and
- the qualified (prefixed) name.
Any or all of these may be provided, depending on the
values of the http://xml.org/sax/features/namespaces
and the http://xml.org/sax/features/namespace-prefixes
properties:
- the Namespace URI and local name are required when
the namespaces property is true (the default), and are
optional when the namespaces property is false (if one is
specified, both must be);
- the qualified name is required when the namespace-prefixes property
is true, and is optional when the namespace-prefixes property
is false (the default).
Note that the attribute list provided will contain only
attributes with explicit values (specified or defaulted):
#IMPLIED attributes will be omitted. The attribute list
will contain attributes used for Namespace declarations
(xmlns* attributes) only if the
http://xml.org/sax/features/namespace-prefixes
property is true (it is false by default, and support for a
true value is optional).
- Overrides:
startElement
in class GenericParser
- Following copied from interface:
org.xml.sax.ContentHandler
- Parameters:
uri
- The Namespace URI, or the empty string if the
element has no Namespace URI or if Namespace
processing is not being performed.localName
- The local name (without prefix), or the
empty string if Namespace processing is not being
performed.qName
- The qualified name (with prefix), or the
empty string if qualified names are not available.atts
- The attributes attached to the element. If
there are no attributes, it shall be an empty
Attributes object.- Throws:
SAXException
- Any SAX exception, possibly
wrapping another exception.- See Also:
ContentHandler.endElement(java.lang.String, java.lang.String, java.lang.String)
,
Attributes
endElement
public void endElement(java.lang.String uri,
java.lang.String local,
java.lang.String qname)
throws SAXException
- Description copied from interface:
ContentHandler
- Receive notification of the end of an element.
The SAX parser will invoke this method at the end of every
element in the XML document; there will be a corresponding
startElement
event for every endElement
event (even when the element is empty).
For information on the names, see startElement.
- Overrides:
endElement
in class GenericParser
- Following copied from interface:
org.xml.sax.ContentHandler
- Parameters:
uri
- The Namespace URI, or the empty string if the
element has no Namespace URI or if Namespace
processing is not being performed.localName
- The local name (without prefix), or the
empty string if Namespace processing is not being
performed.qName
- The qualified XML 1.0 name (with prefix), or the
empty string if qualified names are not available.- Throws:
SAXException
- Any SAX exception, possibly
wrapping another exception.
createStatement
protected Statement createStatement(Resource subject,
Resource predicate,
RDFNode object)
throws ModelException
- Overrides:
createStatement
in class GenericXML2RDF
main
public static void main(java.lang.String[] args)
throws java.lang.Exception