Alignment API and Server 4.0

fr.inrialpes.exmo.align.parser
Class AlignmentParser

java.lang.Object
  extended by fr.inrialpes.exmo.align.parser.AlignmentParser

public class AlignmentParser
extends Object

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( input ); input can be a URI as a String, an InputStream This new version (January 2004) parses the alignment description in RDF/XML/OWL format and RDF format. It understands the EDOAL format.


Field Summary
protected  int alignLevel
          The level at which we found the Alignment tag.
protected  Alignment alignment
          the alignment that is parsed We always create a URIAlignment (we could also use a BasicAlignment).
protected  int debugMode
          level of debug/warning information
protected  boolean embedded
          The parsing level, if equal to 3 we are in the Alignment if equal to 5 we are in a cell and can find metadata
protected  int parseLevel
          The parsing level, if equal to 3 we are in the Alignment if equal to 5 we are in a cell and can find metadata
protected  String uri
          a URI to a process
 
Constructor Summary
AlignmentParser(int debugMode)
          Creates a Parser.
 
Method Summary
private  Alignment callParser(Object o)
          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.
private  Alignment callParser(RDFParser p, Object o)
           
private  Alignment callParser(XMLParser p, Object o)
          This dispatch is ridiculous, but that's life
 void initAlignment(URIAlignment al)
          Allows to have the parser filling an existing alignment instead of creating a new one
 Alignment parse(InputStream s)
          Parses an inputStream
 Alignment parse(Reader r)
          Parses a the content of a reader
 Alignment parse(String uri)
          Parses a URI expressed as a String
 Alignment parse(String uri, Hashtable loaded)
          Deprecated. use parse( URI ) instead
 Alignment parse(URI uri)
          Parses a URI
 Alignment parseString(String s)
          Parses the content of a string
 void setEmbedded(boolean b)
           
 
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 String uri
a URI to a process


alignment

protected Alignment alignment
the alignment that is parsed We always create a URIAlignment (we could also use a BasicAlignment). This is a pitty but the idea of creating a particular alignment is not in accordance with using an interface.


parseLevel

protected int parseLevel
The parsing level, if equal to 3 we are in the Alignment if equal to 5 we are in a cell and can find metadata


embedded

protected boolean embedded
The parsing level, if equal to 3 we are in the Alignment if equal to 5 we are in a cell and can find metadata


alignLevel

protected int alignLevel
The level at which we found the Alignment tag. It is -1 outside the alignment.

Constructor Detail

AlignmentParser

public AlignmentParser(int debugMode)
Creates a Parser.

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

setEmbedded

public void setEmbedded(boolean b)

parse

@Deprecated
public Alignment parse(String uri,
                                  Hashtable loaded)
                throws AlignmentException
Deprecated. use parse( URI ) instead

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
loaded - (cached ontologies)
Throws:
AlignmentException

callParser

private Alignment callParser(Object o)
                      throws AlignmentException
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:
AlignmentException

callParser

private Alignment callParser(XMLParser p,
                             Object o)
                      throws AlignmentException
This dispatch is ridiculous, but that's life

Throws:
AlignmentException

callParser

private Alignment callParser(RDFParser p,
                             Object o)
                      throws AlignmentException
Throws:
AlignmentException

parseString

public Alignment parseString(String s)
                      throws AlignmentException
Parses the content of a string

Parameters:
s - String the string to parse
Throws:
AlignmentException

parse

public Alignment parse(Reader r)
                throws AlignmentException
Parses a the content of a reader

Parameters:
r - the reader to parse
Throws:
AlignmentException

parse

public Alignment parse(String uri)
                throws AlignmentException
Parses a URI expressed as a String

Parameters:
uri - the URI as a String This is only here for compatibility purposes
Throws:
AlignmentException

parse

public Alignment parse(URI uri)
                throws AlignmentException
Parses a URI

Parameters:
uri - the URI
Throws:
AlignmentException

parse

public Alignment parse(InputStream s)
                throws AlignmentException
Parses an inputStream

Parameters:
s - the Stream to parse
Throws:
AlignmentException

initAlignment

public void initAlignment(URIAlignment al)
Allows to have the parser filling an existing alignment instead of creating a new one

Parameters:
al - URIAlignment the alignment to be returned by the parser Note that this function is also useful for reseting the parser and using it once again by parser.initAlignment( null ) Otherwise, this may lead to errors.

Alignment API and Server 4.0

(C) INRIA & friends, 2003-2010