Created
February 3, 2015 22:21
-
-
Save anarchivist/d8a9534f6ec4f1d12307 to your computer and use it in GitHub Desktop.
SCDL mapping
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
[1] pry(main)> harvester = Krikri::Harvesters::OAIHarvester.new(uri: 'http://test.scmemory-search.org/oai', oai: {metadata_prefix: 'qdc'}) | |
=> #<Krikri::Harvesters::OAIHarvester:0x007f9e9b103268 | |
@client= | |
#<OAI::Client:0x007f9e9b1132d0 | |
@base=#<URI::HTTP:0x007f9e9b112e20 URL:http://test.scmemory-search.org/oai>, | |
@debug=false, | |
@http_client= | |
#<Faraday::Connection:0x007f9e9b112ab0 | |
@builder= | |
#<Faraday::RackBuilder:0x007f9e9b1124c0 | |
@handlers=[FaradayMiddleware::FollowRedirects, Faraday::Adapter::NetHttp]>, | |
@default_parallel_manager=nil, | |
@headers={"User-Agent"=>"Faraday v0.9.1"}, | |
@options= | |
#<struct Faraday::RequestOptions | |
params_encoder=nil, | |
proxy=nil, | |
bind=nil, | |
timeout=nil, | |
open_timeout=nil, | |
boundary=nil, | |
oauth=nil>, | |
@parallel_manager=nil, | |
@params={}, | |
@proxy=nil, | |
@ssl= | |
#<struct Faraday::SSLOptions | |
verify=nil, | |
ca_file=nil, | |
ca_path=nil, | |
[2] pry(main)> r = harvester.records.first | |
=> #<Krikri::OriginalRecord:0x007f9e9977e180 | |
@content= | |
"<?xml version=\"1.0\"?>\n<record xmlns=\"http://www.openarchives.org/OAI/2.0/\">\n <header>\n <identifier>oai:scmemory-search.org/oai-contentdm2-clemson-edu-ctm-16</identifier>\n <datestamp>2014-08-28T18:18:01Z</datestamp>\n </header>\n <metadata>\n <qdc:qualifieddc xmlns:dc=\"http://purl.org/dc/elements/1.1/\" xmlns:dcterms=\"http://purl.org/dc/terms/\" xmlns:qdc=\"http://epubs.cclrc.ac.uk/xmlns/qdc/\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://purl.org/dc/terms/ http://dublincore.org/schemas/xmls/qdc/2006/01/06/dcterms.xsd http://purl.org/dc/elements/1.1/ http://dublincore.org/schemas/xmls/qdc/2006/01/06/dc.xsd\">\n <dc:title>Cotton mill doffer and spinners' guide</dc:title>\n <dc:creator>Clark, Lonnie James</dc:creator>\n <dc:creator>Campbell, R. Neal, 1922-2006</dc:creator>\n <dc:date>1909-04-13</dc:date>\n <dc:description>Cotton mill doffer and spinners' guide: for doffers and spinners; pamphlet issued to new cotton mill workers</dc:description>\n <dc:identifier>http://contentdm2.clemson.edu/cdm/ref/collection/ctm/id/16</dc:identifier>\n <dc:language>English</dc:language>\n <dc:source>Item is located in Clemson University Libraries Special Collections, Strom Thurmond Institute Building</dc:source>\n <dc:rights>Contact Special Collections for copyright information.</dc:rights>\n <dc:subject>Textile factories--Handbooks, manuals, etc.</dc:subject>\n <dc:type>Still Image</dc:type>\n <dc:publisher>Clemson University Libraries</dc:publisher>\n <dc:format>image/jpeg</dc:format>\n <dcterms:medium>Books</dcterms:medium>\n <dcterms:hasFormat>http://contentdm2.clemson.edu/utils/getthumbnail/collection/ctm/id/16</dcterms:hasFormat>\n <dcterms:isPartOf>Carolina Textile Mills Collection</dcterms:isPartOf>\n </qdc:qualifieddc>\n </metadata>\n</record>\n", | |
@content_type=nil, | |
@http_cache= | |
#<Faraday::Response:0x007f9e9bcf4ba8 | |
@env= | |
#<struct Faraday::Env | |
method=:get, | |
body= | |
"<?xml version=\"1.0\"?>\n<record xmlns=\"http://www.openarchives.org/OAI/2.0/\">\n <header>\n <identifier>oai:scmemory-search.org/oai-contentdm2-clemson-edu-ctm-16</identifier>\n <datestamp>2014-08-28T18:18:01Z</datestamp>\n </header>\n <metadata>\n <qdc:qualifieddc xmlns:dc=\"http://purl.org/dc/elements/1.1/\" xmlns:dcterms=\"http:/[3] pry(main)> r.save | |
=> #<Faraday::Response:0x007f9e9beae368 | |
@env= | |
#<struct Faraday::Env | |
method=:put, | |
body="", | |
url= | |
#<URI::HTTP:0x007f9e9be9f750 URL:http://localhost:8983/marmotta/ldp/original_record/df36a87527bb049c000fc591b216186e.xml>, | |
request= | |
#<struct Faraday::RequestOptions | |
params_encoder=nil, | |
proxy=nil, | |
bind=nil, | |
timeout=nil, | |
open_timeout=nil, | |
boundary=nil, | |
oauth=nil>, | |
request_headers={"Content-Type"=>"text/xml", "If-Match"=>"\"cdff22f11a5bb7d28cc477e5836a6932\""}, | |
ssl= | |
#<struct Faraday::SSLOptions | |
verify=nil, | |
ca_file=nil, | |
ca_path=nil, | |
verify_mode=nil, | |
cert_store=nil, | |
client_cert=nil, | |
client_key=nil, | |
certificate=nil, | |
private_key=nil, | |
[4] pry(main)> puts Krikri::Mapper.map(:scdl_qdc, Krikri::QdcParser.new(r, '//qdc:qualifieddc')).first.dump :ttl | |
<http://contentdm2.clemson.edu/cdm/ref/collection/ctm/id/16> a <http://www.europeana.eu/schemas/edm/WebResource> . | |
<http://contentdm2.clemson.edu/utils/getthumbnail/collection/ctm/id/16> a <http://www.europeana.eu/schemas/edm/WebResource>; | |
<http://purl.org/dc/elements/1.1/format> "image/jpeg" . | |
<http://dp.la/api/contributor/scdl> a <http://www.europeana.eu/schemas/edm/Agent>; | |
<http://www.w3.org/2004/02/skos/core#prefLabel> "South Carolina Digital Library" . | |
<http://localhost:8983/marmotta/ldp/original_record/df36a87527bb049c000fc591b216186e.xml> a <http://www.europeana.eu/schemas/edm/WebResource> . | |
[ | |
a <http://www.openarchives.org/ore/terms/Aggregation>; | |
<http://dp.la/about/map/originalRecord> <http://localhost:8983/marmotta/ldp/original_record/df36a87527bb049c000fc591b216186e.xml>; | |
<http://www.europeana.eu/schemas/edm/aggregatedCHO> [ | |
a <http://dp.la/about/map/SourceResource>; | |
<http://purl.org/dc/terms/title> "Cotton mill doffer and spinners' guide"; | |
<http://purl.org/dc/elements/1.1/format> "Books"; | |
<http://purl.org/dc/elements/1.1/relation> "Item is located in Clemson University Libraries Special Collections, Strom Thurmond Institute Building"; | |
<http://purl.org/dc/elements/1.1/rights> "Contact Special Collections for copyright information."; | |
<http://purl.org/dc/terms/creator> [ | |
a <http://www.europeana.eu/schemas/edm/Agent>; | |
<http://dp.la/about/map/providedLabel> "Clark, Lonnie James" | |
], [ | |
a <http://www.europeana.eu/schemas/edm/Agent>; | |
<http://dp.la/about/map/providedLabel> "Campbell, R. Neal, 1922-2006" | |
]; | |
<http://purl.org/dc/terms/description> "Cotton mill doffer and spinners' guide: for doffers and spinners; pamphlet issued to new cotton mill workers"; | |
<http://purl.org/dc/terms/isPartOf> [ | |
a <http://purl.org/dc/dcmitype/Collection>; | |
<http://purl.org/dc/terms/title> "Carolina Textile Mills Collection" | |
]; | |
<http://purl.org/dc/terms/language> [ | |
a <http://www.w3.org/2004/02/skos/core#Concept>; | |
<http://www.w3.org/2004/02/skos/core#prefLabel> "English" | |
]; | |
<http://purl.org/dc/terms/subject> [ | |
a <http://www.w3.org/2004/02/skos/core#Concept>; | |
<http://dp.la/about/map/providedLabel> "Textile factories--Handbooks, manuals, etc." | |
]; | |
<http://purl.org/dc/terms/type> "Still Image" | |
]; | |
<http://www.europeana.eu/schemas/edm/dataProvider> [ | |
a <http://www.europeana.eu/schemas/edm/Agent>; | |
<http://dp.la/about/map/providedLabel> "Clemson University Libraries" | |
]; | |
<http://www.europeana.eu/schemas/edm/isShownAt> <http://contentdm2.clemson.edu/cdm/ref/collection/ctm/id/16>; | |
<http://www.europeana.eu/schemas/edm/preview> <http://contentdm2.clemson.edu/utils/getthumbnail/collection/ctm/id/16>; | |
<http://www.europeana.eu/schemas/edm/provider> <http://dp.la/api/contributor/scdl> | |
] . | |
=> nil | |
[5] pry(main)> |
@markbreedlove : Are you running this from a pry
session? (IIRC, I was running this through rails c
.)
This may just be out of date, now.
Yes, running bundle exec rails c
which invokes pry
automatically.
Update:
With my development VMs, after a deployment from git of the develop
branch of heidrun and the master
branch of heidrun-mappings:
dpla@dev2:/opt/heidrun$ export RAILS_ENV=development
dpla@dev2:/opt/heidrun$ bundle exec spring stop
Spring stopped.
dpla@dev2:/opt/heidrun$ bundle exec rails c
Loading development environment (Rails 4.1.9)
[1] pry(main)> harvester = Krikri::Harvesters::OAIHarvester.new(uri: 'http://test.scmemory-search.org/oai', oai: {metadata_prefix: 'qdc'})
[ ... ]
pry(main)> r = harvester.records.first
=> #<Krikri::OriginalRecord:0x007f7c6720af90
[ ... ]
[3] pry(main)> puts Krikri::Mapper.map(:scdl_qdc, r).first.dump :ttl
Error processing mapping.
content:
<?xml version="1.0"?>
[ ... ]
Tried to access subject URI for <?xml version="1.0"?>
<record xmlns="http://www.openarchives.org/OAI/2.0/">
[ ... ]
, but it is not saved.
/home/dpla/.rbenv/versions/2.1.3/lib/ruby/gems/2.1.0/gems/krikri-0.2.0/lib/krikri/mapping_dsl/parser_methods.rb:38:in `block in record_uri'
/home/dpla/.rbenv/versions/2.1.3/lib/ruby/gems/2.1.0/gems/krikri-0.2.0/lib/krikri/mapping_dsl/rdf_subjects.rb:15:in `call'
/home/dpla/.rbenv/versions/2.1.3/lib/ruby/gems/2.1.0/gems/krikri-0.2.0/lib/krikri/mapping_dsl/rdf_subjects.rb:15:in `block in to_proc'
/home/dpla/.rbenv/versions/2.1.3/lib/ruby/gems/2.1.0/gems/krikri-0.2.0/lib/krikri/mapping.rb:35:in `call'
[ ... ]
NoMethodError: undefined method `dump' for nil:NilClass
Note that the mappings are loading now:
[7] pry(main)> puts Krikri::Mapper::Registry.keys
heidrun_sample
scdl_qdc
=> nil
This just needs the following corrections:
- After the assignment of
r
, dor.save
- The
puts
statement can also work asputs Krikri::Mapper.map(:scdl_qdc, r).first.dump :ttl
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I'm getting the following error at the
puts
step:I'll investigate this tomorrow. I'm using the
automation
deployment of the Heidrundevelop
branch (from GitHub, not local). That's including KriKri 0.1.3Is there a step missing above?