RDF.ex v0.6.1 RDF.Boolean View Source
RDF.Datatype
for XSD boolean.
Link to this section Summary
Functions
Returns an Effective Boolean Value (EBV).
Alias for ebv/1
.
Returns RDF.true
if the effective boolean value of the given argument is RDF.false
, or RDF.false
if it is RDF.true
.
Returns the logical AND
of the effective boolean value of the given arguments.
Returns the logical OR
of the effective boolean value of the given arguments.
Link to this section Functions
build_literal(value, lexical, opts) View Source
build_literal_by_lexical(lexical, opts) View Source
build_literal_by_value(value, opts) View Source
ebv(value) View Source
Returns an Effective Boolean Value (EBV).
The Effective Boolean Value is an algorithm to coerce values to a RDF.Boolean
.
It is specified and used in the SPARQL query language and is based upon XPath's
fn:boolean
. Other than specified in these specs any value which can not be
converted into a boolean results in nil
.
see
effective(value) View Source
Alias for ebv/1
.
fn_not(value) View Source
Returns RDF.true
if the effective boolean value of the given argument is RDF.false
, or RDF.false
if it is RDF.true
.
Otherwise it returns nil
.
Examples
iex> RDF.Boolean.fn_not(RDF.true)
RDF.false
iex> RDF.Boolean.fn_not(RDF.false)
RDF.true
iex> RDF.Boolean.fn_not(true)
RDF.false
iex> RDF.Boolean.fn_not(false)
RDF.true
iex> RDF.Boolean.fn_not(42)
RDF.false
iex> RDF.Boolean.fn_not("")
RDF.true
iex> RDF.Boolean.fn_not(nil)
nil
greater_than?(literal1, literal2) View Source
less_than?(literal1, literal2) View Source
logical_and(left, right) View Source
Returns the logical AND
of the effective boolean value of the given arguments.
It returns nil
if only one argument is nil
and the other argument is
RDF.true
and RDF.false
if the other argument is RDF.false
.
Examples
iex> RDF.Boolean.logical_and(RDF.true, RDF.true)
RDF.true
iex> RDF.Boolean.logical_and(RDF.true, RDF.false)
RDF.false
iex> RDF.Boolean.logical_and(RDF.true, nil)
nil
iex> RDF.Boolean.logical_and(nil, RDF.false)
RDF.false
iex> RDF.Boolean.logical_and(nil, nil)
nil
logical_or(left, right) View Source
Returns the logical OR
of the effective boolean value of the given arguments.
It returns nil
if only one argument is nil
and the other argument is
RDF.false
and RDF.true
if the other argument is RDF.true
.
Examples
iex> RDF.Boolean.logical_or(RDF.true, RDF.false)
RDF.true
iex> RDF.Boolean.logical_or(RDF.false, RDF.false)
RDF.false
iex> RDF.Boolean.logical_or(RDF.true, nil)
RDF.true
iex> RDF.Boolean.logical_or(nil, RDF.false)
nil
iex> RDF.Boolean.logical_or(nil, nil)
nil