Skip to content

Instantly share code, notes, and snippets.

View no-reply's full-sized avatar

tamsin woo no-reply

  • UC Santa Barbara Library
  • United States
View GitHub Profile
@no-reply
no-reply / searchFragment.md
Last active August 29, 2015 14:21
Search Fragments

Search Fragments (Linked Data Fragments)

Abstract

This document specifies an interface for selecting resources in Linked Data with search algorithms, autocomplete, and other string or entity matching approaches. Search Fragments are a Linked Data Fragments type that can be implemented using a variety of search algorithms and ranking heuristics. An individual Search Fragment contains the subject resources returned by a given search algorithm, a view of those resource's properties, together with metadata descriptions of the result set. Hypermedia controls are provided to describe other Search Fragments available on the dataset.

Status of this Document

This document is a working paper by one person somewhere in Oregon, US. It has no official standing of any kind and does not represent the support or consensus of any standards organisation. It is published nowhere by anyone, really. Least of all me.

[toc]

@no-reply
no-reply / srp.md
Last active August 29, 2015 14:21
Single Responsibility Principle

As an offshot of the discussion about design patterns in the Hydra community today (see this wiki page & this twitter thread), I reread Bob Martin's article on the Single Responsibility Principle.

Martin says:

Why was it important to separate these two responsibilities into separate classes? Because each responsibility is an axis of change. When the requirements change, that change will be manifest through a change in responsibility amongst the classes. If a class assumes more than one responsibility, then there will be more than one reason for it to change.

If a class has more than one responsibility, then the responsibilities become coupled. Changes to one responsibility may impair or inhibit the class’ ability to meet the others. This kind of coupling leads to fragile designs that break in unexpected ways when

@no-reply
no-reply / edtf.txt
Created April 28, 2015 16:44
EDTF EBNF
dateTimeString = level0Expression
| level1Expression
| level2Expression
(* ************************** Level 0 *************************** *)
level0Expression =
date
| dateAndTime
| L0Interval
@no-reply
no-reply / thoughts.md
Last active March 23, 2017 20:09
Records, Documents, & Graphs: Accounting for record scope & mutability in metadata management

Records, Documents, & Graphs

Accounting for record scope & mutability in metadata management.

Smoothies cannot be edited @anarchivist -- 6:52 PM PDT - 23 Apr 2015

Questions

The key question I'm setting out to answer is: How can we account for routine change and updates in our metadata records. An initial attempt to derive a model for change from current practice has led to some corollary questions about the relationship between Records, Documents, Description Sets, Application Profiles, Resources, and RDF Sourceslit review:

@no-reply
no-reply / 3_1_map.rb
Last active August 29, 2015 14:19
Mapping for Index
require '/home/tjohnson/src/dpla/heidrun-mappings/heidrun/uw_qdc'
uw_h = RDF::URI('http://example.org/uw_h')
opts = {uri:"http://cdm16786.contentdm.oclc.org/oai/oai.php",oai:{metadata_prefix:"oai_qdc",skip_set:["antartica","baist","bookarts","brumfield","burm","chernobyl","daily","dia","elchichon","epic","hawaiianvolcanoes","iraqi","landreau","libart","mhm","modbookarts","nap","p16786coll1","p16786coll3","p16786coll5","p16786coll6","pnwhm","psc","ptleader","pubbind","sp","test","uwdocs","uwib","uwired","ww-text"]}}
harvester = Krikri::Harvesters::OAIHarvester.new(opts)
harvester.records.take(100).each { |rec| harvester.process_record(rec, uw_h) }
rec_uris = Krikri::ProvenanceQueryClient.find_by_activity(uw_h).execute.map { |res| res.record }
recs = rec_uris.map { |uri| Krikri::OriginalRecord.load(uri) }
@no-reply
no-reply / uw_enrichment.rb
Last active August 29, 2015 14:19
UW Enrichment Profile
enrichment_profile = {
'Krikri::Enrichments::SplitAtDelimiter' => {
input_fields: [:rights,
{ dataProvider: :providedLabel },
{ sourceResource: :identifier },
{ sourceResource: :title },
{ sourceResource: :rights },
{ sourceResource: :extent },
{ sourceResource: :dcformat },
{ sourceResource: :genre },
$ bundle exec rake jetty:start
$ bundle exec rake spec # to run full suite w/out engine_cart/jetty refresh
$ bundle exec rspec # virtually the same as above
$ bundle exec rspec spec/lib/krikri/search_index_spec.rb # run only one file
$ bundle exec rspec spec/lib/krikri/search_index_spec.rb:35 # run only the test/example group for the block that includes line 35
$ bundle exec rspec spec/lib/krikri/search_index_spec.rb:35:49:103 #chain multiple line numbers to run multiple tests/example groups
@no-reply
no-reply / NR.json
Last active August 29, 2015 14:17
A typical Marmotta LDP-NR (created via PUT)
[ {
"@graph" : [ {
"@id" : "http://localhost:8983/marmotta/ldp/original_record",
"@type" : [ "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://purl.org/dc/terms/modified" : [ {
"@type" : "http://www.w3.org/2001/XMLSchema#dateTime",
"@value" : "2015-03-23T14:11:55.000-07:00"
} ],
"http://www.w3.org/ns/ldp#contains" : [ {
"@id" : "http://localhost:8983/marmotta/ldp/original_record/123.xml"
@no-reply
no-reply / esdn_harvest.rb
Last active August 29, 2015 14:13
Current ESDN harvests!
[1] pry(main)> require '../../esdn_mods'
=> true
[2] pry(main)> harvester = Krikri::Harvesters::OAIHarvester.new(:uri => 'http://repox.metro.org:8080/repox/OAIHandler', :oai => {:metadata_prefix => 'mods'})
=> #<Krikri::Harvesters::OAIHarvester:0x007fdca6282320
@client=
#<OAI::Client:0x007fdca62499a8
@base=#<URI::HTTP:0x007fdca62496d8 URL:http://repox.metro.org:8080/repox/OAIHandler>,
@debug=false,
@http_client=
#<Faraday::Connection:0x007fdca6249458
harvester = Krikri::Harvesters::OAIHarvester.new(:endpoint => 'http://vcoai.lib.harvard.edu/vcoai/vc')
# => #<Krikri::Harvesters::OAIHarvester:0x007ff8825e6c58 @opts={}...
harvester.records.first.save
# => true
rec = Krikri::OriginalRecord.load(harvester.record_ids.first)
# => #<Krikri::OriginalRecord:0x007ff881dd1c70 @local_name="oai:vc.harvard.edu:scores.008918909", @rdf_subject="http://localhost:8983/marmotta/ldp/original_record/oai:vc.harvard.edu:scores.008918909.bin"
rec2 = Krikri::OriginalRecord.load(harvester.record_ids.first)
# => #<Krikri::OriginalRecord:0x007ff87d928cb8 @local_name="oai:vc.harvard.edu:scores.008918909", @rdf_subject="http://localhost:8983/marmotta/ldp/original_record/oai:vc.harvard.edu:scores.008918909.bin"
# See the definition of equality for OriginalRecords at https://github.com/dpla/KriKri/blob/develop/app/models/krikri/original_record.rb#L50