Class: RDF::N3::Algebra::Math::ASin

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

Overview

The object is calulated as the arc sine value of the subject.

Constant Summary collapse

NAME =
:mathASin
URI =
RDF::N3::Math.asin

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:asin operator takes string or number and calculates its arc sine.

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/asin.rb', line 15

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