Class: JSON::LD::BlankNodeUniqer

Inherits:
BlankNodeMapper show all
Defined in:
vendor/bundler/ruby/2.5.0/bundler/gems/json-ld-10f0d539c024/lib/json/ld/utils.rb

Instance Method Summary collapse

Methods inherited from BlankNodeMapper

#get_name

Methods inherited from Hash

#to_sxp, #to_sxp_bin

Instance Method Details

#get_sym(old = "") ⇒ String

Use the uniquely generated bnodes, rather than a sequence

Parameters:

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

    ("")

Returns:



252
253
254
255
256
257
258
259
260
261
# File 'vendor/bundler/ruby/2.5.0/bundler/gems/json-ld-10f0d539c024/lib/json/ld/utils.rb', line 252

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