Class: RDF::N3::Algebra::Str::GreaterThan
- Inherits:
-
ResourceOperator
- Object
- SPARQL::Algebra::Operator::Binary
- ResourceOperator
- RDF::N3::Algebra::Str::GreaterThan
- Defined in:
- lib/rdf/n3/algebra/str/greater_than.rb
Overview
True iff the string is greater than the object when ordered according to Unicode(tm) code order.
Direct Known Subclasses
Constant Summary collapse
Instance Attribute Summary
Attributes included from Enumerable
Instance Method Summary collapse
- #apply(left, right) ⇒ RDF::Literal::Boolean
-
#input_operand ⇒ Object
Both subject and object are inputs.
-
#resolve(resource, position:) ⇒ RDF::Term
The string:greaterThan compares subject with object as strings.
Methods inherited from ResourceOperator
#as_literal, #execute, #valid?
Methods included from Builtin
#each, #evaluate, #hash, #rank, #to_uri
Instance Method Details
#apply(left, right) ⇒ RDF::Literal::Boolean
29 30 31 32 33 34 35 36 |
# File 'lib/rdf/n3/algebra/str/greater_than.rb', line 29 def apply(left, right) case when !left.is_a?(RDF::Term) || !right.is_a?(RDF::Term) || !left.compatible?(right) log_error(NAME) {"expected two RDF::Literal operands, but got #{left.inspect} and #{right.inspect}"} when left > right then RDF::Literal::TRUE else RDF::Literal::FALSE end end |
#input_operand ⇒ Object
Both subject and object are inputs.
19 20 21 |
# File 'lib/rdf/n3/algebra/str/greater_than.rb', line 19 def input_operand RDF::N3::List.new(values: operands) end |
#resolve(resource, position:) ⇒ RDF::Term
The string:greaterThan compares subject with object as strings.
14 15 16 |
# File 'lib/rdf/n3/algebra/str/greater_than.rb', line 14 def resolve(resource, position:) resource if resource.literal? end |