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
get '/gacs/:id' do | |
headers['Cache-Control'] = 'public, max-age=43200' | |
area = GeographicArea.first(:code=>params[:id]) | |
halt 404, "Not found" unless area | |
if area.superceded_by | |
replacement = GeographicArea.get(area.superceded_by) | |
redirect "http://purl.org/NET/marccodes/gacs/#{replacement.code}" | |
end | |
@title = area.pref_label | |
@code = area.to_rdf_object |
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
<?xml version="1.0"?> | |
<?xml-stylesheet type="text/xsl" href="/viaf/xsl/searchRetrieveResponse_en.xsl"?> | |
<searchRetrieveResponse xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.loc.gov/zing/srw/" xsi:schemaLocation="http://www.loc.gov/zing/srw/ http://www.loc.gov/standards/sru/sru1-1archive/xml-files/srw-types.xsd"> | |
<version>1.1</version> | |
<numberOfRecords>4</numberOfRecords> | |
<resultSetId>52whe1</resultSetId> | |
<resultSetIdleTime>300</resultSetIdleTime> | |
<records xmlns:ns1="http://www.loc.gov/zing/srw/"> | |
<record> | |
<recordSchema>http://viaf.org/VIAFCluster</recordSchema> |
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
{ | |
'body': ['type', 'value'], | |
'first_sentence': ['type', 'value'], | |
'table_of_contents': ['type', 'class', 'title', 'value', 'label', 'pagenum'], | |
'description': ['type', 'value'], | |
'language': ['key'], | |
'created': ['type', 'value'], | |
'/type/edition': [ | |
'pagination', | |
'table_of_contents', |
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
use strict; | |
use JSON::XS; | |
use Data::Dumper; | |
my $file = '/Volumes/External 7/shared/open-library/edition-2009-09-11.txt'; | |
open(INFILE, $file) || die "Can't open '$file': $!"; | |
my $i = 0; | |
my %elements; | |
sub amerge($$) { |
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
require 'rubygems' | |
require 'json' | |
def inspect_file(file) | |
elements = {} | |
while line = file.gets | |
parts = line.split("\t") | |
elements[parts[1]] ||=[] | |
j = JSON.parse(parts.last) | |
j.keys.each do | key | | |
elements[parts[1]] << key unless elements[parts[1]].index(key) |
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
/b/OL1M /type/edition {"pagination": "8, 304 p.", "table_of_contents": [{"type": {"key": "/type/toc_item"}, "class": "section"}], "last_modified": {"type": "/type/datetime", "value": "2009-09-03T02:29:15.166712"}, "title": "Kabit\u0101.", "lccn": ["sa 64009056"], "notes": "Bibliographical footnotes.\r\nIn Oriya.", "number_of_pages": 304, "created": {"type": "/type/datetime", "value": "2008-04-01T03:28:50.625462"}, "languages": [{"key": "/l/ori"}], "lc_classifications": ["PK2579.R255 K3"], "latest_revision": 38, "key": "/b/OL1M", "authors": [{"key": "/a/OL1A"}], "publish_date": "1962", "oclc_numbers": ["31249133"], "type": {"key": | |
"/type/edition"}, "id": 96, "revision": 38} | |
/b/OL2M /type/edition {"pagination": "5, 193 p.", "key": "/b/OL2M", "title": "Bh\u0101sa n\u0101\u1e6dakacakra.", "lccn": ["sa 64009057"], "notes": {"type": "/type/text", "value": "Includes bibliographical references.\r\nIn Kannada."}, "number_of_pages": 193, "id": 98, "languages": [{"key": "/l/kan"}], "language_code": "193", "lc_clas |
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
python 2.5.1: | |
real 41m51.102s | |
user 39m39.701s | |
sys 1m4.934s | |
ruby 1.8.7 | |
real 72m4.442s | |
user 70m8.836s | |
sys 1m11.959s |
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
import simplejson as json | |
def inspectJSON(fh): | |
fields = {"/type/edition":[]} | |
for line in fh: | |
resourceId, resourceType, jsonData = line.split("\t") | |
resource = json.loads(jsonData) | |
for k in resource: | |
if not k in fields[resourceType]: |
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
{"collections"=>{"key"=>1}, | |
"body"=>{"value"=>1, "type"=>1}, | |
"/type/edition"=> | |
{"personal_name"=>1, | |
"key"=>23607186, | |
"languages"=>21103552, | |
"isbn_13"=>6624813, | |
"url"=>559861, | |
"displayname"=>1, | |
"purchase_url"=>244, |
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
{ | |
"type":"feed", | |
"request":"/connector/resources/160682/items/?format=dlfexpanded", | |
"time":"2010-04-05T13:34:00-04:00", | |
"offset":0, | |
"totalResults":6, |