View Source Ontogen.Bog.Referencable behaviour (Ontogen v0.1.1)

Summary

Types

@type ref() :: String.t()
@type t() :: %Ontogen.Bog.Referencable{
  __additional_statements__: term(),
  __class__: term(),
  __hash__: term(),
  __id__: term(),
  __ref__: term()
}

Callbacks

@callback deref(ref(), RDF.Graph.t()) :: {:ok, Grax.Schema.t()} | {:error, any()}
@callback deref_id(ref()) :: {:ok, RDF.IRI.t()} | {:error, any()}
@callback this(RDF.Graph.t()) :: {:ok, Grax.Schema.t()} | {:error, any()}
@callback this_id() :: {:ok, RDF.IRI.t()} | {:error, any()}
@callback this_ref() :: ref()

Functions

Link to this function

deref(schema, ref, graph, opts \\ [])

View Source

Returns the fully instantiated referencable singleton resource of the given schema loaded from the given graph.

Link to this function

deref!(schema, ref, graph, opts \\ [])

View Source

Returns the IRI of the referencable resource of the given schema.

@spec from(Grax.Schema.t()) :: {:ok, t()} | {:error, any()}
@spec from!(Grax.Schema.t()) :: t()
Link to this function

load(graph, id, opts \\ [])

View Source
@spec load(
  RDF.Graph.t() | RDF.Description.t(),
  RDF.IRI.coercible() | RDF.BlankNode.t(),
  opts :: keyword()
) :: {:ok, t()} | {:error, any()}
Link to this function

load!(graph, id, opts \\ [])

View Source
@spec load!(
  RDF.Graph.t() | RDF.Description.t(),
  RDF.IRI.coercible() | RDF.BlankNode.t(),
  opts :: keyword()
) :: t()
Link to this function

load_from_rdf(graph, id, opts \\ [])

View Source
Link to this function

load_from_rdf!(graph, id, opts \\ [])

View Source
Link to this function

mint!(ref, schema_or_class)

View Source
Link to this function

new(ref, schema, opts \\ [])

View Source
Link to this function

new!(ref, schema_or_class, opts \\ [])

View Source

Returns the ref name for the referencable singleton instance of the given schema or class IRI.

Examples

iex> Ontogen.Bog.Referencable.this_ref(~I<https://w3id.org/ontogen#Service>)
"service"

iex> Ontogen.Bog.Referencable.this_ref(~I<http://xmlns.com/foaf/0.1/Agent>)
"agent"

iex> Ontogen.Bog.Referencable.this_ref(Ontogen.Agent)
"agent"

iex> Ontogen.Bog.Referencable.this_ref(FOAF.Agent)
"agent"
@spec type?(module()) :: boolean()

Checks if the given module is a Ontogen.Bog.Referencable.

Examples

iex> Ontogen.Bog.Referencable.type?(Ontogen.Repository)
true

iex> Ontogen.Bog.Referencable.type?(Ontogen.Commit)
false
Link to this function

validate(referencable, opts \\ [])

View Source