Microdata v0.0.1 Microdata.Item View Source

Microdata.Item structs are read from a microdata document.

Link to this section Summary

Functions

Lookup item properties with matching names

Resolve the vocabulary of a typed item or list of types

Link to this section Types

Link to this type t() View Source
t() :: %Microdata.Item{
  id: URI.t(),
  properties: [Microdata.Property.t()],
  types: MapSet.t(String.t())
}

Link to this section Functions

Lookup item properties with matching names.

Examples (not a doctest)

iex> Microdata.Item.lookup(item, “foo”) [%Microdata.Property{names: [“foo”], …}, …]

iex> Microdata.Item.lookup([“foo”, “bar”]) [

%Microdata.Property{names: ["foo"], ...},
%Microdata.Property{names: ["bar"], ...}, ...

]

Link to this function vocabulary(types) View Source
vocabulary(Microdata.Item.t()) :: String.t() | nil
vocabulary(MapSet.t()) :: String.t() | nil

Resolve the vocabulary of a typed item or list of types.

Examples

iex> Microdata.Item.vocabulary(%Microdata.Item{}) nil

iex> Microdata.Item.vocabulary(%Microdata.Item{types: MapSet.new([“foo”])}) “foo/“

iex> Microdata.Item.vocabulary([“foo”, “bar”]) “foo/“

iex> Microdata.Item.vocabulary([“foo#bar”]) “foo”

iex> Microdata.Item.vocabulary([“foo/bar”]) “foo/“

iex> Microdata.Item.vocabulary([“foo/bar/baz”]) “foo/bar/“