Class: JSON::LD::BlankNodeUniqer

Inherits:
BlankNodeMapper show all
Defined in:
lib/json/ld/utils.rb

Instance Method Summary collapse

Methods inherited from BlankNodeMapper

#get_name

Instance Method Details

#get_sym(old = "") ⇒ String

Use the uniquely generated bnodes, rather than a sequence

Parameters:

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

    (“”)

Returns:

  • (String)


266
267
268
269
270
271
272
273
274
275
# File 'lib/json/ld/utils.rb', line 266

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