Skip to content

Instantly share code, notes, and snippets.

View mcritchlow's full-sized avatar

Matthew Critchlow mcritchlow

  • UC San Diego
  • San Diego
View GitHub Profile
@mcritchlow
mcritchlow / embargo_examples.xml
Last active August 29, 2015 14:07
Embargo Examples created by @escowles for DAMS4 Data Model v1
<!-- Currently under embargo -->
<dams:Object rdf:about="http://library.ucsd.edu/ark:/20775/xx00000012">
<dams:title>
<mads:Title>
<mads:authoritativeLabel>#12: Curator: Third Party Copyright, License Override (Embargoed)</mads:authoritativeLabel>
<mads:elementList rdf:parseType="Collection">
<mads:MainTitleElement>
<mads:elementValue>#12: Curator: Third Party Copyright, License Override (Embargoed)</mads:elementValue>
</mads:MainTitleElement>
</mads:elementList>
@mcritchlow
mcritchlow / facet_test.rb
Last active August 29, 2015 14:06
Facet Checked
class Facet
def checked_one_liner?(field,value,params)
params['f'] && params['f'][field] && params['f'][field].include?(value)
end
def checked?(field,value,params)
params.has_key?('f') && params['f'].has_key?(field) && params['f'][field].include?(value)
end
end
@mcritchlow
mcritchlow / Gemfile
Last active August 29, 2015 13:57 — forked from escowles/Gemfile
source 'https://rubygems.org'
gem 'active-fedora', github: 'projecthydra/active_fedora', branch: 'master'
gem 'linkeddata'
@mcritchlow
mcritchlow / authority_lookup_sample.rb
Last active December 26, 2015 21:39
This is a sample script for doing linked data lookup starting with string input. The code pings the Library Of Congress /authorities/suggest OpenSearch service. If it finds an exact match, it will query the RDF graph looking for particular Predicates/Values. Further reasoning would be possible here as well. If it doesn't find a match, it will re…
require 'net/http'
require 'json'
require 'linkeddata'
# API reference http://ruby-rdf.github.io/rdf/
#returned results from lookup
result = Hash.new
#define MADS vocabulary for RDF.ruby