Class: BNode
- Inherits:
-
Object
- Object
- BNode
- Defined in:
- lib/rena/bnode.rb
Instance Attribute Summary collapse
-
#identifier ⇒ Object
Returns the value of attribute identifier.
Instance Method Summary collapse
- #eql?(eql) ⇒ Boolean
-
#initialize(identifier = nil) ⇒ BNode
constructor
A new instance of BNode.
-
#to_n3 ⇒ String
Exports the BNode in N-Triples form.
-
#to_ntriples ⇒ String
Exports the BNode in N-Triples form.
- #to_s ⇒ Object
Constructor Details
#initialize(identifier = nil) ⇒ BNode
Returns a new instance of BNode.
3 4 5 6 7 8 9 |
# File 'lib/rena/bnode.rb', line 3 def initialize(identifier = nil) if identifier != nil && self.valid_id?(identifier) != false @identifier = identifier else @identifier = "bn" + self.hash.to_s end end |
Instance Attribute Details
#identifier ⇒ Object
Returns the value of attribute identifier.
2 3 4 |
# File 'lib/rena/bnode.rb', line 2 def identifier @identifier end |
Instance Method Details
#eql?(eql) ⇒ Boolean
11 12 13 14 15 16 17 |
# File 'lib/rena/bnode.rb', line 11 def eql? (eql) if self.identifier == eql.identifier true else false end end |
#to_n3 ⇒ String
30 31 32 |
# File 'lib/rena/bnode.rb', line 30 def to_n3 "_:" + @identifier end |
#to_ntriples ⇒ String
46 47 48 |
# File 'lib/rena/bnode.rb', line 46 def to_ntriples self.to_n3 end |
#to_s ⇒ Object
50 51 52 |
# File 'lib/rena/bnode.rb', line 50 def to_s @identifier end |