Skip to content

Instantly share code, notes, and snippets.

@rsinger
rsinger / gist:152182
Created July 22, 2009 18:33
DC Holdings
<ov:HoldingStatement about="http://catalog.lib.jhu.edu/item/1234">
<dct:LCC>BF 1 .P976</dct:LCC>
<dct:coverage>v.1-8 (1974/1975)</dct:coverage>
<dct:spatial>
<dct:Location about="http://catalog.lib.jhu.edu/location/LSC">
<dct:title>Libraries Service Center</dct:title>
</dct:Location>
</dct:spatial>
<frbr:exemplarOf resource="http://catalog.lib.jhu.edu/bib/1234" />
<dct:hasPart>
@rsinger
rsinger / gist:167187
Created August 13, 2009 13:55
MARCModeler
$KCODE = 'u'
require 'rubygems'
#require 'marc'
require 'jcode'
require 'enhanced_marc'
require 'rdf_resource'
require 'lcsh_labels'
reader = MARC::Reader.new('cca.utf8.mrc')
i = 0
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix n1: <http://RDVocab.info/Elements/> .
@prefix n2: <http://purl.org/dc/terms/> .
@prefix n3: <http://purl.org/ontology/bibo/> .
@prefix n4: <http://purl.org/dc/elements/1.1/> .
@prefix n5: <http://RDVocab.info/roles/> .
<http://library.cca.edu/core/m/70887603>
n1:parallelTitleProper "Two sculptors" ;
n1:statementOfResponsibility "directed by Chris Felver" ;
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
SELECT ?sub
WHERE {
{ ?sub skos:altLabel "Kalimanten Island"@en
}}
require 'rubygems'
require 'rdf_objects'
require 'rsolr'
require 'open-uri'
# "apache-solr" should be a path to a solr build.
Dir['apache-solr/dist/*.jar'].each{|jar|require jar}
Dir['apache-solr/lib/*.jar'].each{|jar|require jar}
opts = {:home_dir=>'/path/to/solr/home'}
@rsinger
rsinger / marcsolrchecker.rb
Created January 7, 2010 02:38
Ruby script to check which MARC records are missing from a Solr index.
require 'rubygems'
# Be sure to have the latest version of rubygems and run:
# sudo gem install rsolr
# sudo gem install marc
require 'rsolr'
require 'marc'
# Set the following three vars to whatever applies locally.
// Lines 67-89
if($avail->location) {
$location = "";
$callnumber = "";
list($msg1, $msg2) = split("; ", (string)$avail->location);
if($msg1) {
list($label,$msg) = split(": ", $msg1);
if($label == "Location") {
$location = $msg;
} else {
<dlf:item id="http:/example.org/j/service/items/1234">
<jangle:fines xmlns:jangle="http://jangle.org/vocabulary/">
<jangle:loans currency="GBP">0.72</jangle:loans>
<jangle:holds currency="GBP">0.00</jangle:holds>
<jangle:interloans currency="GBP">0.00</jangle:interloans>
<jangle:miscellaneous currency="GBP">0.00</jangle:miscellaneous>
</jangle:fines>
</dlf:item>
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix mo: <http://purl.org/ontology/mo/> .
@prefix skos: <http://www.w3.org/2004/02/skos/core#> .
@prefix foaf: <http://xmlns.com/foaf/0.1/> .
@prefix bibo: <http://purl.org/ontology/bibo/> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix rda: <http://RDVocab.info/Elements/> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix dcterms: <http://purl.org/dc/terms/> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix n0: <http://dbtune.org/musicbrainz/resource/vocab/> .
@prefix mo: <http://purl.org/ontology/mo/> .
@prefix skos: <http://www.w3.org/2004/02/skos/core#> .
@prefix foaf: <http://xmlns.com/foaf/0.1/> .
@prefix bibo: <http://purl.org/ontology/bibo/> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix rda: <http://RDVocab.info/Elements/> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix dcterms: <http://purl.org/dc/terms/> .