Class: Lbp::ResourceIdentifier
- Inherits:
-
Object
- Object
- Lbp::ResourceIdentifier
- Defined in:
- lib/lbp/resource_identifier.rb
Overview
NOTE #rdf_uri can be a littel confusing, since it also works for RDF::Literal
Instance Attribute Summary collapse
-
#rdf_uri ⇒ Object
readonly
Returns the value of attribute rdf_uri.
-
#short_id ⇒ Object
readonly
Returns the value of attribute short_id.
-
#url ⇒ Object
readonly
Returns the value of attribute url.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(rdf_uri) ⇒ ResourceIdentifier
constructor
A new instance of ResourceIdentifier.
- #resource ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(rdf_uri) ⇒ ResourceIdentifier
Returns a new instance of ResourceIdentifier.
20 21 22 23 24 25 26 27 28 |
# File 'lib/lbp/resource_identifier.rb', line 20 def initialize(rdf_uri) @rdf_uri = rdf_uri @url = rdf_uri.to_s @short_id = if @url.include? "property/" @url.split("property/").last else @url.split("resource/").last end end |
Instance Attribute Details
#rdf_uri ⇒ Object (readonly)
Returns the value of attribute rdf_uri.
7 8 9 |
# File 'lib/lbp/resource_identifier.rb', line 7 def rdf_uri @rdf_uri end |
#short_id ⇒ Object (readonly)
Returns the value of attribute short_id.
7 8 9 |
# File 'lib/lbp/resource_identifier.rb', line 7 def short_id @short_id end |
#url ⇒ Object (readonly)
Returns the value of attribute url.
7 8 9 |
# File 'lib/lbp/resource_identifier.rb', line 7 def url @url end |
Class Method Details
.from_rdf_uri(rdf_uri) ⇒ Object
15 16 17 |
# File 'lib/lbp/resource_identifier.rb', line 15 def from_rdf_uri(rdf_uri) rdf_uri end |
.from_short(short) ⇒ Object
9 10 11 |
# File 'lib/lbp/resource_identifier.rb', line 9 def from_short(short) RDF::URI.new("http://scta.info/resource/#{short}") end |
.from_url(url) ⇒ Object
12 13 14 |
# File 'lib/lbp/resource_identifier.rb', line 12 def from_url(url) RDF::URI.new(url) end |