uk.ac.ebi.ep.mm.app
Class EbeyeSaxParser

java.lang.Object
  extended by org.xml.sax.helpers.DefaultHandler
      extended by uk.ac.ebi.ep.mm.app.EbeyeSaxParser
All Implemented Interfaces:
ContentHandler, DTDHandler, EntityResolver, ErrorHandler, MmParser

public class EbeyeSaxParser
extends org.xml.sax.helpers.DefaultHandler
implements MmParser

Parser for EB-Eye XML files to populate a mega-map. Currently, this implementation has been used with ChEBI and ChEMBL-target files (ChEMBL target is the only one for this database which links compounds with protein IDs).

Author:
rafa

Constructor Summary
EbeyeSaxParser()
           
 
Method Summary
 void characters(char[] ch, int start, int length)
           
 void endElement(String uri, String localName, String qName)
           
protected  String getCurrentXpath()
           
static void main(String... args)
          Parses a EB-Eye XML file and indexes/stores the entry IDs, accessions and xrefs into a mega-map.
 void parse(String xmlFile)
          Parses a XML file and extracts interesting data into a mega-map.
 void setWriter(MegaMapper writer)
          Sets a writer to make the mega-map persistent.
 void startElement(String uri, String localName, String qName, Attributes attributes)
           
 
Methods inherited from class org.xml.sax.helpers.DefaultHandler
endDocument, endPrefixMapping, error, fatalError, ignorableWhitespace, notationDecl, processingInstruction, resolveEntity, setDocumentLocator, skippedEntity, startDocument, startPrefixMapping, unparsedEntityDecl, warning
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EbeyeSaxParser

public EbeyeSaxParser()
Method Detail

main

public static void main(String... args)
                 throws Exception
Parses a EB-Eye XML file and indexes/stores the entry IDs, accessions and xrefs into a mega-map.

Parameters:
args - see CliOptionsParser.getCommandLine(String...)
Throws:
Exception - in case of error while parsing.

parse

public void parse(String xmlFile)
           throws Exception
Description copied from interface: MmParser
Parses a XML file and extracts interesting data into a mega-map.

Specified by:
parse in interface MmParser
Parameters:
xmlFile - an XML file.
Throws:
Exception

startElement

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

characters

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

endElement

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

setWriter

public void setWriter(MegaMapper writer)
Description copied from interface: MmParser
Sets a writer to make the mega-map persistent.

Specified by:
setWriter in interface MmParser

getCurrentXpath

protected String getCurrentXpath()


Copyright © 2012 EMBL-EBI. All Rights Reserved.