de.fzi.kadmos.parser.impl
Class INRIAFormatParser

java.lang.Object
  extended by de.fzi.kadmos.parser.impl.INRIAFormatParser
All Implemented Interfaces:
AlignmentParser

public final class INRIAFormatParser
extends Object
implements AlignmentParser

Parser that reads and parses the INRIA alignment format from an XML representation.

Instances of this parser can only be obtained by the #getInstance(Reader) method. Each instance is immutably associated with a particular input source, specified by a Reader. However, an existing instance can be modified by specifying a particular CorrespondenceFactory.

The parser uses the SimpleCorrespondenceFactory for creating correspondence objects in case no specific CorrespondenceFactory is set via setCorrespondenceFactory(CorrespondenceFactory).

Since:
1.0.0
Version:
1.3.0
Author:
Juergen Bock, Matthias Stumpp
See Also:
http://alignapi.gforge.inria.fr/format.html

Method Summary
static INRIAFormatParser getInstance()
          Gets a (new) instance of this parser.
 Alignment parse(File file)
          Parses an alignment and creates a new Alignment object.
 Alignment parse(InputSource inputSource)
          Parses an alignment and creates a new Alignment object.
 Alignment parse(InputStream inputStream)
          Parses an alignment and creates a new Alignment object.
 Alignment parse(Reader reader)
          Parses an alignment and creates a new Alignment object.
 Alignment parse(String string)
          Parses an alignment and creates a new Alignment object.
 Alignment parse(URL url)
          Parses an alignment and creates a new Alignment object.
 void setAlignmentFactory(AlignmentFactory factory)
          Specifies the AlignmentFactory to be used in order to create the alignment object.
 void setCorrespondenceFactory(CorrespondenceFactory factory)
          Specifies the CorrespondenceFactory to be used in order to create correspondence objects.
 void setOntology1(OWLOntology ont1)
          Provide an ontology to be used as ontology 1 instead of parsing the location for the ontology in the document to be parsed.
 void setOntology1Document(InputStream is1)
          Provide a document for ontology 1 to be used instead of parsing the location for the ontology in the document to be parsed.
 void setOntology1Document(URL url1)
          Provide a document for ontology 1 to be used instead of parsing the location for the ontology in the document to be parsed.
 void setOntology2(OWLOntology ont2)
          Provide an ontology to be used as ontology 2 instead of parsing the location for the ontology in the document to be parsed.
 void setOntology2Document(InputStream is2)
          Provide a document for ontology 2 to be used instead of parsing the location for the ontology in the document to be parsed.
 void setOntology2Document(URL url2)
          Provide a document for ontology 2 to be used instead of parsing the location for the ontology in the document to be parsed.
 void setParsingLevel(ParsingLevel level)
          Sets the parsing level for the parsing process
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInstance

public static INRIAFormatParser getInstance()
Gets a (new) instance of this parser. For any Reader instance there can only be one parser instance.

Parameters:
reader - The Reader providing the input to be parsed.
Returns:
Parser instance.
Since:
1.0.0

setCorrespondenceFactory

public void setCorrespondenceFactory(CorrespondenceFactory factory)
Specifies the CorrespondenceFactory to be used in order to create correspondence objects. Calling this method is optional, so the parser can be used without explicitly specifying a CorrespondenceFactory. In this case a default factory is used for creating correspondence objects.

Specified by:
setCorrespondenceFactory in interface AlignmentParser
Parameters:
factory - The CorrespondenceFactory to be used for creating correspondence objects.

setAlignmentFactory

public void setAlignmentFactory(AlignmentFactory factory)
Specifies the AlignmentFactory to be used in order to create the alignment object. Calling this method is optional, so the parser can be used without explicitly specifying an AlignmentFactory. In this case a default factory is used for creating the alignment object.

Specified by:
setAlignmentFactory in interface AlignmentParser
Parameters:
factory - The AlignmentFactory to be used for creating the alignment object.

setOntology1Document

public void setOntology1Document(URL url1)
                          throws IllegalArgumentException
Provide a document for ontology 1 to be used instead of parsing the location for the ontology in the document to be parsed.

Specified by:
setOntology1Document in interface AlignmentParser
Parameters:
url1 - The ontology 1 to be used provided as URL.
Throws:
IllegalArgumentException - if the ontology is null or cannot be loaded from provided URL.

setOntology2Document

public void setOntology2Document(URL url2)
                          throws IllegalArgumentException
Provide a document for ontology 2 to be used instead of parsing the location for the ontology in the document to be parsed.

Specified by:
setOntology2Document in interface AlignmentParser
Parameters:
url2 - The ontology 2 to be used provided as URL.
Throws:
IllegalArgumentException - if the ontology is null or cannot be loaded from provided URL.

setOntology1Document

public void setOntology1Document(InputStream is1)
                          throws IllegalArgumentException
Provide a document for ontology 1 to be used instead of parsing the location for the ontology in the document to be parsed.

Specified by:
setOntology1Document in interface AlignmentParser
Parameters:
is1 - The ontology 1 to be used provided as InputStream.
Throws:
IllegalArgumentException - if the ontology is null or cannot be loaded from provided Inputstream.

setOntology2Document

public void setOntology2Document(InputStream is2)
                          throws IllegalArgumentException
Provide a document for ontology 2 to be used instead of parsing the location for the ontology in the document to be parsed.

Specified by:
setOntology2Document in interface AlignmentParser
Parameters:
is2 - The ontology 2 to be used provided as InputStream.
Throws:
IllegalArgumentException - if the ontology is null or cannot be loaded from provided Inputstream.

setOntology1

public void setOntology1(OWLOntology ont1)
                  throws IllegalArgumentException
Provide an ontology to be used as ontology 1 instead of parsing the location for the ontology in the document to be parsed.

Specified by:
setOntology1 in interface AlignmentParser
Parameters:
ont1 - The ontology 1 to be used.
Throws:
IllegalArgumentException - if the ontology is null.

setOntology2

public void setOntology2(OWLOntology ont2)
                  throws IllegalArgumentException
Provide an ontology to be used as ontology 2 instead of parsing the location for the ontology in the document to be parsed.

Specified by:
setOntology2 in interface AlignmentParser
Parameters:
ont2 - The ontology 2 to be used.
Throws:
IllegalArgumentException - if the ontology is null.

parse

public Alignment parse(File file)
                throws AlignmentParserException,
                       IllegalArgumentException,
                       FileNotFoundException
Parses an alignment and creates a new Alignment object.

Specified by:
parse in interface AlignmentParser
Returns:
Parsing result as an Alignment object.
Throws:
AlignmentParserException - if a parsing problem occurs.
IllegalArgumentException
FileNotFoundException

parse

public Alignment parse(String string)
                throws AlignmentParserException,
                       IllegalArgumentException,
                       FileNotFoundException
Parses an alignment and creates a new Alignment object.

Specified by:
parse in interface AlignmentParser
Returns:
Parsing result as an Alignment object.
Throws:
AlignmentParserException - if a parsing problem occurs.
IllegalArgumentException
FileNotFoundException

parse

public Alignment parse(URL url)
                throws AlignmentParserException,
                       IllegalArgumentException,
                       IOException
Parses an alignment and creates a new Alignment object.

Specified by:
parse in interface AlignmentParser
Returns:
Parsing result as an Alignment object.
Throws:
AlignmentParserException - if a parsing problem occurs.
IllegalArgumentException
IOException

parse

public Alignment parse(Reader reader)
                throws AlignmentParserException,
                       IllegalArgumentException,
                       IOException
Parses an alignment and creates a new Alignment object.

Specified by:
parse in interface AlignmentParser
Returns:
Parsing result as an Alignment object.
Throws:
AlignmentParserException - if a parsing problem occurs.
IllegalArgumentException
IOException

parse

public Alignment parse(InputStream inputStream)
                throws AlignmentParserException,
                       IllegalArgumentException
Parses an alignment and creates a new Alignment object.

Specified by:
parse in interface AlignmentParser
Returns:
Parsing result as an Alignment object.
Throws:
AlignmentParserException - if a parsing problem occurs.
IllegalArgumentException

parse

public Alignment parse(InputSource inputSource)
                throws AlignmentParserException
Parses an alignment and creates a new Alignment object.

Specified by:
parse in interface AlignmentParser
Returns:
Parsing result as an Alignment object.
Throws:
AlignmentParserException - if a parsing problem occurs.

setParsingLevel

public void setParsingLevel(ParsingLevel level)
Sets the parsing level for the parsing process

Specified by:
setParsingLevel in interface AlignmentParser


Copyright © 2012. All Rights Reserved.