class RDF::N3::Algebra::Math::ACos

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

Constants

NAME
URI

Public Instance Methods

resolve(resource, position:) click to toggle source

The math:acos operator takes string or number and calculates its arc cosine.

@param [RDF::Term] resource @param [:subject, :object] position @return [RDF::Term] @see RDF::N3::ResourceOperator#evaluate

# File lib/rdf/n3/algebra/math/acos.rb, line 15
def resolve(resource, position:)
  case position
  when :subject
    return nil unless resource.literal?
    as_literal(Math.acos(resource.as_number.object))
  when :object
    return nil unless resource.literal? || resource.variable?
    resource
  end
end