class RDF::Normalize::RDFC10::IdentifierIssuer
Public Class Methods
new(prefix = "c14n")
click to toggle source
# File lib/rdf/normalize/rdfc10.rb, line 396 def initialize(prefix = "c14n") @prefix, @counter, @issued = prefix, 0, {} end
Public Instance Methods
dup()
click to toggle source
Duplicate this issuer, ensuring that the issued identifiers remain distinct @return [IdentifierIssuer]
Calls superclass method
# File lib/rdf/normalize/rdfc10.rb, line 426 def dup other = super other.instance_variable_set(:@issued, @issued.dup) other end
identifier(node)
click to toggle source
@return [RDF::Node] Canonical identifier assigned to node
# File lib/rdf/normalize/rdfc10.rb, line 415 def identifier(node) @issued[node] end
inspect()
click to toggle source
# File lib/rdf/normalize/rdfc10.rb, line 432 def inspect "{#{@issued.map {|k,v| "#{k.id}: #{v}"}.join(', ')}}" end
issue_identifier(node)
click to toggle source
Return an identifier for this BNode @param [RDF::Node] node @return [String] Canonical identifier for node
# File lib/rdf/normalize/rdfc10.rb, line 403 def issue_identifier(node) @issued[node] ||= begin res, @counter = @prefix + @counter.to_s, @counter + 1 res end end
issued()
click to toggle source
# File lib/rdf/normalize/rdfc10.rb, line 410 def issued @issued.keys end
to_hash()
click to toggle source
@return [Hash{Symbol => Symbol}] the issued identifiers map
# File lib/rdf/normalize/rdfc10.rb, line 420 def to_hash @issued.inject({}) {|memo, (node, canon)| memo.merge(node.id => canon)} end