INRIA & UMontrŽal

fr.inrialpes.exmo.align.parser
Class AlignmentParser

java.lang.Object
  |
  +--org.xml.sax.helpers.DefaultHandler
        |
        +--fr.inrialpes.exmo.align.parser.AlignmentParser
All Implemented Interfaces:
org.xml.sax.ContentHandler, org.xml.sax.DTDHandler, org.xml.sax.EntityResolver, org.xml.sax.ErrorHandler

public class AlignmentParser
extends org.xml.sax.helpers.DefaultHandler

This class allows the creation of a parser for an Alignment file. The class is called by: AlignmentParser parser = new AlignmentParser( debugLevel ); Alignment alignment = parser.parse( uri ); This new version (January 2004) parses the alignment description in RDF/XML/OWL format


Field Summary
protected  Alignment alignment
          the alignment that is parsed We always create a BasicAlignment.
protected  OWLEntity cl1
          the first entity of a cell
protected  OWLEntity cl2
          the second entity of a cell
protected  java.lang.String content
          the content found as text...
protected  int debugMode
          level of debug/warning information
protected  java.lang.String measure
          the measure content as text...
(package private)  OWLOntology onto1
          the first Ontology
(package private)  OWLOntology onto2
          the second Ontology
protected  java.util.Hashtable ontologies
          The currently loaded ontologies
protected  javax.xml.parsers.SAXParser parser
          XML Parser 1
protected  java.lang.String relation
          the relation content as text...
protected  java.lang.String uri
          a URI to a process
 
Constructor Summary
AlignmentParser(int debugMode)
          Creates an XML Parser.
 
Method Summary
 void characters(char[] ch, int start, int length)
          Put the content in a variable
 void endElement(java.lang.String namespaceURI, java.lang.String pName, java.lang.String qName)
          Called by the XML parser at the end of an element.
private  OWLEntity getEntity(OWLOntology ontology, java.lang.String name)
           
private  OWLOntology loadOntology(java.lang.String ref)
          Can be used for loading the ontology if it is not available
 Alignment parse(java.lang.String uri, java.util.Hashtable loaded)
          Parses the document corresponding to the URI given in parameter If the current process has links (import or include) to others documents then they are parsed.
 void startElement(java.lang.String namespaceURI, java.lang.String pName, java.lang.String qname, org.xml.sax.Attributes atts)
          Called by the XML parser at the begining of an element.
 
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
 

Field Detail

debugMode

protected int debugMode
level of debug/warning information


uri

protected java.lang.String uri
a URI to a process


onto1

OWLOntology onto1
the first Ontology


onto2

OWLOntology onto2
the second Ontology


ontologies

protected java.util.Hashtable ontologies
The currently loaded ontologies


alignment

protected Alignment alignment
the alignment that is parsed We always create a BasicAlignment. This is a pitty but the idea of creating a particular alignment is not in accordance with using an interface.


content

protected java.lang.String content
the content found as text...


cl1

protected OWLEntity cl1
the first entity of a cell


cl2

protected OWLEntity cl2
the second entity of a cell


relation

protected java.lang.String relation
the relation content as text...


measure

protected java.lang.String measure
the measure content as text...


parser

protected javax.xml.parsers.SAXParser parser
XML Parser 1

Constructor Detail

AlignmentParser

public AlignmentParser(int debugMode)
                throws javax.xml.parsers.ParserConfigurationException,
                       org.xml.sax.SAXException
Creates an XML Parser.

Parameters:
debugMode - The value of the debug mode
Method Detail

parse

public Alignment parse(java.lang.String uri,
                       java.util.Hashtable loaded)
                throws org.xml.sax.SAXException,
                       java.io.IOException
Parses the document corresponding to the URI given in parameter If the current process has links (import or include) to others documents then they are parsed.

Parameters:
uri - URI of the document to parse
org.xml.sax.SAXException
java.io.IOException

startElement

public void startElement(java.lang.String namespaceURI,
                         java.lang.String pName,
                         java.lang.String qname,
                         org.xml.sax.Attributes atts)
                  throws org.xml.sax.SAXException
Called by the XML parser at the begining of an element. The corresponing graph component is create for each element.

Specified by:
startElement in interface org.xml.sax.ContentHandler
Overrides:
startElement in class org.xml.sax.helpers.DefaultHandler
Parameters:
namespaceURI - The namespace of the current element
pName - The local name of the current element
qname - The name of the current element
atts - The attributes name of the current element
org.xml.sax.SAXException

getEntity

private OWLEntity getEntity(OWLOntology ontology,
                            java.lang.String name)
                     throws OWLException,
                            org.xml.sax.SAXException
OWLException
org.xml.sax.SAXException

characters

public void characters(char[] ch,
                       int start,
                       int length)
Put the content in a variable

Specified by:
characters in interface org.xml.sax.ContentHandler
Overrides:
characters in class org.xml.sax.helpers.DefaultHandler

endElement

public void endElement(java.lang.String namespaceURI,
                       java.lang.String pName,
                       java.lang.String qName)
                throws org.xml.sax.SAXException
Called by the XML parser at the end of an element.

Specified by:
endElement in interface org.xml.sax.ContentHandler
Overrides:
endElement in class org.xml.sax.helpers.DefaultHandler
Parameters:
namespaceURI - The namespace of the current element
pName - The local name of the current element
org.xml.sax.SAXException

loadOntology

private OWLOntology loadOntology(java.lang.String ref)
                          throws org.xml.sax.SAXException
Can be used for loading the ontology if it is not available

org.xml.sax.SAXException

INRIA & UMontrŽal

..no bottom yet...