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

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.FOAF2Graph
All Implemented Interfaces:
org.xml.sax.ContentHandler, org.xml.sax.DTDHandler, org.xml.sax.EntityResolver, org.xml.sax.ErrorHandler

public class FOAF2Graph
extends Handler

SAX XML parser for reading FOAF files of the LiveJournal dialect. See the DataAquisition modules CrawlLastFM, FileReader, or FileReader2 for a description of the modes, relations, and property IDs produced by this parser. TODO: include a DTD of the LiveJournal FOAF.


Constructor Summary
FOAF2Graph()
          Create a new Parser using the default graph
FOAF2Graph(Graph m)
          Create a new Parser using this graph to load data into
FOAF2Graph(Graph m, WebCrawler c)
          Create a new Parser using this graph and parsing new FOAF sites using this crawler
 
Method Summary
 void characters(char[] arg0, int arg1, int arg2)
           
 Handler duplicate()
          Create a complete duplicate of this class
 void endDocument()
           
 void endElement(java.lang.String arg0, java.lang.String arg1, java.lang.String arg2)
           
 ParsedObject get()
          Return the underlying parsed object
 Crawler getCrawler()
          Return the crawler used or null if none is assigned.
 void set(ParsedObject o)
          Set the underlying parsed object for parsing
 void setActorClass(java.lang.String actorClass)
          Set the class used to create new actors
 void setActorType(java.lang.String actorType)
          Set the type (mode) of new actors
 void setCrawler(Crawler crawler)
          Set the crawler to be used for spidering new pages
 void setGraph(Graph foaf)
          Set this graph for loading.
 void setLinkClass(java.lang.String linkClass)
          Class of Link used for new Links
 void setLinkType(java.lang.String linkType)
          Type (relation) to use for new links
 void setPropertyClass(java.lang.String propertyClass)
          Class of Property to use
 void startDocument()
           
 void startElement(java.lang.String arg0, java.lang.String arg1, java.lang.String arg2, org.xml.sax.Attributes arg3)
           
 
Methods inherited from class nz.ac.waikato.mcennis.rat.parser.xmlHandler.Handler
error, fatalError, warning
 
Methods inherited from class org.xml.sax.helpers.DefaultHandler
endPrefixMapping, ignorableWhitespace, notationDecl, processingInstruction, resolveEntity, setDocumentLocator, skippedEntity, startPrefixMapping, unparsedEntityDecl
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FOAF2Graph

public FOAF2Graph()
Create a new Parser using the default graph


FOAF2Graph

public FOAF2Graph(Graph m)
Create a new Parser using this graph to load data into

Parameters:
m - graph to be loaded

FOAF2Graph

public FOAF2Graph(Graph m,
                  WebCrawler c)
Create a new Parser using this graph and parsing new FOAF sites using this crawler

Parameters:
m - graph to be loaded
c - crawler to parse new sites
Method Detail

getCrawler

public Crawler getCrawler()
Return the crawler used or null if none is assigned.

Returns:
crawler assigned to this object

setCrawler

public void setCrawler(Crawler crawler)
Description copied from class: Handler
Set the crawler to be used for spidering new pages

Overrides:
setCrawler in class Handler
Parameters:
crawler - crawler to be parsing.

get

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

Specified by:
get in class Handler
Returns:
parsed object

setGraph

public void setGraph(Graph foaf)
Set this graph for loading.

Parameters:
foaf - graph to be loaded.

characters

public void characters(char[] arg0,
                       int arg1,
                       int arg2)
                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

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

endElement

public void endElement(java.lang.String arg0,
                       java.lang.String arg1,
                       java.lang.String arg2)
                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

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

startElement

public void startElement(java.lang.String arg0,
                         java.lang.String arg1,
                         java.lang.String arg2,
                         org.xml.sax.Attributes arg3)
                  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

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

setActorClass

public void setActorClass(java.lang.String actorClass)
Set the class used to create new actors

Parameters:
actorClass - classname of actors to be created

setActorType

public void setActorType(java.lang.String actorType)
Set the type (mode) of new actors

Parameters:
actorType - mode of new actors

setLinkClass

public void setLinkClass(java.lang.String linkClass)
Class of Link used for new Links

Parameters:
linkClass - class name for new links

setLinkType

public void setLinkType(java.lang.String linkType)
Type (relation) to use for new links

Parameters:
linkType - type (relation) of new links

setPropertyClass

public void setPropertyClass(java.lang.String propertyClass)
Class of Property to use

Parameters:
propertyClass - class name of property to use for new properties