Class: RDF::Normalize::URDNA2015::IdentifierIssuer

Inherits:
Object
  • Object
show all
Defined in:
vendor/bundler/ruby/2.5.0/bundler/gems/rdf-normalize-954d9c6738f1/lib/rdf/normalize/urdna2015.rb

Instance Method Summary collapse

Constructor Details

#initialize(prefix = "_:c14n") ⇒ IdentifierIssuer

Returns a new instance of IdentifierIssuer



234
235
236
# File 'vendor/bundler/ruby/2.5.0/bundler/gems/rdf-normalize-954d9c6738f1/lib/rdf/normalize/urdna2015.rb', line 234

def initialize(prefix = "_:c14n")
  @prefix, @counter, @issued = prefix, 0, {}
end

Instance Method Details

#dupIdentifierIssuer

Duplicate this issuer, ensuring that the issued identifiers remain distinct

Returns:



256
257
258
259
260
# File 'vendor/bundler/ruby/2.5.0/bundler/gems/rdf-normalize-954d9c6738f1/lib/rdf/normalize/urdna2015.rb', line 256

def dup
  other = super
  other.instance_variable_set(:@issued, @issued.dup)
  other
end

#identifier(node) ⇒ Object



250
251
252
# File 'vendor/bundler/ruby/2.5.0/bundler/gems/rdf-normalize-954d9c6738f1/lib/rdf/normalize/urdna2015.rb', line 250

def identifier(node)
  @issued[node]
end

#issue_identifier(node) ⇒ Object

Return an identifier for this BNode



239
240
241
242
243
244
# File 'vendor/bundler/ruby/2.5.0/bundler/gems/rdf-normalize-954d9c6738f1/lib/rdf/normalize/urdna2015.rb', line 239

def issue_identifier(node)
  @issued[node] ||= begin
    res, @counter = @prefix + @counter.to_s, @counter + 1
    res
  end
end

#issuedObject



246
247
248
# File 'vendor/bundler/ruby/2.5.0/bundler/gems/rdf-normalize-954d9c6738f1/lib/rdf/normalize/urdna2015.rb', line 246

def issued
  @issued.keys
end