Class: SPARQL::Algebra::Operator::Adjust
- Inherits:
 - 
      Binary
      
        
- Object
 - SPARQL::Algebra::Operator
 - Binary
 - SPARQL::Algebra::Operator::Adjust
 
 
- Includes:
 - Evaluatable
 
- Defined in:
 - lib/sparql/algebra/operator/adjust.rb
 
Overview
The SPARQL adjust operator.
[121] BuiltInCall ::= … | ‘ADJUST’ ‘(’ Expression ‘,’ Expression ‘)’
Constant Summary collapse
- NAME =
 [:adjust]
Constants inherited from Binary
Constants inherited from SPARQL::Algebra::Operator
Constants included from Expression
Instance Attribute Summary
Attributes inherited from SPARQL::Algebra::Operator
Instance Method Summary collapse
- 
  
    
      #apply(operand, duration, **options)  ⇒ RDF::Literal 
    
    
  
  
  
  
  
  
  
  
  
    
Returns the first operand adjusted by the dayTimeDuration of the second operand.
 - 
  
    
      #to_sparql(**options)  ⇒ String 
    
    
  
  
  
  
  
  
  
  
  
    
Returns a partial SPARQL grammar for this operator.
 
Methods included from Evaluatable
#evaluate, #memoize, #replace_aggregate!, #replace_vars!
Methods inherited from Binary
Methods inherited from SPARQL::Algebra::Operator
#aggregate?, arity, #base_uri, base_uri, base_uri=, #bind, #boolean, #constant?, #deep_dup, #each_descendant, #eql?, #evaluatable?, evaluate, #executable?, #first_ancestor, for, #initialize, #inspect, #mergable?, #ndvars, #node?, #operand, #optimize, #optimize!, #parent, #parent=, #prefixes, prefixes, prefixes=, #rewrite, #to_binary, to_sparql, #to_sxp, #to_sxp_bin, #validate!, #variable?, #variables, #vars
Methods included from Expression
cast, #constant?, #evaluate, extension, extension?, extensions, for, #invalid?, new, #node?, open, #optimize, #optimize!, parse, register_extension, #to_sxp_bin, #valid?, #validate!, #variable?
Constructor Details
This class inherits a constructor from SPARQL::Algebra::Operator::Binary
Instance Method Details
#apply(operand, duration, **options) ⇒ RDF::Literal
Returns the first operand adjusted by the dayTimeDuration of the second operand
      42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57  | 
    
      # File 'lib/sparql/algebra/operator/adjust.rb', line 42 def apply(operand, duration, **) case operand when RDF::Literal::Temporal case duration when RDF::Literal::DayTimeDuration operand.adjust_to_timezone(duration) when RDF::Literal raise TypeError, "expected second operand to be an empty literal, but got #{duration.inspect}" unless duration.to_s.empty? operand.adjust_to_timezone(nil) else raise TypeError, "expected second operand to be an RDF::Literal::DayTimeDuration, but got #{duration.inspect}" end else raise TypeError, "expected first operand to be an RDF::Literal::Temporal, but got #{operand.inspect}" end end  | 
  
#to_sparql(**options) ⇒ String
Returns a partial SPARQL grammar for this operator.
      64 65 66  | 
    
      # File 'lib/sparql/algebra/operator/adjust.rb', line 64 def to_sparql(**) "ADJUST(#{operands.to_sparql(delimiter: ', ', **)})" end  |