Class: RDF::N3::Algebra::Math::ACosH

Inherits:
ResourceOperator
  • Object
show all
Defined in:
lib/rdf/n3/algebra/math/acosh.rb

Overview

The object is calulated as the inverse hyperbolic cosine value of the subject.

Constant Summary collapse

NAME =
:mathACosH
URI =
RDF::N3::Math.acosh

Instance Attribute Summary

Attributes included from Enumerable

#existentials, #universals

Instance Method Summary collapse

Methods inherited from ResourceOperator

#as_literal, #execute, #input_operand, #valid?

Methods included from Builtin

#each, #evaluate, #hash, #input_operand, #rank, #to_uri

Instance Method Details

#resolve(resource, position:) ⇒ RDF::Term

The math:acosh operator takes string or number and calculates its inverse hyperbolic cosine.

Parameters:

  • resource (RDF::Term)
  • position (:subject, :object)

Returns:

See Also:

  • ResourceOperator#evaluate


15
16
17
18
19
20
21
22
23
24
# File 'lib/rdf/n3/algebra/math/acosh.rb', line 15

def resolve(resource, position:)
  case position
  when :subject
    return nil unless resource.literal?
    as_literal(Math.acosh(resource.as_number.object))
  when :object
    return nil unless resource.literal? || resource.variable?
    resource
  end
end