Class: RDF::N3::Algebra::Math::EqualTo
- Inherits:
-
ResourceOperator
- Object
- SPARQL::Algebra::Operator::Binary
- ResourceOperator
- RDF::N3::Algebra::Math::EqualTo
- Defined in:
- lib/rdf/n3/algebra/math/equal_to.rb
Overview
schema: $a1 math:equalTo $a2
summary: checks equality of numbers
definition: true
if and only if $a1
is equal to $a2
. Requires both arguments to be either concrete numerals, or variables bound to a numeral.
literal domains:
-
$a1
:xs:decimal
(or its derived types),xs:float
, orxs:double
(see note on type promotion, and casting from string) -
$a2
:xs:decimal
(or its derived types),xs:float
, orxs:double
(see note on type promotion, and casting from string)
Direct Known Subclasses
Constant Summary collapse
Instance Attribute Summary
Attributes included from Enumerable
Instance Method Summary collapse
-
#apply(term1, term2) ⇒ RDF::Literal::Boolean
Returns TRUE if
term1
andterm2
are the same numeric value. -
#input_operand ⇒ Object
Both subject and object are inputs.
-
#resolve(resource, position:) ⇒ RDF::Term
Resolves inputs as numbers.
Methods inherited from ResourceOperator
#as_literal, #execute, #valid?
Methods included from Builtin
#each, #evaluate, #hash, #rank, #to_uri
Instance Method Details
#apply(term1, term2) ⇒ RDF::Literal::Boolean
Returns TRUE if term1
and term2
are the same numeric value.
50 51 52 |
# File 'lib/rdf/n3/algebra/math/equal_to.rb', line 50 def apply(term1, term2) RDF::Literal(term1 == term2) end |
#input_operand ⇒ Object
Both subject and object are inputs.
35 36 37 |
# File 'lib/rdf/n3/algebra/math/equal_to.rb', line 35 def input_operand RDF::N3::List.new(values: operands) end |
#resolve(resource, position:) ⇒ RDF::Term
Resolves inputs as numbers.
30 31 32 |
# File 'lib/rdf/n3/algebra/math/equal_to.rb', line 30 def resolve(resource, position:) resource.as_number if resource.term? end |