Class: RDF::N3::Algebra::Log::EqualTo

Inherits:
ResourceOperator
  • Object
show all
Defined in:
lib/rdf/n3/algebra/log/equal_to.rb

Overview

True if the subject and object are the same RDF node (symbol or literal). Do not confuse with owl:sameAs. A cwm built-in logical operator, RDF graph level.

Constant Summary collapse

NAME =
:logEqualTo
URI =
RDF::N3::Log.equalTo

Instance Attribute Summary

Attributes included from Enumerable

#existentials, #universals

Instance Method Summary collapse

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

Parameters:

Returns:

  • (RDF::Literal::Boolean)


30
31
32
# File 'lib/rdf/n3/algebra/log/equal_to.rb', line 30

def apply(left, right)
  RDF::Literal(left.sameTerm?(right))
end

#input_operandObject

Both subject and object are inputs.



20
21
22
# File 'lib/rdf/n3/algebra/log/equal_to.rb', line 20

def input_operand
  RDF::N3::List.new(values: operands)
end

#resolve(resource, position:) ⇒ RDF::Literal

Resolves inputs as terms.

Parameters:

  • resource (RDF::Term)
  • position (:subject, :object)

Returns:

See Also:

  • ResourceOperator#evaluate


15
16
17
# File 'lib/rdf/n3/algebra/log/equal_to.rb', line 15

def resolve(resource, position:)
  resource if resource.term?
end