# `RDF.XSD.Int`
[🔗](https://github.com/rdf-elixir/rdf-ex/blob/v3.0.0/lib/rdf/xsd/datatypes/int.ex#L1)

`RDF.XSD.Datatype` for `xsd:int`.

See: <https://www.w3.org/TR/xmlschema11-2/#int>

# `invalid_value`

```elixir
@type invalid_value() :: nil
```

# `t`

```elixir
@type t() :: %RDF.XSD.Int{
  uncanonical_lexical: RDF.XSD.Datatype.uncanonical_lexical(),
  value: value()
}
```

# `valid_value`

```elixir
@type valid_value() :: RDF.XSD.Long.valid_value()
```

# `value`

```elixir
@type value() :: valid_value() | invalid_value()
```

# `canonical`

Produces the canonical representation of a `RDF.Literal` of this datatype.

# `canonical?`

Determines if the lexical form of a `RDF.Literal` of this datatype is the canonical form.

# `canonical_lexical`

Returns the canonical lexical form of a `RDF.Literal` of this datatype.

# `cast`

```elixir
@spec cast(RDF.Literal.Datatype.literal() | RDF.Term.t()) :: RDF.Literal.t() | nil
```

Casts a datatype literal of one type into a datatype literal of another type.

Returns `nil` when the given arguments are not castable into this datatype or when the given argument is an
invalid literal.

Implementations define the casting for a given value with the `c:RDF.Literal.Datatype.do_cast/1` callback.

# `compare`

```elixir
@spec compare(RDF.Literal.t() | any(), RDF.Literal.t() | any()) ::
  RDF.Literal.Datatype.comparison_result() | :indeterminate | nil
```

Compares two `RDF.Literal`s.

If the first literal is greater than the second `:gt` is returned, if less than `:lt` is returned.
If both literal are equal `:eq` is returned.
If the literals can not be compared either `nil` is returned, when they generally can be compared
due to their datatype, or `:indeterminate` is returned, when the order of the given values is
not defined on only partially ordered datatypes.

# `datatype?`

Checks if the given literal has this datatype or a datatype that is derived of it.

# `equal_value?`

Checks if two datatype literals are equal in terms of the values of their value space.

Non-`RDF.Literal`s  are tried to be coerced via `RDF.Literal.coerce/1` before comparison.

Returns `nil` when the given arguments are not comparable as literals of this
datatype.

Invalid literals are only considered equal in this relation when both have the exact same
datatype and the same attributes (lexical form, language etc.).

Implementations can customize this equivalence relation via the `c:RDF.Literal.Datatype.do_equal_value_different_datatypes?/2`
and `c:RDF.Literal.Datatype.do_equal_value_different_datatypes?/2` callbacks.

# `lexical`

Returns the lexical form of a `RDF.Literal` of this datatype.

# `new`

Creates a new `RDF.Literal` with this datatype and the given `value`.

# `new!`

Creates a new `RDF.Literal` with this datatype and the given `value` or fails when it is not valid.

# `update`

Updates the value of a `RDF.Literal` without changing everything else.

# `valid?`

Determines if a `RDF.Literal` of this or a derived datatype has a proper value of its value space.

# `value`

Returns the value of a `RDF.Literal` of this or a derived datatype.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
