Class: Pho::Update::Changesets

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

Overview

The Changesets class provides utility methods for manipulating and generating collections of Changeset objects

Class Method Summary collapse

Class Method Details

.all_to_rdf(changesets) ⇒ Object

Convert an array of changesets into an RDF/XML document

changesets

an array of changesets



158
159
160
161
162
163
164
# File 'lib/pho/changeset.rb', line 158

def Changesets.all_to_rdf(changesets)
  rdf = "<rdf:RDF xmlns:cs=\"http://purl.org/vocab/changeset/schema#\" xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\">"
  changesets.each do |cs|
    rdf << cs.to_rdf(false)
  end
  rdf << "</rdf:RDF>"
end

.submit_all(changesets, store, versioned = false) ⇒ Object

Submit an array of changests to the Platform. After first converting them to an RDF/XML document.

Note that this submits all of the changessets in a single request to the Platform If the changeset is too large then it may be rejected. Similarly the Platform may respond with a 202 Accepted status if the data is to be processed asynchronously; again that depends on the size of the changes.

changesets

an array of changesets

store

the store to submit the changesets to

versioned

whether this is a versioned changed. Versioned Changesets must have

change_reason and creator_name properties.



178
179
180
181
# File 'lib/pho/changeset.rb', line 178

def Changesets.submit_all(changesets, store, versioned=false)
    rdf = all_to_rdf(changesets)
    store.submit_changeset(rdf, versioned)
end