Package com.complexible.common.rdf.random

# Class RandomStatementGenerator

java.lang.Object
com.google.common.collect.UnmodifiableIterator<Statement>
com.complexible.common.rdf.random.RandomStatementGenerator

All Implemented Interfaces:
  `Iterator<Statement>`

public class RandomStatementGenerator extends com.google.common.collect.UnmodifiableIterator<Statement>
Generates an infinite sequence of random RDF triples. Configuration options can be used to control what kind of triples are generated.

Since:
  3.1.2
Version:
  6.0
Author:
  Evren Sirin

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `RandomStatementGenerator()`
  `RandomStatementGenerator(RandomValueGenerator theRandomValueGenerator)`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `int`
  `getNumberOfDistinctClasses()`
  `int`
  `getNumberOfDistinctProperties()`
  `int`
  `getNumberOfStatementsPerSubject()`
  `int`
  `getNumberOfSubjectsPerGraph()`
  `boolean`
  `hasNext()`
  `static void`
  `main(String[] args)`
  `Statement`
  `next()`
  Returns the next random triple.
  `static <T> T`
  `pickFrom(List<? extends T> resources, Random rnd)`
  `static Set<Statement>`
  `randomGraph(Random rnd, int numNodes, int numEdges, List<IRI> predicates)`
  A utility method to generate a simple random graph with the given number of nodes and edges chosen at random from the provided list of predicates.
  `static List<Resource>`
  `randomSubjects(Set<Statement> data, Random rnd, int size)`
  `void`
  `setNumberOfDistinctClasses(int theNumberOfDistinctClasses)`
  Sets the number of distinct classes to be used as types.
  `void`
  `setNumberOfDistinctProperties(int theNumberOfDistinctProperties)`
  Sets the number of distinct properties to be used.
  `void`
  `setNumberOfStatementsPerSubject(int theNumberOfStatementsPerSubject)`
  Sets the number of statements to be generated for a given subject.
  `void`
  `setNumberOfSubjectsPerGraph(int theNumberOfSubjectsPerGraph)`
  Sets the number of subjects generated per graph.

  ### Methods inherited from class com.google.common.collect.UnmodifiableIterator

  `remove`

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

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

  ### Methods inherited from interface java.util.Iterator

  `forEachRemaining`

- ## Constructor Details

  - ### RandomStatementGenerator

    public RandomStatementGenerator()

  - ### RandomStatementGenerator

    public RandomStatementGenerator(RandomValueGenerator theRandomValueGenerator)

- ## Method Details

  - ### hasNext

    public boolean hasNext()

  - ### getNumberOfDistinctProperties

    public int getNumberOfDistinctProperties()

  - ### setNumberOfDistinctProperties

    public void setNumberOfDistinctProperties(int theNumberOfDistinctProperties)
    Sets the number of distinct properties to be used. If set to 0, completely random set of properties will be generated.

  - ### getNumberOfStatementsPerSubject

    public int getNumberOfStatementsPerSubject()

  - ### setNumberOfStatementsPerSubject

    public void setNumberOfStatementsPerSubject(int theNumberOfStatementsPerSubject)
    Sets the number of statements to be generated for a given subject. Set to 0 to use completely random set of properties.

  - ### getNumberOfDistinctClasses

    public int getNumberOfDistinctClasses()

  - ### setNumberOfDistinctClasses

    public void setNumberOfDistinctClasses(int theNumberOfDistinctClasses)
    Sets the number of distinct classes to be used as types. If set to 0, no `rdf:type` triples will be generated.

  - ### getNumberOfSubjectsPerGraph

    public int getNumberOfSubjectsPerGraph()

  - ### setNumberOfSubjectsPerGraph

    public void setNumberOfSubjectsPerGraph(int theNumberOfSubjectsPerGraph)
    Sets the number of subjects generated per graph. Default is 0 which means no named graphs are generated. Set to `Integer.MAX_VALUE` to generate a single named graph.

  - ### next

    public Statement next()
    Returns the next random triple.

  - ### randomGraph

    public static Set<Statement> randomGraph(Random rnd, int numNodes, int numEdges, List<IRI> predicates)
    A utility method to generate a simple random graph with the given number of nodes and edges chosen at random from the provided list of predicates. Should not be used for any kind of performance tests because the graph is unlikely to exhibit realistic properties.

  - ### randomSubjects

    public static List<Resource> randomSubjects(Set<Statement> data, Random rnd, int size)

  - ### pickFrom

    public static <T> T pickFrom(List<? extends T> resources, Random rnd)

  - ### main

    public static void main(String[] args)