Class ModelSupport

java.lang.Object
eu.dnetlib.dhp.schema.common.ModelSupport

public class ModelSupport extends Object
Oaf model utility methods.
  • Field Details

  • Method Details

    • findInverse

      public static RelationInverse findInverse(String encoding)
      Helper method: lookup relation inverse, given the direct relation encoding (case insensitive)
      Parameters:
      encoding -
      Returns:
      the relation inverse descriptor, throws @IllegalArgumentException when not found.
    • findRelation

      public static RelationInverse findRelation(String relationName)
      Helper method: fina a relation filtering by a relation name
      Parameters:
      relationName -
      Returns:
    • rel

      public static String rel(String relType, String subRelType, String relClass)
      Helper method: combines the relation attributes
      Parameters:
      relType -
      subRelType -
      relClass -
      Returns:
    • getIdPrefix

      public static <E> String getIdPrefix(Class<E> clazz)
    • isSubClass

      public static <X extends Oaf, Y extends Oaf> Boolean isSubClass(X subClazzObject, Y superClazzObject)
      Checks subclass-superclass relationship.
      Type Parameters:
      X - Subclass type
      Y - Superclass type
      Parameters:
      subClazzObject - Subclass object instance
      superClazzObject - Superclass object instance
      Returns:
      True if X is a subclass of Y
    • isSubClass

      public static <X extends Oaf, Y extends Oaf> Boolean isSubClass(X subClazzObject, Class<Y> superClazz)
      Checks subclass-superclass relationship.
      Type Parameters:
      X - Subclass type
      Y - Superclass type
      Parameters:
      subClazzObject - Subclass object instance
      superClazz - Superclass class
      Returns:
      True if X is a subclass of Y
    • isSubClass

      public static <X extends Oaf, Y extends Oaf> Boolean isSubClass(Class<X> subClazz, Class<Y> superClazz)
      Checks subclass-superclass relationship.
      Type Parameters:
      X - Subclass type
      Y - Superclass type
      Parameters:
      subClazz - Subclass class
      superClazz - Superclass class
      Returns:
      True if X is a subclass of Y
    • getOafModelClasses

      public static <T extends Oaf> Class<T>[] getOafModelClasses()
      Lists all the OAF model classes
      Type Parameters:
      T -
      Returns:
    • getMainType

      public static String getMainType(EntityType type)
    • isResult

      public static boolean isResult(EntityType type)
    • getScheme

      public static String getScheme(String sourceType, String targetType)
    • tableIdentifier

      public static <T extends Oaf> String tableIdentifier(String dbName, String tableName)
    • tableIdentifier

      public static <T extends Oaf> String tableIdentifier(String dbName, Class<T> clazz)
    • idFn

      public static <T extends Oaf> Function<T,String> idFn()
    • md5

      public static String md5(String s)
    • generateIdentifier

      public static String generateIdentifier(String originalId, String nsPrefix)
    • oldest

      public static String oldest(String dateA, String dateB) throws ParseException
      Throws:
      ParseException