Class: BEL::Nanopub::BufferingNanopubCombiner Abstract

Inherits:
Object
  • Object
show all
Defined in:
lib/bel/nanopub/buffering_nanopub_combiner.rb

Overview

This class is abstract.

Subclass and override #map_namespace_reference to implement

NanopubReferenceCombiner is responsible for disambiguating nanopubs with overlapping sets of annotation/namespace references. This can occur when documents use the same keyword to refer to more than one reference.

For example, nanopub A may be annotated with:

{
  :keyword => :Species,
  :type    => :uri,
  :domain  => 'file:///20131211/annotation/species-taxonomy-id.belanno'
}

while nanopub B may be annotated with:

{
  :keyword => :Species,
  :type    => :uri,
  :domain  => 'file:///20150611/annotation/species-taxonomy-id.belanno'
}

It is the job of this class to remap references to disambiguate the keywords.

mapping of namespaces.

Direct Known Subclasses

MapReferencesCombiner

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(nanopub_collection) ⇒ BufferingNanopubCombiner

Returns a new instance of BufferingNanopubCombiner.



35
36
37
# File 'lib/bel/nanopub/buffering_nanopub_combiner.rb', line 35

def initialize(nanopub_collection)
  @nanopub_collection = nanopub_collection
end

Instance Attribute Details

#annotation_referencesObject (readonly)

Returns the value of attribute annotation_references.



33
34
35
# File 'lib/bel/nanopub/buffering_nanopub_combiner.rb', line 33

def annotation_references
  @annotation_references
end

#namespace_referencesObject (readonly)

Returns the value of attribute namespace_references.



33
34
35
# File 'lib/bel/nanopub/buffering_nanopub_combiner.rb', line 33

def namespace_references
  @namespace_references
end

Instance Method Details

#eachObject



39
40
41
42
43
44
45
46
47
48
49
50
51
52
# File 'lib/bel/nanopub/buffering_nanopub_combiner.rb', line 39

def each
  if block_given?
    nanopub_array, map_references =
      combine_references(@nanopub_collection)
    @annotation_references = map_references.annotation_references
    @namespace_references  = map_references.namespace_references

    nanopub_array.each do |nanopub|
      yield rewrite_nanopub!(nanopub, map_references)
    end
  else
    to_enum(:each)
  end
end