java.lang.Object
com.googlecode.cqengine.ConcurrentIndexedCollection<Correspondence>
de.uni_mannheim.informatik.dws.melt.yet_another_alignment_api.Alignment
All Implemented Interfaces:
com.googlecode.cqengine.engine.QueryEngine<Correspondence>, com.googlecode.cqengine.IndexedCollection<Correspondence>, Iterable<Correspondence>, Collection<Correspondence>, Set<Correspondence>

public class Alignment extends com.googlecode.cqengine.ConcurrentIndexedCollection<Correspondence>
Data structure to represent an Alignment. An alignment is a set of multiple Correspondence instances. An alignment is also known as "mapping" or "mappings". Each Correspondence is uniquely identified by entityOne, entityTwo and relation. This means, if you add a Correspondence which already exists, it will not be modified. To modify an already existing correspondence you can use addOrModify(Correspondence).
Author:
Sven Hertling, Jan Portisch
  • Field Details

    • LOGGER

      private static final org.slf4j.Logger LOGGER
      Default logger.
    • method

      protected String method
    • type

      protected String type
    • level

      protected String level
    • onto1

      protected OntoInfo onto1
    • onto2

      protected OntoInfo onto2
    • indexSource

      protected com.googlecode.cqengine.index.hash.HashIndex<String,Correspondence> indexSource
    • indexTarget

      protected com.googlecode.cqengine.index.hash.HashIndex<String,Correspondence> indexTarget
    • indexRelation

      protected com.googlecode.cqengine.index.hash.HashIndex<CorrespondenceRelation,Correspondence> indexRelation
    • indexConfidence

      protected com.googlecode.cqengine.index.navigable.NavigableIndex<Double,Correspondence> indexConfidence
    • extensions

      protected Map<String,Object> extensions
      Extended attributes.
    • NEWLINE

      private static final String NEWLINE
  • Constructor Details

  • Method Details

    • init

      private void init(boolean indexSource, boolean indexTarget, boolean indexRelation, boolean indexConfidence)
    • add

      public void add(String entityOne, String entityTwo, double confidence, CorrespondenceRelation relation, Map<String,Object> extensions)
      Creates a new Correspondence and adds it to this mapping.
      Parameters:
      entityOne - URI of the entity from the source ontology as String.
      entityTwo - URI of the entity from the target ontology as String.
      confidence - The confidence of the mapping.
      relation - The relation that holds between the two entities.
      extensions - Extensions.
    • add

      public void add(String entityOne, String entityTwo, double confidence, CorrespondenceRelation relation)
      Creates a new Correspondence and adds it to this mapping.
      Parameters:
      entityOne - URI of the entity from the source ontology as String.
      entityTwo - URI of the entity from the target ontology as String.
      confidence - The confidence of the mapping.
      relation - The relation that holds between the two entities.
    • add

      public void add(String entityOne, String entityTwo, double confidence)
      Creates a new Correspondence and adds it to this mapping.
      Parameters:
      entityOne - URI of the entity from the source ontology as String.
      entityTwo - URI of the entity from the target ontology as String.
      confidence - The confidence of the mapping.
    • add

      public void add(String entityOne, String entityTwo, CorrespondenceRelation relation)
      Creates a new Correspondence and adds it to this mapping.
      Parameters:
      entityOne - URI of the entity from the source ontology as String.
      entityTwo - URI of the entity from the target ontology as String.
      relation - The relation that holds between the two entities.
    • add

      public void add(String entityOne, String entityTwo)
      Creates a new Correspondence and adds it to this mapping.
      Parameters:
      entityOne - URI of the entity from the source ontology as String.
      entityTwo - URI of the entity from the target ontology as String.
    • addOrModify

      public Correspondence addOrModify(String entityOne, String entityTwo, double confidence, CorrespondenceRelation relation, Map<String,Object> extensions)
      Adds the correspondence if not existent or adds the extensions values and updates confidence value.
      Parameters:
      entityOne - URI of the entity from the source ontology as String.
      entityTwo - URI of the entity from the target ontology as String.
      confidence - The confidence of the mapping.
      relation - The relation that holds between the two entities.
      extensions - extensions
      Returns:
      the updated correspondence
    • addOrModify

      public Correspondence addOrModify(String entityOne, String entityTwo, Map<String,Object> extensions)
      Adds the correspondence if not existent or adds the extensions values and updates confidence value.
      Parameters:
      entityOne - URI of the entity from the source ontology as String.
      entityTwo - URI of the entity from the target ontology as String.
      extensions - extensions
      Returns:
      the updated correspondence
    • addOrModify

      public Correspondence addOrModify(String entityOne, String entityTwo, String extensionKey, Object extensionValue)
      Adds the correspondence if not existent or adds the extensions values and updates confidence value.
      Parameters:
      entityOne - URI of the entity from the source ontology as String.
      entityTwo - URI of the entity from the target ontology as String.
      extensionKey - The key of the extension.
      extensionValue - The value of the extension.
      Returns:
      The updated correspondence.
    • addAdditionalConfidence

      public Correspondence addAdditionalConfidence(String entityOne, String entityTwo, Class<?> matcherClass, double confidence)
      Adds the correspondence if not existing or adds the extensions values and updates confidence value.
      Parameters:
      entityOne - URI of the entity from the source ontology as String.
      entityTwo - URI of the entity from the target ontology as String.
      matcherClass - The class of the matcher.
      confidence - The additional confidence.
      Returns:
      the updated correspondence
    • addAdditionalExplanation

      public Correspondence addAdditionalExplanation(String entityOne, String entityTwo, Class<?> matcherClass, String explanation)
      Adds the correspondence if not existent or adds the extensions values and updates confidence value.
      Parameters:
      entityOne - URI of the entity from the source ontology as String.
      entityTwo - URI of the entity from the target ontology as String.
      matcherClass - the class of the matcher
      explanation - the explanation for a correspondence
      Returns:
      the updated correspondence
    • addAdditionalConfidenceAndExplanation

      public Correspondence addAdditionalConfidenceAndExplanation(String entityOne, String entityTwo, Class<?> matcherClass, double confidence, String explanation)
      Adds the correspondence if not existent or adds the extensions values and updates confidence value.
      Parameters:
      entityOne - URI of the entity from the source ontology as String.
      entityTwo - URI of the entity from the target ontology as String.
      matcherClass - the class of the matcher
      confidence - the additional confidence
      explanation - the explanation for a correspondence
      Returns:
      the updated correspondence
    • addOrModify

      public Correspondence addOrModify(Correspondence correspondence)
      Adds the correspondence if not existent or adds the extensions values and updates confidence value.
      Parameters:
      correspondence - Correspondence to be added.
      Returns:
      the updated correspondence
    • addOrUseHighestConfidence

      public Correspondence addOrUseHighestConfidence(Correspondence c)
      Adds the correspondence if not existing. In case it already exists, adds the extensions values and updates confidence value(but only if it increases the confidence value).
      Parameters:
      c - Correspondence to be added
      Returns:
      the updated Correspondence
    • addOrUseHighestConfidence

      public Correspondence addOrUseHighestConfidence(String entityOne, String entityTwo, double confidence)
      Adds the correspondence if not existent. In case it already exists, updates confidence value only if it increases.
      Parameters:
      entityOne - URI of the entity from the source ontology as String.
      entityTwo - URI of the entity from the target ontology as String.
      confidence - The confidence of the mapping.
      Returns:
      the updated Correspondence
    • getCorrespondence

      public Correspondence getCorrespondence(String source, String target, CorrespondenceRelation relation)
      Returns the specified correspondence (source, target, relation). If not available it returns null.
      Parameters:
      source - Source URI.
      target - Target URI.
      relation - Relation that holds between the URIs.
      Returns:
      mapping correspondence or null
    • getCorrespondencesSourceTarget

      public Iterable<Correspondence> getCorrespondencesSourceTarget(String source, String target)
      Returns correspondences involving the specified source AND target.
      Parameters:
      source - Source (URI)
      target - Target (URI)
      Returns:
      Iterable of correspondences involving source AND target (at the same time).
    • getCorrespondencesSource

      public Iterable<Correspondence> getCorrespondencesSource(String source)
      Obtain an iterator for all correspondences where the given source is involved.
      Parameters:
      source - The source that shall be looked up.
      Returns:
      Iterable over Correspondence. Note: If there is no match, the iterable is not null.
    • isSourceContained

      public boolean isSourceContained(String source)
      Check whether the specified source is contained in this alignment instance.
      Parameters:
      source - The source to be looked up.
      Returns:
      True if source is contained, else false.
    • getCorrespondencesSourceRelation

      public Iterable<Correspondence> getCorrespondencesSourceRelation(String source, CorrespondenceRelation relation)
      Obtain an iterator for all correspondences where the given source and the given relation are involved.
      Parameters:
      source - The source that shall be looked up.
      relation - The relation that shall hold between the specified source and an arbitrary target.
      Returns:
      Iterable over Correspondence.
    • isSourceRelationContained

      public boolean isSourceRelationContained(String source, CorrespondenceRelation relation)
      Check whether the given source and the given relation are contained in this alignment.
      Parameters:
      source - The source that shall be looked up.
      relation - The relation that shall hold between the specified source and an arbitrary target.
      Returns:
      True if correspondence with the specified criteria could be found, else false.
    • getCorrespondencesTarget

      public Iterable<Correspondence> getCorrespondencesTarget(String target)
    • isTargetContained

      public boolean isTargetContained(String target)
      Check whether the specified target is contained in this alignment instance.
      Parameters:
      target - The target to be looked up.
      Returns:
      True if target is contained, else false.
    • getCorrespondencesTargetRelation

      public Iterable<Correspondence> getCorrespondencesTargetRelation(String target, CorrespondenceRelation relation)
      Obtain an iterator for all correspondences where the given target and the given relation are involved.
      Parameters:
      target - The target that shall be looked up.
      relation - The relation that shall hold between the specified target and an arbitrary source.
      Returns:
      Iterable over Correspondence.
    • isTargetRelationContained

      public boolean isTargetRelationContained(String target, CorrespondenceRelation relation)
      Check whether the given target and the given relation are contained in this alignment.
      Parameters:
      target - The target that shall be looked up.
      relation - The relation that shall hold between the specified target and an arbitrary source.
      Returns:
      True if correspondence with the specified criteria could be found, else false.
    • getCorrespondencesRelation

      public Iterable<Correspondence> getCorrespondencesRelation(CorrespondenceRelation relation)
      Obtain an iterator for all correspondences where the given relation are involved.
      Parameters:
      relation - The relation that shall hold between the specified target and an arbitrary source.
      Returns:
      Iterable over Correspondence.
    • isRelationContained

      public boolean isRelationContained(CorrespondenceRelation relation)
      Check whether the given relation are contained in this alignment.
      Parameters:
      relation - The relation that shall hold.
      Returns:
      True if correspondence with the specified criteria could be found, else false.
    • removeCorrespondencesSourceTarget

      public void removeCorrespondencesSourceTarget(String source, String target)
      Removes correspondences where source AND target appear (at the same time), i.e. <source, target, someConfidence>.
      Parameters:
      source - Source concept (typically URI)
      target - Target concept (typically URI)
    • removeCorrespondencesSource

      public void removeCorrespondencesSource(String source)
    • removeCorrespondencesTarget

      public void removeCorrespondencesTarget(String target)
    • removeCorrespondenceExtensions

      public void removeCorrespondenceExtensions()
      Removes all correspondence extensions.
    • removeCorrespondenceExtensions

      public void removeCorrespondenceExtensions(Iterable<String> blacklist)
      Remove all correspondence extensions which appear in blacklist.
      Parameters:
      blacklist - the extension keys to be removed.
    • removeCorrespondenceExtensionsNotIn

      public void removeCorrespondenceExtensionsNotIn(Set<String> whitelist)
      Removes all correspondence extensions, but keep the extensions with keys appearing in whitelist.
      Parameters:
      whitelist - the extensions keys which should be kept
    • cut

      public Alignment cut(double threshold)
      Returns a new alignment which contains only correspondences above or equal the given threshold (it will not modify the current object).
      Parameters:
      threshold - Threshold for cutting (correspondences greater than or equal the threshold will be added).
      Returns:
      A new alignment with filtered correspondences. This alignment stays untouched from the operation.
    • cutSize

      public int cutSize(double threshold)
      Returns only the size of the new alignment which contains only correspondences above or equal the given threshold (it will not modify the current object). This is faster than creating the cutted alignment in case you are only interested in the size of it (e.g. for best confidence search).
      Parameters:
      threshold - Threshold for cutting (correspondences greater than or equal the threshold will be added).
      Returns:
      the size of the cutted alignment.
    • sample

      public Alignment sample(int n)
      Returns a random sample of correspondences. If the parameter n is greater than the alignment size, an IllegalArgumentException is thrown. The alignment itself (where this method is called on) will not be modified.
      Parameters:
      n - the number of correspondences to be returned. Should be smaller than the size of this alignment.
      Returns:
      a new Alignment which contains the sampled correspondences.
    • sample

      public Alignment sample(int n, Random rnd)
      Returns a random sample of correspondences. If the parameter n is greater than the alignment size, an IllegalArgumentException is thrown. If the random parameter is always in the same state e.g. always providing a fresh instance with the same seed like new Random(1234) or setting the seed of one random instance always to the same value, then a smaller subset (sample with 10 percent) will be contained in the larger subset (sample with 20 percent). The alignment itself (where this method is called on) will not be modified.
      Parameters:
      n - the number of correspondences to be returned. Should be smaller than the size of this alignment.
      rnd - the source of randomness.
      Returns:
      a new Alignment which contains the sampled correspondences.
    • sample

      public Alignment sample(int n, long seed)
      Returns a random sample of correspondences. If the parameter n is greater than the alignment size, an IllegalArgumentException is thrown. If the random parameter is always in the same, then a smaller subset (sample with 10 percent) will be contained in the larger subset (sample with 20 percent). The alignment itself (where this method is called on) will not be modified.
      Parameters:
      n - the number of correspondences to be returned. Should be smaller than the size of this alignment.
      seed - the seed for random.
      Returns:
      a new Alignment which contains the sampled correspondences.
    • sampleByFraction

      public Alignment sampleByFraction(double fraction)
      Returns a random sample of correspondences. If the parameter n is greater than the alignment size, the full alignment (copy of this alignment) is returned. The alignment itself (where this method is called on) will not be modified.
      Parameters:
      fraction - the number of correspondences to be returned. Should be smaller than the size of this alignment.
      Returns:
      a new Alignment which contains the sampled correspondences.
    • sampleByFraction

      public Alignment sampleByFraction(double fraction, Random rnd)
      Returns a random sample of correspondences. If the parameter n is greater than the alignment size, the full alignment (copy of this alignment) is returned. If the random parameter is always in the same state e.g. always providing a fresh instance with the same seed like new Random(1234) or setting the seed of one random instance always to the same value, then a smaller subset (sample with 10 percent) will be contained in the larger subset (sample with 20 percent). The alignment itself (where this method is called on) will not be modified.
      Parameters:
      fraction - the number of correspondences to be returned. Should be smaller than the size of this alignment.
      rnd - the source of randomness.
      Returns:
      a new Alignment which contains the sampled correspondences.
    • sampleByFraction

      public Alignment sampleByFraction(double fraction, long seed)
      Returns a random sample of correspondences. If the parameter n is greater than the alignment size, the full alignment (copy of this alignment) is returned. If the random parameter is always the same, then a smaller subset (sample with 10 percent) will be contained in the larger subset (sample with 20 percent). The alignment itself (where this method is called on) will not be modified.
      Parameters:
      fraction - the number of correspondences to be returned. Should be smaller than the size of this alignment.
      seed - the source of randomness.
      Returns:
      a new Alignment which contains the sampled correspondences.
    • getDistinctCorrespondenceExtensionKeys

      public Set<String> getDistinctCorrespondenceExtensionKeys()
      Returns all extension keys of correspondences in this alignment.
      Returns:
      a set of all correspondence extension keys.
    • getDistinctCorrespondenceConfidenceKeys

      public Set<String> getDistinctCorrespondenceConfidenceKeys()
      Returns all used (sub-) extension keys of correspondences which can be used with method getAdditionalConfidence.
      Returns:
      a set of all correspondence (sub-) extension keys.
    • reverseWithoutRelationChange

      public Alignment reverseWithoutRelationChange()
      Reverse the alignment (switches sources with targets) and does not change the relation. It creates a new Alignment. If the relation should be changed use the reverse() method.
      Returns:
      NEW reversed alignment.
    • reverse

      public Alignment reverse()
      Reverse the alignment (switches sources with targets) and adjust(reverse) the relation. It creates a new Alignment. If the relation should not be changed use the reverseWithoutRelationChange() method.
      Returns:
      New reversed alignment.
    • copyExtensionsToThisAlignment

      public void copyExtensionsToThisAlignment(Alignment otherAlignment)
      Copies extensions from correspondences in the otherAlignment to this alignment. If this alignment already has an extension for the key in question, the extension will not be overwritten. The confidence is never overwritten. Extensions are only copied for correspondences available in the otherAlignment and this alignment.
      Parameters:
      otherAlignment - The other alignment from which the extensions shall be transferred.
    • copyExtensionsToThisAlignment

      public void copyExtensionsToThisAlignment(Alignment otherAlignment, boolean isOverwriteValues)
      Copies extensions from correspondences in the otherAlignment to this alignment.
      Parameters:
      otherAlignment - The other alignment from which the extension values shall be transferred.
      isOverwriteValues - If this alignment already contains an extension key available in the otherAlignment, it will be overwritten with the value of the otherAlignment. If false, the value will not be overwritten.
    • serialize

      public String serialize() throws IOException
      Serialize this mapping to a string. Better use the function serialize(File f) if the mapping is huge.
      Returns:
      the mapping in the alignment xml format
      Throws:
      IOException - An IOException.
    • serialize

      public void serialize(File file) throws IOException
      Serialize this mapping directly to a given file in the default XML format. This also works if the alignment is huge.
      Parameters:
      file - The file for writing the mapping.
      Throws:
      IOException - An IOException.
    • serializeToCSV

      public void serializeToCSV(File file) throws IOException
      Serialize this mapping directly to a given file in CSV format. This also works if the alignment is huge.
      Parameters:
      file - The file for writing the mapping.
      Throws:
      IOException - An IOException.
    • getMethod

      public String getMethod()
    • setMethod

      public void setMethod(String method)
    • getType

      public String getType()
    • setType

      public void setType(String type)
    • getOnto2

      public OntoInfo getOnto2()
    • setOnto2

      public void setOnto2(OntoInfo onto2)
    • getOnto1

      public OntoInfo getOnto1()
    • setOnto1

      public void setOnto1(OntoInfo onto1)
    • getLevel

      public String getLevel()
    • setLevel

      public void setLevel(String level)
    • getConfidenceOrderedMapping

      public List<Correspondence> getConfidenceOrderedMapping()
    • getMinimalConfidence

      public double getMinimalConfidence()
    • getMaximalConfidence

      public double getMaximalConfidence()
    • assertIndexOnSource

      public void assertIndexOnSource()
    • assertIndexOnTarget

      public void assertIndexOnTarget()
    • assertIndexOnRelation

      public void assertIndexOnRelation()
    • assertIndexOnConfidence

      public void assertIndexOnConfidence()
    • getDistinctSources

      public Iterable<String> getDistinctSources()
    • getDistinctSourcesAsSet

      public Set<String> getDistinctSourcesAsSet()
    • getDistinctTargets

      public Iterable<String> getDistinctTargets()
    • getDistinctTargetsAsSet

      public Set<String> getDistinctTargetsAsSet()
    • getDistinctSourceAndTargetsAsSet

      public Set<String> getDistinctSourceAndTargetsAsSet()
    • getDistinctRelations

      public Iterable<CorrespondenceRelation> getDistinctRelations()
    • getDistinctRelationsAsSet

      public Set<CorrespondenceRelation> getDistinctRelationsAsSet()
    • getDistinctConfidences

      public Iterable<Double> getDistinctConfidences()
    • getDistinctConfidencesAsSet

      public Set<Double> getDistinctConfidencesAsSet()
    • makeSet

      public static <T> Set<T> makeSet(Iterable<T> iterable)
      Creates a set from an iterable.
      Type Parameters:
      T - the type of the iterable
      Parameters:
      iterable - iterable which should be converted to set
      Returns:
      set containing all elements of iterable
    • makeList

      public static <T> List<T> makeList(Iterable<T> iterable)
      Creates a list from an iterable.
      Type Parameters:
      T - the type of the iterable
      Parameters:
      iterable - iterable which should be converted to list
      Returns:
      list containing all elements of iterable
    • iteratorSize

      public static long iteratorSize(Iterator<?> i)
      Returns the size of the iterator.
      Parameters:
      i - the iterator to use
      Returns:
      the size of the iterator.
    • iterableSize

      public static long iterableSize(Iterable<?> i)
      Returns the size of the iterable.
      Parameters:
      i - the iterable to use
      Returns:
      the size of the iterable.
    • getExtensionValue

      public Object getExtensionValue(String extensionUri)
      Obtain the value of an extension.
      Parameters:
      extensionUri - The URI identifying the extension. Note that many default extension URIs are contained in DefaultExtensions.
      Returns:
      The value of the extension as String, null if there is no value.
    • getExtensionValue

      public Object getExtensionValue(Object extensionUri)
      Obtain the value of an extension.
      Parameters:
      extensionUri - The URI identifying the extension. Note that many default extension URIs are contained in DefaultExtensions.
      Returns:
      The value of the extension as String, null if there is no value.
    • getExtensionValueAsString

      public String getExtensionValueAsString(String extensionUri)
      Obtain the value of an extension.
      Parameters:
      extensionUri - The URI identifying the extension. Note that many default extension URIs are contained in DefaultExtensions.
      Returns:
      The value of the extension as String, null if there is no value.
    • getExtensionValueAsString

      public String getExtensionValueAsString(Object extensionUri)
      Obtain the value of an extension.
      Parameters:
      extensionUri - The URI identifying the extension. Note that many default extension URIs are contained in DefaultExtensions.
      Returns:
      The value of the extension as String, null if there is no value.
    • getExtensionValueCasted

      public <T> T getExtensionValueCasted(String extensionUri)
      Obtain the value of an extension.
      Type Parameters:
      T - Extension value type.
      Parameters:
      extensionUri - The URI identifying the extension.
      Returns:
      The value of the extension as String, null if there is no value.
    • getExtensionValueCasted

      public <T> T getExtensionValueCasted(Object extensionUri)
      Obtain the value of an extension.
      Type Parameters:
      T - Extension value type.
      Parameters:
      extensionUri - The URI identifying the extension.
      Returns:
      The value of the extension as String, null if there is no value.
    • addExtensionValue

      public void addExtensionValue(String extensionUri, Object extensionValue)
      Set the value for an extension.
      Parameters:
      extensionUri - The URI identifying the extension. Note that many default extension URIs are contained in DefaultExtensions.
      extensionValue - The value of the extension to be set.
    • addExtensionValue

      public void addExtensionValue(Object extensionUri, Object extensionValue)
      Set the value for an extension.
      Parameters:
      extensionUri - The URI identifying the extension. Note that many default extension URIs are contained in DefaultExtensions.
      extensionValue - The value of the extension to be set.
    • getExtensions

      public Map<String,Object> getExtensions()
      Obtain the alignment extensions as Map.
      Returns:
      The map is build as follows:
      • key: extension URI
      • value: extension value
    • setExtensions

      public void setExtensions(Map<String,Object> extensions)
      Set the extensions of the alignment. Note that this method will overwrite existing extensions of the alignment.
      Parameters:
      extensions - The alignment extensions to be set.
    • toStringMultiline

      public String toStringMultiline()
      ToString method which returns the alignment in multiple lines (each correspondence in one line) to have a better overview.
      Returns:
      a string which contains the alignment in multiple lines.
    • toStringMultilineInfo

      public String toStringMultilineInfo()
      ToString method which returns the alignment in multiple lines (each correspondence in one line) to have a better overview. In comparison to toStringMultiline, this method prints also the alignment and correspondence extensions and onto infos.
      Returns:
      a string which contains the alignment in multiple lines.
    • toStringOneLine

      public String toStringOneLine()
      ToString method which returns the alignment in one line.
      Returns:
      a string which contains the alignment in one line.
    • toString

      public String toString()
      Overrides:
      toString in class com.googlecode.cqengine.ConcurrentIndexedCollection<Correspondence>
    • parse

      public static Alignment parse(File f) throws SAXException, IOException
      Parse a file and returns the corresponding Alignment object.More options are available when using constructors.
      Parameters:
      f - the file to be pasred
      Returns:
      alignment object
      Throws:
      SAXException - in case of an parser error
      IOException - in case of an parser error
    • parse

      public static Alignment parse(String text) throws SAXException, IOException
      Parse a text and returns the corresponding Alignment object. More options are available when using constructors.
      Parameters:
      text - the text to be pasred
      Returns:
      alignment object
      Throws:
      SAXException - in case of an parser error
      IOException - in case of an parser error
    • parse

      public static Alignment parse(InputStream stream) throws SAXException, IOException
      Parse a stream and returns the corresponding Alignment object. More options are available when using constructors.
      Parameters:
      stream - the stream to be pasred
      Returns:
      alignment object
      Throws:
      SAXException - in case of an parser error
      IOException - in case of an parser error
    • subtraction

      public static Alignment subtraction(Alignment alignment_1, Alignment alignment_2)
      Create the subtraction between the two given alignments. Only copies the alignment and not further infos like onto or extensions.
      Parameters:
      alignment_1 - Set 1.
      alignment_2 - Set 2.
      Returns:
      Subtraction alignment.
    • intersection

      public static Alignment intersection(Alignment alignment_1, Alignment alignment_2)
      Create the intersection between the two given alignments. Only copies the alignment and not further infos like onto or extensions.
      Parameters:
      alignment_1 - Set 1.
      alignment_2 - Set 2.
      Returns:
      Intersection alignment.
    • union

      public static Alignment union(Alignment alignment_1, Alignment alignment_2)
      Create the union between the two given alignments. Only copies the alignment and not further infos like onto or extensions.
      Parameters:
      alignment_1 - Set 1.
      alignment_2 - Set 2.
      Returns:
      Union alignment.
    • switchSourceWithTarget

      public static Alignment switchSourceWithTarget(Alignment alignment)
      Deprecated.
      use function reverse
      Switches sources with targets. Does not change the relation. This method is only for erroneous alignments where a matcher switched the source with the target ontology.
      Parameters:
      alignment - The alignment where the source shall be switched with the target.
      Returns:
      Edited alignment.
    • copyExtensionsToAlignment

      public static Alignment copyExtensionsToAlignment(Alignment sourceAlignment, Alignment targetAlignment, boolean isOverwriteValues)
      This method creates a deep copy of targetAlignment and further copies extension values from the sourceAlignment. The confidence is never overwritten.
      Parameters:
      sourceAlignment - The alignment from which the extension values shall be transferred to the targetAlignment.
      targetAlignment - The alignment which will be copied and to which are the extension values are copied.
      isOverwriteValues - If the targetAlignment alignment already contains an extension key available in the sourceAlignment, it will be overwritten with the value of the sourceAlignment. If false, the value will not be overwritten.
      Returns:
      A new alignment instance.
    • copyExtensionsToAlignment

      public static Alignment copyExtensionsToAlignment(Alignment sourceAlignment, Alignment targetAlignment)
      This method creates a deep copy of targetAlignment and further copies extension values from the sourceAlignment. The confidence is never overwritten. If the targetAlignment already contains the extension key, no value will be copied from the sourceAlignment.
      Parameters:
      sourceAlignment - The alignment from which the extension values shall be transferred to the targetAlignment.
      targetAlignment - The alignment which will be copied and to which are the extension values are copied.
      Returns:
      A new alignment instance.
    • createOrder

      public static List<Correspondence> createOrder(Alignment alignment)
      Creates a deterministic order of correspondences.
      Parameters:
      alignment - the alignemtn to create the order
      Returns:
      an ordered alignment as list.
    • createOrder

      public static List<Correspondence> createOrder(List<Correspondence> alignment)
      Creates a deterministic order of correspondences.
      Parameters:
      alignment - the alignemtn to create the order
      Returns:
      an ordered alignment as list.