Class 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 Detail

      • ModelComparisonHelper

        public ModelComparisonHelper()
    • Method Detail

      • 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