INRIA & friends

fr.inrialpes.exmo.align.parser
Class AlignmentParser

java.lang.Object
  extended byorg.xml.sax.helpers.DefaultHandler
      extended byfr.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  BasicAlignment alignment
          the alignment that is parsed We always create a BasicAlignment.
protected  Cell cell
          the relation content as text...
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 id
          the cell id as text...
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  int parselevel
          The parsing level, if equal to 2 we are in the Alignment and can find metadata
protected  javax.xml.parsers.SAXParser parser
          XML Parser 1
protected  java.lang.String relation
          the relation content as text...
protected  java.lang.String sem
          the semantics of the cell (default first-order)...
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.net.URI 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 BasicAlignment 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


cell

protected Cell cell
the relation content as text...


relation

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


id

protected java.lang.String id
the cell id as text...


sem

protected java.lang.String sem
the semantics of the cell (default first-order)...


measure

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


parser

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


parselevel

protected int parselevel
The parsing level, if equal to 2 we are in the Alignment and can find metadata

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
Throws:
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.

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
Throws:
org.xml.sax.SAXException

getEntity

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

characters

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


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.

Parameters:
namespaceURI - The namespace of the current element
pName - The local name of the current element
Throws:
org.xml.sax.SAXException

loadOntology

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

Throws:
org.xml.sax.SAXException
OWLException

INRIA & friends

..no bottom yet...