Class: RDF::N3::Algebra::Log::Conjunction

Inherits:
RDF::N3::Algebra::ListOperator show all
Defined in:
lib/rdf/n3/algebra/log/conjunction.rb

Overview

A function to merge formulae: logical AND.

The subject is a list of formulae. The object, which can be generated, is a formula containing a copy of each of the formulae in the list on the left. A cwm built-in function.

Constant Summary collapse

NAME =
:logConjunction
URI =
RDF::N3::Log.conjunction

Instance Attribute Summary

Attributes included from Enumerable

#existentials, #universals

Instance Method Summary collapse

Methods inherited from RDF::N3::Algebra::ListOperator

#as_literal, #execute, #validate

Methods included from Builtin

#each, #evaluate, #hash, #rank, #to_uri

Instance Method Details

#input_operandRDF::Term

Return subject operand.

Returns:



32
33
34
# File 'lib/rdf/n3/algebra/log/conjunction.rb', line 32

def input_operand
  operands.first
end

#resolve(list) ⇒ RDF::N3::Algebra::Formula

Evaluates this operator by creating a new formula containing the triples from each of the formulae in the list.

Parameters:

Returns:

See Also:

  • ListOperator#evaluate


16
17
18
19
20
21
22
23
24
25
26
# File 'lib/rdf/n3/algebra/log/conjunction.rb', line 16

def resolve(list)
  form = RDF::N3::Algebra::Formula.new(graph_name: RDF::Node.intern(list.hash)) 
  log_debug(NAME, "list hash") {form.graph_name}

  list.each do |f|
    form.operands.push(*f.operands)
  end
  form = form.dup
  log_info(NAME, "result") {SXP::Generator.string form.to_sxp_bin}
  form
end