Class: RDF::N3::Algebra::Log::Conjunction
- Inherits:
-
RDF::N3::Algebra::ListOperator
- Object
- SPARQL::Algebra::Operator::Binary
- RDF::N3::Algebra::ListOperator
- RDF::N3::Algebra::Log::Conjunction
- 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
Instance Attribute Summary
Attributes included from Enumerable
Instance Method Summary collapse
-
#input_operand ⇒ RDF::Term
Return subject operand.
-
#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.
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_operand ⇒ RDF::Term
Return subject operand.
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.
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 |