Class: JSON::LD::BlankNodeUniqer

Inherits:
BlankNodeMapper show all
Defined in:
vendor/bundler/ruby/3.3.0/bundler/gems/json-ld-f1de87658826/lib/json/ld/utils.rb

Instance Method Summary collapse

Methods inherited from BlankNodeMapper

#get_name

Methods inherited from Hash

#deep_dup, #optimize, #to_sxp

Instance Method Details

#get_sym(old = "") ⇒ String

Use the uniquely generated bnodes, rather than a sequence

Parameters:

  • old (String) (defaults to: "")

    ("")

Returns:



271
272
273
274
275
276
277
278
279
280
# File 'vendor/bundler/ruby/3.3.0/bundler/gems/json-ld-f1de87658826/lib/json/ld/utils.rb', line 271

def get_sym(old = "")
  old = old.to_s.sub(/_:/, '')
  if old && key?(old)
    self[old]
  elsif !old.empty?
    self[old] = RDF::Node.new.to_unique_base[2..]
  else
    RDF::Node.new.to_unique_base[2..]
  end
end