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
def start_threading(triplers) | |
#puts "Start threading" | |
triplers.threach(triplers.length) do |tripler| | |
#triplers.each do |tripler| | |
parse_lines_or_warm_threads(tripler) | |
end | |
triplers.each do |tripler| | |
begin |
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
bash-3.2$ jruby -J-Djruby.thread.pooling=true openlibrary_modeler-rdf.rb ~/tmp/ol_dump_2011-04-30.txt.gz /Volumes/External/storage/openlibrary/ | |
3007 | |
6014 | |
9021 | |
12028 | |
15035 | |
#<ThreachDone:0x145d424> | |
ThreachDone: all_threads_done | |
to_ntriples at /usr/local/Cellar/jruby/1.6.1/jruby/lib/ruby/gems/1.8/gems/rdf-0.3.1/lib/rdf/ntriples.rb:101 | |
to_ntriples at openlibrary_modeler-rdf.rb:689 |
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
module RDF | |
## | |
# Alias for `RDF::Resource.new`. | |
# | |
# @return [RDF::Resource] | |
def self.Resource(*args, &block) | |
Resource.new(*args, &block) | |
end |
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
A very good question (and not an easy one to answer). The short answer | |
would be: Language _is_ an element of the domain to be described (Dewey | |
concepts), so a different language should generate a different URI, | |
because it describes a separate instance of a concept. A longer answer: | |
My basic premise here was that a URI like http://dewey.info/class/641/ | |
should indentify class 641 across all versions/languages of the DDC, not | |
just the most current version or a multilingual version. Why? | |
1. Labels can change over time for a given class, which could lead to |
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
javascript: | |
(function(){ | |
if(document.URL.match(/^http:\/\/dbpedia\.org\//)) { | |
document.location = document.URL.replace("http://dbpedia.org/page/","http://en.wikipedia.org/wiki/"); | |
} else if (document.URL.match(/^http:\/\/en.wikipedia\.org\/wiki/)) { | |
document.location = document.URL.replace("http://en.wikipedia.org/wiki/", "http://dbpedia.org/page/"); | |
} | |
})(); |
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
def parse_iii_marc(marc_text) | |
record = MARC::Record.new | |
marc_text.split("\n").each do |line| | |
if line =~ /^LEADER\s/ | |
record.leader = line.sub(/^LEADER\s/, '').chop | |
elsif line =~ /^[0-9]{3}\s/ | |
tag = line[0,3] | |
if tag < "010" | |
record << MARC::ControlField.new(tag,line[7..-1].chop) | |
else |
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 '/Users/rosssinger/Projects/ruby-marc/trunk/lib/marc' | |
tags = ['001','005', '100','110','111','240','243','245', /^6[0-9][0-9]$/, '700', '710', '711'] | |
recs = 0 | |
fields = 0 | |
MARC::Reader.new('/Users/rosssinger/Downloads/ic_marc.mrc.mrc').each do | rec | | |
recs += 1 | |
tags.each do |tag| | |
if tag.is_a?(String) | |
t = rec.find_all { | f | f.tag == tag } | |
else |
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 'marc' | |
tags = ['001','005', '100','110','111','240','243','245'] + ('600'..'699').to_a + ['700', '710', '711'] | |
MARC::Reader.new('blacklight-data/lc_records.utf8.mrc').each do | rec | | |
fields = rec.fields(tags) | |
end |
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 'marc' | |
tags = ['001','005', '100','110','111','240','243','245'] + ('600'..'699').to_a + ['700', '710', '711'] | |
MARC::Reader.new('blacklight-data/lc_records.utf8.mrc').each do | rec | | |
fields = rec.find_all {|f| tags.index(f.tag) } | |
end |
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 'marc' | |
MARC::Reader.new('blacklight-data/lc_records.utf8.mrc').each do | rec | | |
rec.fields('001') | |
end |