de.dfleischhacker.uni.thesis.utils.alignment
Class AlignmentManager

java.lang.Object
  extended by de.dfleischhacker.uni.thesis.utils.alignment.AlignmentManager

public class AlignmentManager
extends java.lang.Object

Provides methods to read the alignment format from files as defined in Jérôme Euzenat - An API for ontology alignment To read the alignment a DOM parser is used internally.


Method Summary
static Alignment getEmptyAlignment()
          Returns an empty alignment
static Alignment loadAlignment(java.io.InputStream stream)
          Loads an alignment from the given stream and returns the corresponding Alignment object.
static Alignment loadAlignment(java.io.InputStream stream, float threshold)
          Loads an alignment from the given stream and returns the corresponding Alignment object.
static Alignment loadAlignment(java.lang.String filename)
          Loads an alignment from the given file.
static Alignment loadAlignment(java.lang.String filename, float threshold)
          Loads an alignment from the given file.
static Alignment toAlignment(java.lang.String onto1, java.lang.String onto2, java.util.Set<Correspondence> corrSet)
          Creates an alignment from the given set of correspondences
static void writeAlignment(java.lang.String filename, Alignment alignment)
          Writes the given Alignment into the given file.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

loadAlignment

public static Alignment loadAlignment(java.io.InputStream stream,
                                      float threshold)
                               throws org.xml.sax.SAXException,
                                      java.io.IOException,
                                      javax.xml.parsers.ParserConfigurationException,
                                      AlignmentFormatException
Loads an alignment from the given stream and returns the corresponding Alignment object.

Parameters:
stream - stream to read the alignment from
threshold - load only correspondences with at least this value as confidence measure
Returns:
Alignment object representing the loaded alignment
Throws:
org.xml.sax.SAXException
java.io.IOException
javax.xml.parsers.ParserConfigurationException
AlignmentFormatException

loadAlignment

public static Alignment loadAlignment(java.io.InputStream stream)
                               throws org.xml.sax.SAXException,
                                      java.io.IOException,
                                      javax.xml.parsers.ParserConfigurationException,
                                      java.lang.Exception
Loads an alignment from the given stream and returns the corresponding Alignment object.

Parameters:
stream - stream to read the alignment from
Returns:
Alignment object representing the loaded alignment
Throws:
org.xml.sax.SAXException
java.io.IOException
javax.xml.parsers.ParserConfigurationException
java.lang.Exception

loadAlignment

public static Alignment loadAlignment(java.lang.String filename,
                                      float threshold)
                               throws java.io.FileNotFoundException,
                                      org.xml.sax.SAXException,
                                      java.io.IOException,
                                      javax.xml.parsers.ParserConfigurationException,
                                      java.lang.Exception
Loads an alignment from the given file. This is a convinience method which creates an InputStream and passes it to another method.

Parameters:
filename - file to load alignment from
threshold - load only correspondences with at least this value as confidence measure
Throws:
java.io.FileNotFoundException
org.xml.sax.SAXException
java.io.IOException
javax.xml.parsers.ParserConfigurationException
java.lang.Exception

loadAlignment

public static Alignment loadAlignment(java.lang.String filename)
                               throws java.io.FileNotFoundException,
                                      org.xml.sax.SAXException,
                                      java.io.IOException,
                                      javax.xml.parsers.ParserConfigurationException,
                                      AlignmentFormatException
Loads an alignment from the given file. This is a convinience method which creates an InputStream and passes it to another method.

Parameters:
filename - file to load alignment from
Throws:
java.io.FileNotFoundException
org.xml.sax.SAXException
java.io.IOException
javax.xml.parsers.ParserConfigurationException
AlignmentFormatException

getEmptyAlignment

public static Alignment getEmptyAlignment()
Returns an empty alignment

Returns:
empty alignment

toAlignment

public static Alignment toAlignment(java.lang.String onto1,
                                    java.lang.String onto2,
                                    java.util.Set<Correspondence> corrSet)
Creates an alignment from the given set of correspondences

Parameters:
onto1 - uri of ontology 1
onto2 - uri of ontology 2
corrSet - set of correspondences to create alignment from
Returns:
alignment created from set of correspondences

writeAlignment

public static void writeAlignment(java.lang.String filename,
                                  Alignment alignment)
                           throws java.io.IOException,
                                  javax.xml.transform.TransformerConfigurationException,
                                  javax.xml.parsers.ParserConfigurationException,
                                  javax.xml.transform.TransformerException
Writes the given Alignment into the given file. The alignment is represented in XML.

Parameters:
filename - file to write the alignment into
Throws:
java.io.IOException
javax.xml.transform.TransformerConfigurationException
javax.xml.parsers.ParserConfigurationException
javax.xml.transform.TransformerException