Class: RDF::N3::Algebra::Math::CosH
- Inherits:
-
ResourceOperator
- Object
- SPARQL::Algebra::Operator::Binary
- ResourceOperator
- RDF::N3::Algebra::Math::CosH
- Defined in:
- lib/rdf/n3/algebra/math/cosh.rb
Overview
The subject is an angle expressed in radians. The object is calulated as the hyperbolic cosine value of the subject.
Constant Summary collapse
Instance Attribute Summary
Attributes included from Enumerable
Instance Method Summary collapse
-
#input_operand ⇒ RDF::Term
Input is either the subject or object.
-
#resolve(resource, position:) ⇒ RDF::Term
The math:cosh operator takes string or number and calculates its hyperbolic cosine.
Methods inherited from ResourceOperator
#as_literal, #execute, #valid?
Methods included from Builtin
#each, #evaluate, #hash, #rank, #to_uri
Instance Method Details
#input_operand ⇒ RDF::Term
Input is either the subject or object
34 35 36 |
# File 'lib/rdf/n3/algebra/math/cosh.rb', line 34 def input_operand RDF::N3::List.new(values: operands) end |
#resolve(resource, position:) ⇒ RDF::Term
The math:cosh operator takes string or number and calculates its hyperbolic cosine. The inverse hyperbolic cosine of a concrete object can also calculate a variable subject.
15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/rdf/n3/algebra/math/cosh.rb', line 15 def resolve(resource, position:) case resource when RDF::Query::Variable then resource when RDF::Literal case position when :subject as_literal(Math.cosh(resource.as_number.object)) when :object as_literal(Math.acosh(resource.as_number.object)) end else nil end end |