Class: OpenBEL::Model::RdfResource

Inherits:
Object
  • Object
show all
Includes:
OpenBEL::Model
Defined in:
lib/openbel/api/model/rdf_resource.rb

Constant Summary

Constants included from OpenBEL::Model

VOCABULARY_RDF

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from OpenBEL::Model

included

Constructor Details

#initialize(attr_values = {}) ⇒ RdfResource

Returns a new instance of RdfResource.



44
45
46
47
48
# File 'lib/openbel/api/model/rdf_resource.rb', line 44

def initialize(attr_values = {})
  attr_values.each { |k, v|
    instance_variable_set(:"@#{k}", v)
  }
end

Instance Attribute Details

#uriObject

Returns the value of attribute uri.



50
51
52
# File 'lib/openbel/api/model/rdf_resource.rb', line 50

def uri
  @uri
end

Instance Method Details

#==(other) ⇒ Object



52
53
54
55
# File 'lib/openbel/api/model/rdf_resource.rb', line 52

def ==(other)
  return false if other == nil
  @uri == other.uri
end

#hashObject



57
58
59
# File 'lib/openbel/api/model/rdf_resource.rb', line 57

def hash
  @uri.hash
end

#to_hashObject



61
62
63
64
65
# File 'lib/openbel/api/model/rdf_resource.rb', line 61

def to_hash
  instance_variables.inject({}) { |res, attr|
    res.merge({attr[1..-1] => instance_variable_get(attr)})
  }
end

#to_sObject



67
68
69
# File 'lib/openbel/api/model/rdf_resource.rb', line 67

def to_s
  @uri
end