Class: BEL::Resource::Annotation
- Inherits:
-
Object
- Object
- BEL::Resource::Annotation
show all
- Includes:
- ConceptScheme
- Defined in:
- lib/bel/resource/annotation.rb
Overview
Annotation represents a AnnotationConceptScheme RDF Resource and associated properties.
Constant Summary
collapse
- DC =
RDF::Vocab::DC
- SKOS =
RDF::Vocab::SKOS
- BELV =
RDF::Vocabulary.new('http://www.openbel.org/vocabulary/')
Instance Attribute Summary collapse
Instance Method Summary
collapse
#domain, #pref_label, #prefix, #type
Constructor Details
#initialize(rdf_repository, uri) ⇒ Annotation
19
20
21
22
23
24
25
26
27
|
# File 'lib/bel/resource/annotation.rb', line 19
def initialize(rdf_repository, uri)
@rdf_repository = rdf_repository
@uri = RDF::URI(uri.to_s)
@uri_hash = @uri.hash
@concept_query = [
:predicate => SKOS.inScheme,
:object => @uri
]
end
|
Instance Attribute Details
#uri ⇒ Object
Returns the value of attribute uri.
17
18
19
|
# File 'lib/bel/resource/annotation.rb', line 17
def uri
@uri
end
|
Instance Method Details
#==(other) ⇒ Object
Also known as:
eql?
49
50
51
52
|
# File 'lib/bel/resource/annotation.rb', line 49
def ==(other)
return false if other == nil
@uri == other.uri
end
|
#each ⇒ Object
29
30
31
32
33
34
35
|
# File 'lib/bel/resource/annotation.rb', line 29
def each
return to_enum(:each) unless block_given?
@rdf_repository.
query(@concept_query) { |solution|
yield AnnotationValue.new(@rdf_repository, solution.subject)
}
end
|
#find(*values) ⇒ Object
37
38
39
40
41
42
43
|
# File 'lib/bel/resource/annotation.rb', line 37
def find(*values)
return to_enum(:find, *values) unless block_given?
values.flatten.each do |v|
yield find_value(v)
end
end
|
#hash ⇒ Object
45
46
47
|
# File 'lib/bel/resource/annotation.rb', line 45
def hash
@uri_hash
end
|