Mark: DPLA harvests data in DC, MODS, MARCXML and site specific formats. This session is about that harvesting, mapping, and enhancement. What should an aggregation ingest stack look like?
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Hybag | |
class BagImportError < StandardError | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Hybag | |
class BagImportError < StandardError | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rdf' | |
require 'rdf/ntriples' | |
require 'bagit' | |
graph = RDF::Graph.load('braceros.nt') | |
graph.each_subject do |subject| | |
bag = BagIt::Bag.new(File.basename(subject)) | |
RDF::Writer.open("descMetadata.nt", :format => :ntriples) do |writer| | |
query = RDF::Query.new do |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<http://example.org/ns/1540> <http://purl.org/dc/terms/title> "The chop-house rag" . | |
<http://example.org/ns/1540> <http://id.loc.gov/vocabulary/relators/cmp> "Fowler, Edna May" . | |
<http://example.org/ns/1540> <http://purl.org/dc/terms/date> "1911" . | |
<http://example.org/ns/1540> <http://purl.org/dc/terms/description> "Back cover is an advertisement for the \"GEM dance folio for 1912\" printed in red ink." . | |
<http://example.org/ns/1540> <http://purl.org/dc/terms/description> "A small portrait of Artie Hall is in the lower right corner. In the center of the page is an illustration of a waiter and a cook dancing along with a dancing tomato, sausages, lobster, and oyster." . | |
<http://example.org/ns/1540> <http://www.loc.gov/standards/mods/modsrdf/v1/genre> "Sheet music" . | |
<http://example.org/ns/1540> <http://tom.oregonstate.edu/coverArtist> "Starmer" . | |
<http://example.org/ns/1540> <http://www.loc.gov/mads/rdf/v1#Collection> "University of Oregon Libraries - Music Services" . | |
<http://example.org/ns/1540> <http://pur |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# RdfResource is a subclass of RDF::Graph with property configuration, accessors, and some other methods | |
# for managing "resources" as discrete subgraphs which can be managed by a Hydra datastream model. | |
# | |
# The relevant modules and class are: | |
# | |
# https://github.com/OregonDigital/oregondigital/tree/master/lib/oregon_digital/rdf/rdf_configurable.rb | |
# https://github.com/OregonDigital/oregondigital/tree/master/lib/oregon_digital/rdf/rdf_properties.rb | |
# https://github.com/OregonDigital/oregondigital/tree/master/lib/oregon_digital/rdf/rdf_resource.rb | |
bnode = OregonDigital::RDF::RdfResource.new |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# The ruby-rdf vocabulary loader is used to maintain the vocabularies in the core library. | |
# There's a rake task that is the main way it is used and serves as a good reference. | |
# https://github.com/ruby-rdf/rdf/blob/develop/Rakefile | |
rake gen_vocabs | |
# Generate lib/rdf/vocab/cc.rb | |
# Generate lib/rdf/vocab/cert.rb | |
# Generate lib/rdf/vocab/dc.rb | |
# Generate lib/rdf/vocab/dc11.rb |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# RdfResource is a subclass of RDF::Graph with property configuration, accessors, and some other methods | |
# for managing "resources" as discrete subgraphs which can be managed by a Hydra datastream model. | |
bnode = ActiveFedora::Rdf::Resource.new | |
bnode.rdf_subject | |
# => #<RDF::Node:0x3f967a58c1b8(_:g69915530281400)> | |
bnode << RDF::Statement.new(bnode.rdf_subject, RDF::DC.title, RDF::Literal('A blank node')) | |
bnode << RDF::Statement.new(bnode.rdf_subject, RDF::DC.subject, RDF::Literal('RDF')) | |
bnode.dump :ntriples |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class SomethingDatastream < ActiveFedora::NtriplesRDFDatastream | |
property :contributor, predicate: RDF::URI('http://example.org/ns/contributor'), class_name: 'Contributor' | |
end | |
class Contributor < ActiveFedora::Rdf::Resource | |
configure type: RDF::URI('http://example.org/ns/Contributor') | |
property :name, predicate: RDF::FOAF.name | |
end | |
class Something < ActiveFedora::Base |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@chrpr: | |
* We need field-instance level provenance for properties in an RDF model. | |
* We want to manage access controls based on this. | |
* This would allow us to have, for example, a batch-loaded dcterms:subject that is not editable, and have it co-exist on the same record with a manually created & fully editable dcterms:subject. | |
* I feel there should be a way to do this with activetriples, but in reviewing the repo & the gist, I'm not sure what would be best. | |
* I was considering an OAC inspired design, but don't like how that spec handles structured data in an annotation body (they basically say to record a bunch of extra serialized RDF as if it's a literal as the object of the oac:body tag...) | |
* I know this is possible with PROV-O, but figuring out how is proving painful. | |
* I thought about named graphs a bit, and am concerned about the number of different combinations we'd need & the complexity of the underlying graphs. |