All Implemented Interfaces:
IMatcher<org.apache.jena.ontology.OntModel,​Alignment,​Properties>, eu.sealsproject.platform.res.domain.omt.IOntologyMatchingToolBridge, eu.sealsproject.platform.res.tool.api.IPlugin, eu.sealsproject.platform.res.tool.api.IToolBridge

public class SimpleStringMatcher
extends MatcherYAAAJena
A relatively simple matcher that can be used before running BackgroundMatcher to filter out simple matches.
  • Field Details

    • LOGGER

      private static org.slf4j.Logger LOGGER
    • ontology1

      private org.apache.jena.ontology.OntModel ontology1
    • ontology2

      private org.apache.jena.ontology.OntModel ontology2
    • valueExtractor

      private TextExtractor valueExtractor
      The value extractor used to obtain labels for resources.
    • mapping

      private Alignment mapping
      Alignment
    • clashedLabels

      private HashMap<String,​HashSet<String>> clashedLabels
      Tracks clashed labels.
    • uri2labelMap_1

      private Map<String,​Set<String>> uri2labelMap_1
      maps from URI -> set<label>
    • uri2labelMap_2

      private Map<String,​Set<String>> uri2labelMap_2
      maps from URI -> set<label>
    • isVerboseLoggingOutput

      private boolean isVerboseLoggingOutput
      Log every match. Do not use in performance optimized settings.
  • Constructor Details

    • SimpleStringMatcher

      public SimpleStringMatcher()
  • Method Details

    • match

      public Alignment match​(org.apache.jena.ontology.OntModel sourceOntology, org.apache.jena.ontology.OntModel targetOntology, Alignment inputAlignment, Properties p) throws Exception
      Description copied from class: MatcherYAAAJena
      Aligns two ontologies specified via a Jena OntModel, with an input alignment as Alignment object, and returns the mapping of the resulting alignment. Note: This method might be called multiple times in a row when using the evaluation framework. Make sure to return a mapping which is specific to the given inputs.
      Specified by:
      match in interface IMatcher<org.apache.jena.ontology.OntModel,​Alignment,​Properties>
      Specified by:
      match in class MatcherYAAAJena
      Parameters:
      sourceOntology - This OntModel represents the source ontology.
      targetOntology - This OntModel represents the target ontology.
      inputAlignment - This mapping represents the input alignment.
      p - Additional properties.
      Returns:
      The resulting alignment of the matching process.
      Throws:
      Exception - Any exception which occurs during matching.
    • initializeMappingProcess

      private void initializeMappingProcess​(Alignment inputAlignment)
      (Re-)initialize data structures.
      Parameters:
      inputAlignment - Input alignment
    • match

      private void match​(org.apache.jena.util.iterator.ExtendedIterator<? extends org.apache.jena.ontology.OntResource> sourceOntologyIterator_1, org.apache.jena.util.iterator.ExtendedIterator<? extends org.apache.jena.ontology.OntResource> targetOntologyIterator_2)
      Given two iterators, match the resources covered by them.
      Parameters:
      sourceOntologyIterator_1 - iterator 1 must be that of the source ontology
      targetOntologyIterator_2 - iterator 2 must be that of the target ontology
    • performSimpleMatching

      private void performSimpleMatching​(Map<String,​Set<String>> uri2labelMap_1, Map<String,​Set<String>> uri2labelMap_2)
      Filter out simple string matches utilizing an index strategy.
      Parameters:
      uri2labelMap_1 - URI 2 labels for the source ontology.
      uri2labelMap_2 - URI 2 labels for the target ontology.
    • addClashedLabel

      private void addClashedLabel​(String uri1, String uri2)
      Adds a clashed label to the corresponding map.
      Parameters:
      uri1 - URI part 1.
      uri2 - URI part 2.
    • mapToMany

      private void mapToMany​(String sourceURI, String targetURI)
      If the applied comparison score cannot differentiate between multiple mapping options, add all.
      Parameters:
      sourceURI - Source URI
      targetURI - Target URI
    • convertToBOW2URI

      private HashMap<BagOfWords,​String> convertToBOW2URI​(Map<String,​Set<String>> uri2labels)
      Convert a HashMap<String, HashSet<String>> to a HashMap<BagOfWords, String>. This is required for very simple String matchers.
      Parameters:
      uri2labels - Input HashMap.
      Returns:
      Converted HashMap.
    • normalize

      static BagOfWords normalize​(String stringToBeNormalized)
      Normalizes a string. Recognizes camelCase.
      Parameters:
      stringToBeNormalized - The String that shall be normalized.
      Returns:
      Bag of Words
    • isVerboseLoggingOutput

      public boolean isVerboseLoggingOutput()
    • setVerboseLoggingOutput

      public void setVerboseLoggingOutput​(boolean verboseLoggingOutput)