class RDF::N3::Algebra::Math::Negation

The subject or object is calculated to be the negation of the other.

@see www.w3.org/TR/xpath-functions/#func-numeric-unary-minus

Constants

NAME
URI

Public Instance Methods

input_operand() click to toggle source

Input is either the subject or object

@return [RDF::Term]

# File lib/rdf/n3/algebra/math/negation.rb, line 34
def input_operand
  RDF::N3::List.new(values: operands)
end
resolve(resource, position:) click to toggle source

The math:negation operator takes may have either a bound subject or object.

@param [RDF::Term] resource @param [:subject, :object] position @return [RDF::Term] @see RDF::N3::ResourceOperator#evaluate

# 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