Class: Pho::Update::ChangesetHelper

Inherits:
Object
  • Object
show all
Defined in:
lib/pho/changeset.rb

Overview

Utility methods for making changes to graphs via Changesets

Class Method Summary collapse

Class Method Details

.update_literal(store, subject, predicate, old_value, new_value, old_lang = nil, old_datatype = nil, new_lang = nil, new_datatype = nil, creator_name = nil, change_reason = nil, versioned = false) ⇒ Object



328
329
330
331
332
333
334
335
336
# File 'lib/pho/changeset.rb', line 328

def ChangesetHelper.update_literal(store, subject, predicate, old_value, new_value, old_lang=nil, old_datatype=nil, 
    new_lang=nil, new_datatype=nil, creator_name=nil, change_reason=nil, versioned=false)
  cs = Changeset.new(subject, creator_name, change_reason)
  old = Statement.create_literal(subject, predicate, old_value, old_lang, old_datatype)
  new = Statement.create_literal(subject, predicate, new_value, new_lang, new_datatype)
  cs.add_removal(old)
  cs.add_addition(new)
  return cs.submit(store, versioned)
end