class ConceptQL::Operators::Provenance

Filters the incoming stream of events to only those that have a provenance-related concept_id.

Provenance related concepts are the ones found in the xxx_type_concept_id field.

If the event has NULL for the provenance-related field, they are filtered out.

Multiple provenances can be specified at once

Public Instance Methods

query(db) click to toggle source
# File lib/conceptql/operators/provenance.rb, line 36
def query(db)
  db.from(stream.evaluate(db))
    .where(provenance_type: provenance_concept_ids)
end

Private Instance Methods

all_args() click to toggle source
# File lib/conceptql/operators/provenance.rb, line 59
def all_args
  arguments.map(&:to_s).flat_map { |w| w.split(/\s*,\s*/) }.uniq
end
provenance_concept_ids() click to toggle source
# File lib/conceptql/operators/provenance.rb, line 53
def provenance_concept_ids
  all_args.flat_map do |arg|
    to_concept_id(arg)
  end
end
validate(db, opts = {}) click to toggle source
Calls superclass method ConceptQL::Operators::Operator#validate
# File lib/conceptql/operators/provenance.rb, line 43
def validate(db, opts = {})
  super
  bad_keywords = all_args.select { |arg| arg.to_i.zero? }
                  .reject { |arg| concept_ids.keys.include?(arg.to_sym) }

  if bad_keywords.present?
    add_error("unrecognized keywords", *bad_keywords)
  end
end