Class: BEL::Nanopub::BufferingNanopubCombiner Abstract
- Inherits:
-
Object
- Object
- BEL::Nanopub::BufferingNanopubCombiner
- Defined in:
- lib/bel/nanopub/buffering_nanopub_combiner.rb
Overview
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
Instance Attribute Summary collapse
-
#annotation_references ⇒ Object
readonly
Returns the value of attribute annotation_references.
-
#namespace_references ⇒ Object
readonly
Returns the value of attribute namespace_references.
Instance Method Summary collapse
- #each ⇒ Object
-
#initialize(nanopub_collection) ⇒ BufferingNanopubCombiner
constructor
A new instance of BufferingNanopubCombiner.
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_references ⇒ Object (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_references ⇒ Object (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
#each ⇒ Object
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 |