Class ModelComparisonHelper

java.lang.Object
org.hobbit.utils.test.ModelComparisonHelper

public class ModelComparisonHelper extends Object
A simple utility class that helps comparing two models.
Author:
Michael Röder (roeder@informatik.uni-leipzig.de)
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static Set<org.apache.jena.rdf.model.Statement>
    getMissingStatements(org.apache.jena.rdf.model.Model modelA, org.apache.jena.rdf.model.Model modelB)
    Collects statements that can be found in model A but not in model B.
    static boolean
    modelContainsStatement(org.apache.jena.rdf.model.Model model, org.apache.jena.rdf.model.Statement s)
    Checks whether the given statement can be found in the given model.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • ModelComparisonHelper

      public ModelComparisonHelper()
  • Method Details

    • getMissingStatements

      public static Set<org.apache.jena.rdf.model.Statement> getMissingStatements(org.apache.jena.rdf.model.Model modelA, org.apache.jena.rdf.model.Model modelB)
      Collects statements that can be found in model A but not in model B. If A and B are seen as sets of statements, this method returns the difference A\B.
      Parameters:
      modelA - the model that should be fully contained inside model B.
      modelB - the model that should fully contain model A.
      Returns:
      the difference A\B which is empty if A is a subset of B
    • modelContainsStatement

      public static boolean modelContainsStatement(org.apache.jena.rdf.model.Model model, org.apache.jena.rdf.model.Statement s)
      Checks whether the given statement can be found in the given model. If the given statement contains blank nodes (= Anon nodes) they are replaced by variables.
      Parameters:
      model - the model that might contain the given statement
      s - the statement which could be contained in the given model
      Returns:
      true if the statement can be found in the model, false otherwise