org.w3c.rdf.implementation.syntax.strawman
Class StrawmanParser

java.lang.Object
  |
  +--org.w3c.rdf.util.xml.GenericParser
        |
        +--org.w3c.rdf.implementation.syntax.strawman.StrawmanParser
All Implemented Interfaces:
DocumentHandler, DTDHandler, EntityResolver, RDFParser

public class StrawmanParser
extends GenericParser

A parser for a simplified syntax for RDF. Supports arbitrary XML files. Uses three control attributes:

  1. rdf:instance: specifes that a tag denotes an instance of a class
  2. rdf:for: specifes the subject URI of the property
  3. rdf:resource: specifes the object URI of the property


Field Summary
static java.lang.String RDF_FOR
           
static java.lang.String RDF_INSTANCE
           
static java.lang.String RDF_RESOURCE
           
static java.lang.String REVISION
           
 
Fields inherited from class org.w3c.rdf.util.xml.GenericParser
consumer, current, errorHandler, locator, namespaceStack, nodeFactory, source
 
Constructor Summary
StrawmanParser()
           
StrawmanParser(boolean useDigests, boolean warn)
           
 
Method Summary
 void characters(char[] ch, int start, int length)
          Receive notification of character data.
protected  Element createElement()
           
protected  void createStatement(Resource subject, Resource predicate, RDFNode object)
           
 void endElement(java.lang.String name)
          Receive notification of the end of an element.
static void main(java.lang.String[] args)
           
 void startElement(java.lang.String name, AttributeList al)
          Receive notification of the beginning of an element.
protected  void updateDigest(StrawElement current, StrawArc arc)
           
 
Methods inherited from class org.w3c.rdf.util.xml.GenericParser
_endElement, _main, _startElement, addError, addWarning, createParser, doctype, endDocument, getInputSource, getNamespaces, getQualifiedName, getQualifiedName, getSourceURI, ignorableWhitespace, initXMLParser, notationDecl, parse, preserveWhiteSpace, processingInstruction, resolveEntity, setDocumentLocator, setErrorHandler, startDocument, unparsedEntityDecl, updateNamespaceStack
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

REVISION

public static final java.lang.String REVISION

RDF_INSTANCE

public static final java.lang.String RDF_INSTANCE

RDF_RESOURCE

public static final java.lang.String RDF_RESOURCE

RDF_FOR

public static final java.lang.String RDF_FOR
Constructor Detail

StrawmanParser

public StrawmanParser()

StrawmanParser

public StrawmanParser(boolean useDigests,
                      boolean warn)
Method Detail

startElement

public void startElement(java.lang.String name,
                         AttributeList al)
                  throws SAXException
Description copied from interface: DocumentHandler
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.

If the element name has a namespace prefix, the prefix will still be attached. Note that the attribute list provided will contain only attributes with explicit values (specified or defaulted): #IMPLIED attributes will be omitted.

Overrides:
startElement in class GenericParser
Following copied from interface: org.xml.sax.DocumentHandler
Parameters:
name - The element type name.
atts - The attributes attached to the element, if any.
Throws:
SAXException - Any SAX exception, possibly wrapping another exception.
See Also:
DocumentHandler.endElement(java.lang.String), AttributeList

endElement

public void endElement(java.lang.String name)
                throws SAXException
Description copied from interface: DocumentHandler
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).

If the element name has a namespace prefix, the prefix will still be attached to the name.

Overrides:
endElement in class GenericParser
Following copied from interface: org.xml.sax.DocumentHandler
Parameters:
name - The element type name
Throws:
SAXException - Any SAX exception, possibly wrapping another exception.

updateDigest

protected void updateDigest(StrawElement current,
                            StrawArc arc)
                     throws DigestException

createStatement

protected void createStatement(Resource subject,
                               Resource predicate,
                               RDFNode object)
                        throws ModelException
Overrides:
createStatement in class GenericParser

characters

public void characters(char[] ch,
                       int start,
                       int length)
                throws SAXException
Description copied from interface: DocumentHandler
Receive notification of character data.

The Parser will call this method to report each chunk of character data. SAX parsers may return all contiguous character data in a single chunk, or they may split it into several chunks; however, all of the characters in any single event must come from the same external entity, so that the Locator provides useful information.

The application must not attempt to read from the array outside of the specified range.

Note that some parsers will report whitespace using the ignorableWhitespace() method rather than this one (validating parsers must do so).

Overrides:
characters in class GenericParser
Following copied from interface: org.xml.sax.DocumentHandler
Parameters:
ch - The characters from the XML document.
start - The start position in the array.
length - The number of characters to read from the array.
Throws:
SAXException - Any SAX exception, possibly wrapping another exception.
See Also:
DocumentHandler.ignorableWhitespace(char[], int, int), Locator

createElement

protected Element createElement()
Overrides:
createElement in class GenericParser

main

public static void main(java.lang.String[] args)
                 throws java.lang.Exception