Class RdfModelHelper

java.lang.Object
org.spdx.rdfparser.RdfModelHelper

public final class RdfModelHelper
extends Object
Static class containing helper methods for implementations of IRdfModel
Author:
Gary O'Neall
  • Method Details

    • arraysEqual

      public static boolean arraysEqual​(Object[] array1, Object[] array2)
      Compares 2 arrays to see if thier content is the same independent of order and considering nulls
      Parameters:
      array1 -
      array2 -
      Returns:
    • stringsEquivalent

      public static boolean stringsEquivalent​(String s1, String s2)
      Strings are considered equivalent if they are equal, or if they are null and/or empty (null and empty strings are considered equivalent) linefeeds are also normalized (e.g. \r\n is the same as \r)
      Parameters:
      s1 -
      s2 -
      Returns:
    • arraysEquivalent

      public static boolean arraysEquivalent​(IRdfModel[] array1, IRdfModel[] array2)
      Compares 2 arrays to see if the property values for the element RdfModelObjects are the same independent of order and considering nulls
      Parameters:
      array1 -
      array2 -
      Returns:
    • equivalentConsideringNull

      public static boolean equivalentConsideringNull​(IRdfModel o1, IRdfModel o2)
      Compares the properties of two RdfModelObjects considering possible null values
      Parameters:
      o1 -
      o2 -
      Returns:
    • findDuplicateResource

      public static org.apache.jena.rdf.model.Resource findDuplicateResource​(IModelContainer modelContainer, String uri)
      Search the model to see if there is a duplicate resource either based on the URI or based on other information. Subclasses may choose to override this method to prevent duplicate resource from being created with the same properties.
      Parameters:
      modelContainer -
      uri -
      Returns:
      Any duplicate resource found. Null if no duplicate resource was found.
      Throws:
      InvalidSPDXAnalysisException