nz.ac.waikato.mcennis.rat.parser.xmlHandler
Class GraphReader

java.lang.Object
  extended by org.xml.sax.helpers.DefaultHandler
      extended by nz.ac.waikato.mcennis.rat.parser.xmlHandler.Handler
          extended by nz.ac.waikato.mcennis.rat.parser.xmlHandler.GraphReader
All Implemented Interfaces:
org.xml.sax.ContentHandler, org.xml.sax.DTDHandler, org.xml.sax.EntityResolver, org.xml.sax.ErrorHandler

public class GraphReader
extends Handler

SAX XML parser that reads serialized MemGraph graphs. The DTD of the file created is as follows:

 
 <!DOCTYPE dataObject [
   <!ELEMENT dataObject (graph)>
   <!ELEMENT graph (graphClass,graphName,graphProperties*,pathSet*,user*,userLink*,graph*)>
   <!ELEMENT graphClass (#PCDATA)>
   <!ELEMENT graphName (#PCDATA)>
   <!ELEMENT graphProperties (gClass,gValueClass,gType,gValue+)>
   <!ELEMENT gClass (#PCDATA)>
   <!ELEMENT gValueClass (#PCDATA)>
   <!ELEMENT gType (#PCDATA)>
   <!ELEMENT gValue (#PCDATA)>
   <!ELEMENT pathSet (path+)>
   <!ELEMENT path (actor+)>
   <!ELEMENT actor (actorType,actorID)>
   <!ELEMENT actorType (#PCDATA)>
   <!ELEMENT actorID (#PCDATA)>
   <!ELEMENT user (userClass,ID,properties*,page*)>
   <!ELEMENT ID (#PCDATA)>
   <!ELEMENT properties (propertiesClass,valueClass,type,value*)>
   <!ELEMENT type (#PCDATA)>
   <!ELEMENT value (#PCDATA)>
   <!ELEMENT valueClass (#PCDATA)>
   <!ELEMENT userLink (uClass,uStrength,uSourceType,uSourceID,uDestinationType,uDestinationID,uProperties)>
   <!ELEMENT uClass (#PCDATA)>
   <!ELEMENT uSourceType (#PCDATA)>
   <!ELEMENT uSourceID (#PCDATA)>
   <!ELEMENT uStrength (#PCDATA)>
   <!ELEMENT uDestinationType (#PCDATA)>
   <!ELEMENT uDestinationID (#PCDATA)>
   <!ELEMENT uProperties (uPropertiesClass,uValueClass,uPropertiesType,uPropertiesValue+)>
   <!ELEMENT uPropertiesClass (#PCDATA)>
   <!ELEMENT uPropertiesValueClass (#PCDATA)>
   <!ELEMENT uPropertiesType (#PCDATA)>
   <!ELEMENT uPropertiesValue (#PCDATA)>
   <!ELEMENT page (#PCDATA)>
 ]>
 
FIX: page should allow a type declaration


Field Summary
 
Fields inherited from class nz.ac.waikato.mcennis.rat.parser.xmlHandler.Handler
properties, site
 
Constructor Summary
GraphReader()
          Creates a new instance of MemGraphReader
 
Method Summary
 void characters(char[] ch, int start, int length)
           
 Handler duplicate()
          Create a complete duplicate of this class
 void endDocument()
           
 void endElement(java.lang.String uri, java.lang.String localName, java.lang.String qName)
           
 ParsedObject get()
          Return the underlying parsed object
 void set(ParsedObject o)
          Set the underlying parsed object for parsing
 void setDocumentLocator(org.xml.sax.Locator locator)
           
 void setGraph(Graph type)
          Set the graph from which to load the data from the parsed object
 void startDocument()
           
 void startElement(java.lang.String uri, java.lang.String localName, java.lang.String qName, org.xml.sax.Attributes attributes)
           
 
Methods inherited from class nz.ac.waikato.mcennis.rat.parser.xmlHandler.Handler
check, check, error, fatalError, getName, getParameter, getParameter, init, setCrawler, setName, setProperties, warning
 
Methods inherited from class org.xml.sax.helpers.DefaultHandler
endPrefixMapping, ignorableWhitespace, notationDecl, processingInstruction, resolveEntity, skippedEntity, startPrefixMapping, unparsedEntityDecl
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GraphReader

public GraphReader()
Creates a new instance of MemGraphReader

Method Detail

startElement

public void startElement(java.lang.String uri,
                         java.lang.String localName,
                         java.lang.String qName,
                         org.xml.sax.Attributes attributes)
                  throws org.xml.sax.SAXException
Specified by:
startElement in interface org.xml.sax.ContentHandler
Overrides:
startElement in class org.xml.sax.helpers.DefaultHandler
Throws:
org.xml.sax.SAXException

startDocument

public void startDocument()
                   throws org.xml.sax.SAXException
Specified by:
startDocument in interface org.xml.sax.ContentHandler
Overrides:
startDocument in class org.xml.sax.helpers.DefaultHandler
Throws:
org.xml.sax.SAXException

get

public ParsedObject get()
Description copied from class: Handler
Return the underlying parsed object

Specified by:
get in class Handler
Returns:
parsed object

endElement

public void endElement(java.lang.String uri,
                       java.lang.String localName,
                       java.lang.String qName)
                throws org.xml.sax.SAXException
Specified by:
endElement in interface org.xml.sax.ContentHandler
Overrides:
endElement in class org.xml.sax.helpers.DefaultHandler
Throws:
org.xml.sax.SAXException

endDocument

public void endDocument()
                 throws org.xml.sax.SAXException
Specified by:
endDocument in interface org.xml.sax.ContentHandler
Overrides:
endDocument in class org.xml.sax.helpers.DefaultHandler
Throws:
org.xml.sax.SAXException

characters

public void characters(char[] ch,
                       int start,
                       int length)
                throws org.xml.sax.SAXException
Specified by:
characters in interface org.xml.sax.ContentHandler
Overrides:
characters in class org.xml.sax.helpers.DefaultHandler
Throws:
org.xml.sax.SAXException

setGraph

public void setGraph(Graph type)
Set the graph from which to load the data from the parsed object

Parameters:
type - graph to be loaded by this parser

duplicate

public Handler duplicate()
Description copied from class: Handler
Create a complete duplicate of this class

Specified by:
duplicate in class Handler
Returns:
deep copy of the original.

set

public void set(ParsedObject o)
Description copied from class: Handler
Set the underlying parsed object for parsing

Specified by:
set in class Handler
Parameters:
o - underlying parsed object

setDocumentLocator

public void setDocumentLocator(org.xml.sax.Locator locator)
Specified by:
setDocumentLocator in interface org.xml.sax.ContentHandler
Overrides:
setDocumentLocator in class org.xml.sax.helpers.DefaultHandler

Get Relational Analysis Toolkit at SourceForge.net. Fast, secure and Free Open Source software downloads