Class BlankNodeAllocatorAsGivenOrRandom

java.lang.Object
org.aksw.jenax.arq.util.node.BlankNodeAllocatorAsGivenOrRandom
All Implemented Interfaces:
org.apache.jena.riot.lang.BlankNodeAllocator

public class BlankNodeAllocatorAsGivenOrRandom extends Object implements org.apache.jena.riot.lang.BlankNodeAllocator
An adaption of BlankNodeAllocatorLabelEncoded which passes on labels as given, but allocates fresh ones based on incrementing a value scoped with a random per-jvm value. This means that any given blank node labels such as _:foo will be retained, but turtle constructs such as :s :p [] will yield unique blank nodes across jvms. TODO Should this class go to IO-related utils (parsing/serialization) instead?
Author:
Claus Stadler
  • Field Details

    • BNodeGenIdPrefix

      public static final String BNodeGenIdPrefix
      BNodeGenIdPrefix is a copy of BlankNodeAllocatorLabelEncoded's private attribute
      See Also:
    • globalBnodeScope

      protected final long globalBnodeScope
      A random per-jvm value used for blank node allocation
    • counter

      protected final AtomicLong counter
  • Constructor Details

    • BlankNodeAllocatorAsGivenOrRandom

      public BlankNodeAllocatorAsGivenOrRandom(long globalBnodeScope)
    • BlankNodeAllocatorAsGivenOrRandom

      public BlankNodeAllocatorAsGivenOrRandom(long globalBnodeScope, AtomicLong counter)
  • Method Details

    • getGlobalInstance

      public static BlankNodeAllocatorAsGivenOrRandom getGlobalInstance()
    • reset

      public void reset()
      Ignore reset - avoid clashes
      Specified by:
      reset in interface org.apache.jena.riot.lang.BlankNodeAllocator
    • alloc

      public org.apache.jena.graph.Node alloc(String label)
      Specified by:
      alloc in interface org.apache.jena.riot.lang.BlankNodeAllocator
    • create

      public org.apache.jena.graph.Node create()
      Specified by:
      create in interface org.apache.jena.riot.lang.BlankNodeAllocator