Skip to content

Instantly share code, notes, and snippets.

View anarchivist's full-sized avatar
🫏

maría a. matienzo anarchivist

🫏
View GitHub Profile
@anarchivist
anarchivist / gist:a305c02f7485ea63c409
Created August 3, 2015 22:21
Testing language enrichment
irb(main):259:0> lang = DPLA::MAP::Controlled::Language.new
=> #<DPLA::MAP::Controlled::Language:0x3fc041867220(default)>
irb(main):260:0> lang.providedLabel = 'eng'
=> "eng"
irb(main):262:0> puts iso.enrich_value(lang).first.dump :ttl
<http://lexvo.org/id/iso639-3/eng> a <http://www.w3.org/2004/02/skos/core#Concept> .
[
a <http://www.w3.org/2004/02/skos/core#Concept>;
@anarchivist
anarchivist / dpla_map_weirdness.rb
Created August 3, 2015 21:49
DPLA::MAP weirdness
irb(main):299:0> sr = DPLA::MAP::SourceResource.new
=> #<DPLA::MAP::SourceResource:0x3fc04197f6d0(default)>
irb(main):300:0> sr.title = "A title"
=> "A title"
irb(main):301:0> type_value = DPLA::MAP::Controlled::DCMIType.new
=> #<DPLA::MAP::Controlled::DCMIType:0x3fc04194fdf4(default)>
irb(main):302:0> type_value.providedLabel = "image"
=> "image"
irb(main):303:0> sr.dctype = type_value
=> #<DPLA::MAP::Controlled::DCMIType:0x3fc04194fdf4(default)>
@anarchivist
anarchivist / out.rb
Created August 3, 2015 21:11
Odd behavior with ActiveTriples/Krikri/DPLA::MAP
irb(main):602:0> m = Krikri::Mapper.map(:esdn_mods, o)
=> [#<DPLA::MAP::Aggregation:0x3f86240cf2e4(default)>]
irb(main):603:0> # :esdn_mods mapping sets language property for prefLabel, which i think is wrong
irb(main):604:0* puts m.first.dump :ttl
<http://cdm16694.contentdm.oclc.org/cdm/ref/collection/p16694coll20/id/945> a <http://www.europeana.eu/schemas/edm/WebResource> .
<http://cdm16694.contentdm.oclc.org/utils/getthumbnail/collection/p16694coll20/id/945> a <http://www.europeana.eu/schemas/edm/WebResource> .
<http://dp.la/api/contributor/esdn> a <http://www.europeana.eu/schemas/edm/Agent>;
@anarchivist
anarchivist / http-behavior.md
Last active June 19, 2016 17:21
http-behavior.md
@anarchivist
anarchivist / gist:cebde05e59661a4b8fc0
Created June 22, 2015 22:24
RSpec failures for Lexvo enrichment under rspec 3.3
3) Krikri::Enrichments::LanguageToLexvo with node with multiple providedLabels when labels point to same resource match keeps both provided labels
Failure/Error: expect(subject.enrich_value(lang))
expected collection contained: [(have provided label "eng"), (have provided label "english")]
actual collection contained: [#<DPLA::MAP::Controlled::Language:0x3fe8250110ec(default)>, #<DPLA::MAP::Controlled::Language:0x3fe825008a3c(default)>]
the missing elements were: [(have provided label "eng"), (have provided label "english")]
the extra elements were: [#<DPLA::MAP::Controlled::Language:0x3fe8250110ec(default)>, #<DPLA::MAP::Controlled::Language:0x3fe825008a3c(default)>]
# ./spec/lib/krikri/enrichments/language_to_lexvo_spec.rb:108:in `block (5 levels) in <top (required)>'
4) Krikri::Enrichments::LanguageToLexvo with node with multiple providedLabels when labels point to different resources keeps both matches
Failure/Error: expect(subject.enrich_val
@anarchivist
anarchivist / config.ttl
Created June 18, 2015 17:05
Sample Pubby configuration for RightsStatements.org
@prefix conf: <http://richard.cyganiak.de/2007/pubby/config.rdf#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix skos: <http://www.w3.org/2004/02/skos/core#> .
@prefix cc: <http://creativecommons.org/ns#> .
@prefix dc: <http://purl.org/dc/elements/1.1/> .
@prefix dcmitype: <http://purl.org/dc/dcmitype/> .
@prefix dcterms: <http://purl.org/dc/terms/> .
@prefix edm: <http://www.europeana.eu/schemas/edm/> .
@prefix odrl: <http://www.w3c.org/community/odrl/two/vocab/2.1/> .
@prefix premiscopy: <http://id.loc.gov/vocabulary/preservation/copyrightStatus/> .
<http://localhost:8983/marmotta/ldp/items/936a470c44b18fd78a514919b9bda7c7> a <http://www.w3.org/ns/ldp#Resource>,
<http://www.w3.org/ns/ldp#RDFSource>,
<http://www.w3.org/ns/ldp#Container>,
<http://www.w3.org/ns/ldp#BasicContainer>,
<http://www.openarchives.org/ore/terms/Aggregation>;
<http://dp.la/about/map/originalRecord> <http://localhost:8983/marmotta/ldp/original_record/936a470c44b18fd78a514919b9bda7c7.xml>;
<http://purl.org/dc/terms/created> "2015-05-26T15:51:27.000-04:00"^^<http://www.w3.org/2001/XMLSchema#dateTime>;
<http://purl.org/dc/terms/modified> "2015-05-26T15:51:27.000-04:00"^^<http://www.w3.org/2001/XMLSchema#dateTime>;
<http://www.europeana.eu/schemas/edm/aggregatedCHO> <http://localhost:8983/marmotta/ldp/items/936a470c44b18fd78a514919b9bda7c7#sourceResource>;
<http://www.europeana.eu/schemas/edm/dataProvider> [
ActionView::Template::Error (No route matches {:action=>"facet", :controller=>"krikri/records", :id=>"sourceResource_subject_providedLabel", :view=>nil}):
4:
5: <% unless paginator.last_page? || params[:action] == "facet" %>
6: <li class="more_facets_link"><%= link_to t('blacklight.search.facets.more'),
7: search_facet_url(id: solr_field), class: "more_facets_link" %></li>
8: <% end %>
9: </ul>
actionpack (4.1.10) lib/action_dispatch/journey/formatter.rb:39:in `generate'
actionpack (4.1.10) lib/action_dispatch/routing/route_set.rb:613:in `generate'
actionpack (4.1.10) lib/action_dispatch/routing/route_set.rb:643:in `generate'
<http://dp.la/api/contributor/esdn> a <http://www.europeana.eu/schemas/edm/Agent>;
<http://www.w3.org/2004/02/skos/core#prefLabel> "Empire State Digital Network" .
=> nil
[89] pry(main)> puts r.dump :ttl
<http://localhost:8983/marmotta/ldp/items/71d3101edfcb6a9062536e3a1b98fd75> a <http://www.w3.org/ns/ldp#Resource>,
<http://www.w3.org/ns/ldp#RDFSource>,
<http://www.w3.org/ns/ldp#Container>,
<http://www.w3.org/ns/ldp#BasicContainer>,
<http://www.openarchives.org/ore/terms/Aggregation>;
@anarchivist
anarchivist / gist:6ef9086caefbe05e9a83
Created April 16, 2015 03:20
Turtle for previous gist
<http://localhost:8983/marmotta/ldp/items/5fb4aa1a225b0a4e9ac76fd8c0b1dc20> a <http://www.w3.org/ns/ldp#Resource>,
<http://www.w3.org/ns/ldp#RDFSource>,
<http://www.w3.org/ns/ldp#Container>,
<http://www.w3.org/ns/ldp#BasicContainer>,
<http://www.openarchives.org/ore/terms/Aggregation>;
<http://dp.la/about/map/originalRecord> <http://localhost:8983/marmotta/ldp/original_record/5fb4aa1a225b0a4e9ac76fd8c0b1dc20.xml>;
<http://purl.org/dc/terms/created> "2015-04-15T22:44:50.000-04:00"^^<http://www.w3.org/2001/XMLSchema#dateTime>;
<http://purl.org/dc/terms/modified> "2015-04-15T22:44:50.000-04:00"^^<http://www.w3.org/2001/XMLSchema#dateTime>;
<http://www.europeana.eu/schemas/edm/aggregatedCHO> <http://localhost:8983/marmotta/ldp/items/5fb4aa1a225b0a4e9ac76fd8c0b1dc20#sourceResource>;
<http://www.europeana.eu/schemas/edm/dataProvider> <http://dp.la/api/contributor/washington>;