Package org.eclipse.rdf4j.repository.util

## Class RepositoryUtil

- java.lang.Object
- - org.eclipse.rdf4j.repository.util.RepositoryUtil

-     public class RepositoryUtil
      extends Object

  Utility methods for comparing sets of statements (graphs) with each other. The supplied comparison operations map bnodes in the two supplied models on to each other and thus define a graph isomorphism.
  Author:
    jeen, Arjohn Kampman

- - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `RepositoryUtil()` |

  - ### Method Summary

    All Methods Static Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `static Collection<? extends Statement>` | `difference​(Collection<? extends Statement> model1, Collection<? extends Statement> model2)` | Compares two models, defined by two statement collections, and returns the difference between the first and the second model (that is, all statements that are present in model1 but not in model2).
    `static Collection<? extends Statement>` | `difference​(Repository rep1, Repository rep2)` | Compares two models defined by the default context of two repositories and returns the difference between the first and the second model (that is, all statements that are present in rep1 but not in rep2).
    `static boolean` | `equals​(Repository rep1, Repository rep2)` | Compares the models in the default contexts of the two supplied repositories and returns true if they are equal.
    `static boolean` | `isSubset​(Repository rep1, Repository rep2)` | Compares the models of the default context of two repositories and returns true if rep1 is a subset of rep2.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### RepositoryUtil

          public RepositoryUtil()

  - ### Method Detail

    - #### equals

          public static boolean equals​(Repository rep1,
                                       Repository rep2)
                                throws RepositoryException

      Compares the models in the default contexts of the two supplied repositories and returns true if they are equal. Models are equal if they contain the same set of statements. bNodes IDs are not relevant for model equality, they are mapped from one model to the other by using the attached properties. Note that the method pulls the entire default context of both repositories into main memory. Use with caution.
      Throws:
        `RepositoryException`

    - #### isSubset

          public static boolean isSubset​(Repository rep1,
                                         Repository rep2)
                                  throws RepositoryException

      Compares the models of the default context of two repositories and returns true if rep1 is a subset of rep2. Note that the method pulls the entire default context of both repositories into main memory. Use with caution.
      Throws:
        `RepositoryException`

    - #### difference

          public static Collection<? extends Statement> difference​(Repository rep1,
                                                                   Repository rep2)
                                                            throws RepositoryException

      Compares two models defined by the default context of two repositories and returns the difference between the first and the second model (that is, all statements that are present in rep1 but not in rep2). Blank node IDs are not relevant for model equality, they are mapped from one model to the other by using the attached properties. Note that the method pulls the entire default context of both repositories into main memory. Use with caution.

      NOTE: this algorithm is currently broken; it doesn't actually map blank nodes between the two models.

      Returns:
        The collection of statements that is the difference between rep1 and rep2.
      Throws:
        `RepositoryException`

    - #### difference

          public static Collection<? extends Statement> difference​(Collection<? extends Statement> model1,
                                                                   Collection<? extends Statement> model2)

      Compares two models, defined by two statement collections, and returns the difference between the first and the second model (that is, all statements that are present in model1 but not in model2). Blank node IDs are not relevant for model equality, they are mapped from one model to the other by using the attached properties. *

      NOTE: this algorithm is currently broken; it doesn't actually map blank nodes between the two models.

      Returns:
        The collection of statements that is the difference between model1 and model2.