Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Current »

Here's a cookbook for getting Turtle-format (ttl) RDF data out of Ingestion 2, one file per record. This is useful for moving data to other systems; for example, Ingestion 3.

Assumptions:

  • You can use the Krikri Rails console, and have already used the necessary comands to find the Activity that represents the records that you want.
  • You can create a directory on the Heidrun application server's filesystem, likeĀ /var/tmp/rdf-files and make it owned by the Heidrun application's user.


# Here the example activity is 220, a mapping.
Krikri::Activity.find(220).entity_uris.take(1000).each { |u|
  agg = DPLA::MAP::Aggregation.new(u)
  agg.get
  id = agg.id.split('/').last
  # Assume /var/tmp/rdf-files has been created and is owned by dpla:dpla
  File.open("/var/tmp/rdf-files/#{id}.ttl", 'w') { |file|
    file.write(agg.to_ttl)
    file.close
  }
}


  • No labels