Class RandomGuidGenerator

java.lang.Object
org.wikidata.wdtk.wikibaseapi.RandomGuidGenerator
All Implemented Interfaces:
GuidGenerator

public class RandomGuidGenerator extends Object implements GuidGenerator
Generates fresh hashes for new statements, snaks or references, based on Java's own random generator (java.util.UUID).
Author:
antonin
  • Constructor Details

    • RandomGuidGenerator

      public RandomGuidGenerator()
  • Method Details

    • freshStatementId

      public String freshStatementId(String entityId)
      Generates a fresh statement id. This consists of a first part with the entity id of the item the statement belongs to, plus a random hash of the form /^\{?[A-Z\d]{8}-[A-Z\d]{4}-[A-Z\d]{4}-[A-Z\d]{4}-[A-Z\d]{12}\}?\z/
      Specified by:
      freshStatementId in interface GuidGenerator
      Parameters:
      entityId - the entity the statement belongs to
      Returns:
      a fresh UUID in the required format.