java.lang.Object
de.uni_mannheim.informatik.dws.melt.matching_eval.Executor

public class Executor extends Object
The Executor runs a matcher or a list of matchers on a single test case or a list of test cases. Also have a look at other executors like ExecutorParallel or ExecutorSeals.
Author:
Sven Hertling, Jan Portisch
  • Field Details

    • LOGGER

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

      private static final String FALLBACK_MATCHER_NAME
      See Also:
    • TIME_RUNNING

      private static final Pattern TIME_RUNNING
  • Constructor Details

    • Executor

      public Executor()
  • Method Details

    • runSingle

      public static ExecutionResult runSingle(TestCase testCase, Object matcher, String matcherName)
      Run a single test case with one matcher.
      Parameters:
      testCase - Test case to be evaluated.
      matcher - Matcher to be evaluated.
      matcherName - The name of the matcher.
      Returns:
      Single Execution Result
    • runSingle

      public static ExecutionResult runSingle(TestCase testCase, Object matcher)
      Run a single test case with one matcher.
      Parameters:
      testCase - Test case to be evaluated.
      matcher - Matcher to be evaluated.
      Returns:
      Single Execution Result
    • runTracks

      public static ExecutionResultSet runTracks(List<Track> tracks, Object matcher, String name)
      Run one matcher with a given name on multiple tracks.
      Parameters:
      tracks - The tracks on which the matchers shall be run.
      matcher - The matcher to be run. This class should implement either IMatcher or IOntologyMatchingToolBridge is some way.
      name - the name of the matcher to use
      Returns:
      The matching result as ExecutionResultSet instance.
    • runTracks

      public static ExecutionResultSet runTracks(List<Track> tracks, Object... matchers)
      Run matchers on multiple tracks.
      Parameters:
      tracks - The tracks on which the matchers shall be run.
      matchers - The matcher to be run. This class should implement either IMatcher or IOntologyMatchingToolBridge is some way.
      Returns:
      The matching result as ExecutionResultSet instance.
    • runTracks

      public static ExecutionResultSet runTracks(List<Track> tracks, Map<String,Object> matchers)
      Run multiple matchers on multiple tracks.
      Parameters:
      tracks - The tracks on which the matchers shall be run.
      matchers - The matchers that shall be run. The values in the map (matchers) should implement either IMatcher or IOntologyMatchingToolBridge is some way.
      Returns:
      The matching result as ExecutionResultSet instance.
    • run

      public static ExecutionResultSet run(Track track, Object... matchers)
      This method runs the specified matcher on the specified track.
      Parameters:
      track - Track on which the matcher shall be run.
      matchers - The matchers to be run. The classes should implement either IMatcher or IOntologyMatchingToolBridge is some way.
      Returns:
      An ExecutionResultSet instance.
    • run

      public static ExecutionResultSet run(Track track, Object matcher, String name)
      This method runs the specified matcher on the specified track.
      Parameters:
      track - Track on which the matcher shall be run.
      matcher - The matcher to be run. The classes should implement either IMatcher or IOntologyMatchingToolBridge is some way.
      name - the name of the matcher to use
      Returns:
      An ExecutionResultSet instance.
    • run

      public static ExecutionResultSet run(Track track, Map<String,Object> matchers)
      Run matchers on one track.
      Parameters:
      track - The track to be evaluated.
      matchers - The matchers to be run on the given track. The values of the map should implement either IMatcher or IOntologyMatchingToolBridge is some way.
      Returns:
      ExecutionResultSet instance.
    • run

      public static ExecutionResultSet run(TestCase testCase, Object... matchers)
      Run matchers on one test cases.
      Parameters:
      testCase - One specific testcase on which all the specified matchers shall be run.
      matchers - The matchers to be run. This class should implement either IMatcher or IOntologyMatchingToolBridge is some way.
      Returns:
      The result as ExecutionResultSet instance.
    • run

      public static ExecutionResultSet run(TestCase testCase, Object matcher, String name)
      Run matchers on one test cases.
      Parameters:
      testCase - One specific testcase on which all the specified matchers shall be run.
      matcher - The matcher to be run. This class should implement either IMatcher or IOntologyMatchingToolBridge is some way.
      name - the name of the matcher to use
      Returns:
      The result as ExecutionResultSet instance.
    • run

      public static ExecutionResultSet run(TestCase testCase, Map<String,Object> matchers)
      Run matchers on one test cases.
      Parameters:
      testCase - One specific testcase on which all the specified matchers shall be run.
      matchers - A map of matchers from unique_name to matcher instance.The value of the map should implement either IMatcher or IOntologyMatchingToolBridge is some way.
      Returns:
      The result as ExecutionResultSet instance.
    • run

      public static ExecutionResultSet run(List<TestCase> testCases, Object... matchers)
      Run matchers on a set of test cases.
      Parameters:
      testCases - The test cases on which all the specified matcher shall be run.
      matchers - The matchers to be run. This class should implement either IMatcher or IOntologyMatchingToolBridge is some way.
      Returns:
      The result as ExecutionResultSet instance.
    • run

      public static ExecutionResultSet run(List<TestCase> testCases, Object matcher, String name)
      Run matchers on a set of test cases.
      Parameters:
      testCases - The test cases on which all the specified matcher shall be run.
      matcher - The matcher to be run. This class should implement either IMatcher or IOntologyMatchingToolBridge is some way.
      name - the name of the matcher to use
      Returns:
      The result as ExecutionResultSet instance.
    • run

      public static ExecutionResultSet run(List<TestCase> testCases, Map<String,Object> matchers)
      Run matchers on a set of test cases.
      Parameters:
      testCases - The test cases on which all the specified matchers shall be run.
      matchers - A map of matchers from unique_name to matcher instance. The matcher class should implement either IMatcher or IOntologyMatchingToolBridge is some way.
      Returns:
      The matching result as ExecutionResultSet instance.
    • loadFromFolder

      public static ExecutionResultSet loadFromFolder(File folder, TestCase testCase)
      Load raw results from folder structure like: folder - ALIGN.rdf - LogMap.rdf File names are treated as matcher names and they are associated with the given testcase.
      Parameters:
      folder - The folder where the system results can be found.
      testCase - Test case with which the individual system results shall be associated.
      Returns:
      ExecutionResultSet instance with the loaded results.
    • tryToGetRuntime

      private static long tryToGetRuntime(File logFile)
    • loadFromFolder

      public static ExecutionResultSet loadFromFolder(String pathToFolder, TestCase testCase)
      Load results directly from a folder. The results have to be run on the same testCase. Folder structure like: folder - ALIGN.rdf - LogMap.rdf File names are treated as matcher names and they are associated with the given testcase. This structure is equal to the structure used by the Anatomy Track of the OAEI.
      Parameters:
      pathToFolder - The folder where the system results can be found.
      testCase - Test case with which the individual system results shall be associated.
      Returns:
      ExecutionResultSet instance with the loaded results.
    • loadFromFolder

      public static ExecutionResultSet loadFromFolder(File folder, Track track)
      Load raw results from folder structure like: folder - testcase name - ALIGN.rdf - LogMap.rdf File names are treated as matcher names and they are associated with the given testcase.
      Parameters:
      folder - The folder where the system results can be found.
      track - Track with which the individual system results shall be associated.
      Returns:
      ExecutionResultSet instance with the loaded results.
    • loadFromFolder

      public static ExecutionResultSet loadFromFolder(String folder, Track track)
      Load raw results from folder structure like: folder - testcase name - ALIGN.rdf - LogMap.rdf File names are treated as matcher names and they are associated with the given testcase.
      Parameters:
      folder - The folder where the system results can be found.
      track - Track with which the individual system results shall be associated.
      Returns:
      ExecutionResultSet instance with the loaded results.
    • loadFromAnatomyResultsFolder

      public static ExecutionResultSet loadFromAnatomyResultsFolder(String pathToFolder)
      Load raw results from a folder with the structure used by the Anatomy Track of the OAEI.
      Parameters:
      pathToFolder - Path to the anatomy results folder (can be downloaded from OAEI Web site).
      Returns:
      ExecutionResultSet instance with the loaded results.
    • loadFromConferenceResultsFolder

      public static ExecutionResultSet loadFromConferenceResultsFolder(String pathToFolder)
      Load raw results from a folder with the structure used by the Conference Track of the OAEI.
      Parameters:
      pathToFolder - The path to the folder where the alignments of the conference folder reside.
      Returns:
      ExecutionResultSet instance with the loaded results.
    • loadFromKnowledgeGraphResultsFolder

      public static ExecutionResultSet loadFromKnowledgeGraphResultsFolder(String pathToFolder)
      Load raw results from a folder with the structure used by the Knowledge Graph Track of the OAEI.
      Parameters:
      pathToFolder - The path to the unzipped folder where the folders of the knowledge graph track reside.
      Returns:
      ExecutionResultSet instance with the loaded results.
    • loadFromEvaluatorCsvResultsFolder

      public static ExecutionResultSet loadFromEvaluatorCsvResultsFolder(String folderPath)
      Load results that are produced by the MELT evaluator EvaluatorCSV in the results folder.
      Parameters:
      folderPath - Path to the results folder (the one with the time code e.g. results/results_2020-03-02_08-47-40)
      Returns:
      ExecutionResultSet instance with the loaded results.
    • loadFromEvaluatorCsvResultsFolder

      public static ExecutionResultSet loadFromEvaluatorCsvResultsFolder(File folder)
      Load results that are produced by the MELT evaluator EvaluatorCSV in the results folder.
      Parameters:
      folder - Path to the results folder (the one with the time code e.g. results/results_2020-03-02_08-47-40)
      Returns:
      ExecutionResultSet instance with the loaded results.
    • loadFromEvaluatorCsvResultsFolder

      public static ExecutionResultSet loadFromEvaluatorCsvResultsFolder(String folderPath, LocalTrack localTrack)
    • loadFromEvaluatorCsvResultsFolder

      public static ExecutionResultSet loadFromEvaluatorCsvResultsFolder(File folder, LocalTrack localTrack)
    • loadFromEvaluatorCsvResultsFolder

      public static ExecutionResultSet loadFromEvaluatorCsvResultsFolder(File folder, Set<LocalTrack> localTracks)
      Load results that are produced by the MELT evaluator EvaluatorCSV in the results folder.
      Parameters:
      folder - Path to the results folder (the one with the time code e.g. results/results_2020-03-02_08-47-40)
      localTracks - A set of local tracks contained in the evaluation directory.
      Returns:
      ExecutionResultSet instance with the loaded results.
    • getTimeFromPerformanceCSV

      private static long getTimeFromPerformanceCSV(File performanceCSV)
    • getMatcherMapWithName

      private static Map<String,Object> getMatcherMapWithName(Object matcher, String name)
    • getMatcherMap

      private static Map<String,Object> getMatcherMap(Object... matchers)
    • isMatcher

      private static boolean isMatcher(Object o)
    • getNonExistentName

      private static String getNonExistentName(String matcherName, Set<String> alreadyUsedMatcherNames)
    • getMatcherName

      public static String getMatcherName(Object matcherInstance)
      Given a matcher, this method returns its name. It will first check if there is a specific toString method (e.g. not defined by Object class. If this is not the case then, it will return the simple name of the class. If this also does not exist(e.g. lamda definition), then it will return a fallback matcher name.
      Parameters:
      matcherInstance - the matcher instance whose name shall be retrieved.
      Returns:
      The name as String.
    • getMatcherName

      public static String getMatcherName(Class<?> matcherClass)
      Given a matcher, this method returns its name. It will first check if there is a specific toString method (e.g. not defined by Object class. If this is not the case then, it will return the simple name of the class. If this also does not exist(e.g. lamda definition), then it will return a fallback matcher name.
      Parameters:
      matcherClass - the matcher class whose name shall be retrieved.
      Returns:
      The name as String.
    • deleteOriginalSystemResults

      public static boolean deleteOriginalSystemResults(ExecutionResultSet er)
      Deletes all system results which are stored usually in the tmp folder. This will not delete anything in the results folder.
      Parameters:
      er - the execution results where all system alignments should be removed.
      Returns:
      true if and only if all results are successfully deleted; false otherwise
    • deleteTempFiles

      public static void deleteTempFiles()
      Deletes all matcher result files which starts with "alignment" and are stored in the tmp folder. Does not delete the whole tmp folder but onl files which are produced by oaei matchers.
    • getSummedRuntimeOfAllUnrefinedResults

      public static long getSummedRuntimeOfAllUnrefinedResults(ExecutionResultSet results)
    • runMatcherOnTop

      public static ExecutionResultSet runMatcherOnTop(ExecutionResultSet oldResults, String oldMatcherName, Object newMatcher, String newMatcherName)
      Runs a matcher on top of another. This means that the previous matchings do not need to be recalculated. This will run the matcher on all testcases.
      Parameters:
      oldResults - the results from the previous runs already containing result from the oldMatcherName.
      oldMatcherName - the matcher name which should exist in previous results
      newMatcher - the new matcher
      newMatcherName - the new matcher name
      Returns:
      the execution results together with the new matcher
    • runMatcherOnTop

      public static ExecutionResultSet runMatcherOnTop(ExecutionResultSet oldResults, String oldMatcherName, Map<String,Object> newMatchers)
      Runs a matcher on top of another. This means that the previous matchings do not need to be recalculated. This will run the matcher on all testcases.
      Parameters:
      oldResults - the results from the previous runs already containing result from the oldMatcherName.
      oldMatcherName - the matcher name which should exist in previous results
      newMatchers - the new matchers as a map where the key is the matcher name and value the actual matcher
      Returns:
      the execution results together with the new matcher
    • runMatcherOnTop

      public static ExecutionResultSet runMatcherOnTop(ExecutionResultSet oldResults, TestCase testCase, String oldMatcherName, Object newMatcher, String newMatcherName)
      Runs a matcher on top of another. This means that the previous matchings do not need to be recalculated. This will run the matcher only on the specified test case.
      Parameters:
      oldResults - the results from the previous runs already containing result from the oldMatcherName.
      testCase - the testcase on which the matchers should be executed.
      oldMatcherName - the matcher name which should exist in previous results
      newMatcher - the new matcher
      newMatcherName - the new matcher name
      Returns:
      the execution results together with the new matcher
    • runMatcherOnTop

      public static ExecutionResultSet runMatcherOnTop(ExecutionResultSet oldResults, TestCase testCase, String oldMatcherName, Map<String,Object> newMatchers)
      Runs a matcher on top of another. This means that the previous matchings do not need to be recalculated. This will run the matcher only on the specified test case.
      Parameters:
      oldResults - the results from the previous runs already containing result from the oldMatcherName.
      testCase - the testcase on which the matchers should be executed.
      oldMatcherName - the matcher name which should exist in previous results
      newMatchers - the new matchers as a map where the key is the matcher name and value the actual matcher
      Returns:
      the execution results together with the new matcher
    • runMatcherOnTop

      public static ExecutionResultSet runMatcherOnTop(ExecutionResult oldResult, Map<String,Object> newMatchers)
      Runs a matcher on top of another. This means that the previous matchings do not need to be recalculated. This will run the matcher on exactly one execution result.
      Parameters:
      oldResult - the old result
      newMatchers - the new matchers as a map where the key is the matcher name and value the actual matcher
      Returns:
      the execution results together with the new matcher
    • runMatcherOnTop

      public static ExecutionResult runMatcherOnTop(ExecutionResult oldResult, Object newMatcher, String newMatcherName)
      Runs a matcher on top of another. This means that the previous matchings do not need to be recalculated. This will run the matcher on exactly one execution result.
      Parameters:
      oldResult - the old result
      newMatcher - the new matcher
      newMatcherName - the new matcher name
      Returns:
      the execution results together with the new matcher