Class: BEL::Resource::Annotations
- Inherits:
-
Object
- Object
- BEL::Resource::Annotations
- Defined in:
- lib/bel/resource/annotations.rb
Overview
Annotations allows access to all AnnotationConceptScheme RDF Resources available in the resources dataset.
Constant Summary collapse
- BELV =
RDF::Vocabulary.new('http://www.openbel.org/vocabulary/')
- SKOS =
RDF::Vocab::SKOS
Instance Method Summary collapse
- #each ⇒ Object
- #find(*annotations) ⇒ Object
-
#initialize(rdf_repository) ⇒ Annotations
constructor
A new instance of Annotations.
Constructor Details
#initialize(rdf_repository) ⇒ Annotations
Returns a new instance of Annotations.
14 15 16 |
# File 'lib/bel/resource/annotations.rb', line 14 def initialize(rdf_repository) @rdf_repository = rdf_repository end |
Instance Method Details
#each ⇒ Object
18 19 20 21 22 23 24 25 26 27 |
# File 'lib/bel/resource/annotations.rb', line 18 def each return to_enum(:each) unless block_given? @rdf_repository. query( :predicate => RDF.type, :object => BELV.AnnotationConceptScheme) { |solution| yield Annotation.new(@rdf_repository, solution.subject) } end |
#find(*annotations) ⇒ Object
29 30 31 32 33 34 35 |
# File 'lib/bel/resource/annotations.rb', line 29 def find(*annotations) return to_enum(:find, *annotations) unless block_given? annotations.flatten.each do |an| yield find_annotation(an) end end |