RDF.BlankNode.Generator.Algorithm behaviour (RDF.ex v0.9.1) View Source

A behaviour for implementations of blank node identifier generation algorithms.

The RDF.BlankNode.Generator executes such an algorithm and holds its state.

Link to this section Summary

Callbacks

Generates a blank node.

Generates a blank node for a given string.

Returns the initial state of the algorithm.

Link to this section Callbacks

Specs

generate(state :: map()) :: {RDF.BlankNode.t(), map()}

Generates a blank node.

An implementation should compute a blank node from the given state and return a tuple consisting of the generated blank node and the new state.

Link to this callback

generate_for(value, state)

View Source

Specs

generate_for(value :: any(), state :: map()) :: {RDF.BlankNode.t(), map()}

Generates a blank node for a given string.

Every call with the same string must return the same blank node.

An implementation should compute a blank node for the given string from the given state and return a tuple consisting of the generated blank node and the new state.

Specs

init(opts :: map() | keyword()) :: map()

Returns the initial state of the algorithm.