RDF.ex v0.7.0 RDF.BlankNode.Generator.Algorithm behaviour 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

Link to this callback

generate(state)

View Source
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
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.

Link to this callback

init(opts)

View Source
init(opts :: map() | Keyword.t() | nil) :: map()

Returns the initial state of the algorithm.