Class: BEL::Resource::Namespaces
- Inherits:
-
Object
- Object
- BEL::Resource::Namespaces
- Defined in:
- lib/bel/resource/namespaces.rb
Overview
Namespaces allows access to all NamespaceConceptScheme 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(*namespaces) ⇒ Object
-
#initialize(rdf_repository) ⇒ Namespaces
constructor
A new instance of Namespaces.
Constructor Details
#initialize(rdf_repository) ⇒ Namespaces
Returns a new instance of Namespaces.
14 15 16 |
# File 'lib/bel/resource/namespaces.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/namespaces.rb', line 18 def each return to_enum(:each) unless block_given? @rdf_repository. query( :predicate => RDF.type, :object => BELV.NamespaceConceptScheme) { |solution| yield Namespace.new(@rdf_repository, solution.subject) } end |
#find(*namespaces) ⇒ Object
29 30 31 32 33 34 35 |
# File 'lib/bel/resource/namespaces.rb', line 29 def find(*namespaces) return to_enum(:find, *namespaces) unless block_given? namespaces.flatten.each do |ns| yield find_namespace(ns) end end |