Class: RDF::N3::Algebra::Math::Negation
- Inherits:
- 
      ResourceOperator
      
        - Object
- SPARQL::Algebra::Operator::Binary
- ResourceOperator
- RDF::N3::Algebra::Math::Negation
 
- Includes:
- Builtin
- Defined in:
- lib/rdf/n3/algebra/math/negation.rb
Overview
The subject or object is calculated to be the negation of the other.
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:negation operator takes may have either a bound subject or object. 
Methods included from Builtin
#each, #evaluate, #hash, #rank, #to_uri
Methods inherited from ResourceOperator
#as_literal, #execute, #valid?
Instance Method Details
#input_operand ⇒ RDF::Term
Input is either the subject or object
| 34 35 36 | # File 'lib/rdf/n3/algebra/math/negation.rb', line 34 def input_operand RDF::N3::List.new(values: operands) end | 
#resolve(resource, position:) ⇒ RDF::Term
The math:negation operator takes may have either a bound subject or object.
| 19 20 21 22 23 24 25 26 27 28 | # File 'lib/rdf/n3/algebra/math/negation.rb', line 19 def resolve(resource, position:) case resource when RDF::Query::Variable resource when RDF::Literal as_literal(-resource.as_number) else nil end end |