Skip to content

Instantly share code, notes, and snippets.

View VladimirAlexiev's full-sized avatar

Vladimir Alexiev VladimirAlexiev

View GitHub Profile
@VladimirAlexiev
VladimirAlexiev / iana-lang-tags.pl
Created January 31, 2014 14:49
Get the IANA Language Tag registry, parse it, and write it to a tab-delimited file
#!perl -w
# Parse out "http://www.iana.org/assignments/language-subtag-registry/language-subtag-registry
# And write it to a tab-delimited file.
# Format described at http://tools.ietf.org/html/bcp47#section-3.1.2
# TODO: use some Excel writer to split into sheets by Type
use LWP::Simple;
$_ = get("http://www.iana.org/assignments/language-subtag-registry/language-subtag-registry") or die;
@VladimirAlexiev
VladimirAlexiev / prefixes.ttl
Last active August 29, 2015 14:08
Convert a NTriples file (which is impossible to read) by adding prefixes. The result is line-oriented Turtle, which can be diffed easily. This way you can compare two representations of the same resource (see shell example below)
wget http://rdaregistry.info/Elements/a.jsonld
wget http://rdaregistry.info/Elements/a.ttl
riot a.jsonld | perl prefixize.pl | sort > ajson.nt
riot a.ttl | perl prefixize.pl | sort > attl.nt
diff -u0 ajson.nt attl.nt > a.diff
@VladimirAlexiev
VladimirAlexiev / a.diff
Created November 6, 2014 08:20
Results of compring RDA jsonld vs turtle representation: https://github.com/RDARegistry/RDA-Vocabularies/issues/43
--- ajson.nt 2014-11-06 09:47:41.343460100 +0200
+++ attl.nt 2014-11-06 09:47:45.678476000 +0200
@@ -1,2 +1,2 @@
-rdaa: rdfs:label "RDA Agent properties"@en .
-rdaa: reg:url <http://metadataregistry.org/schema/show/id/81.html> .
+rdaa: dc:title "RDA Agent properties"@en .
+rdaa: skos:note "Properties derived from RDA elements and relationship designators with the domain of RDA Agent."@en .
@@ -10,2 +10,2 @@
-rdaa:P50001 reg:hasUnconstrained rdau:P60001 .
-rdaa:P50001 reg:lexicalAlias rdaa:respondentOf.en .
1234 rc:Action
11621 rc:Actor
452 rc:Actor_Voice
4647 rc:AilmentCondition
2457 rc:AirlineCompany
9520 rc:Airport_Physical
10000 rc:Album_IBO
341 rc:Algae
254 rc:Ambassador
6841 rc:Amphibian
@VladimirAlexiev
VladimirAlexiev / wikidata-instClass-anonymous.txt
Created January 25, 2015 08:08
Wikidata instance counts as of Jan 2015
218|Q12600360|
194|Q18116579|
167|Q366301|
156|Q14858002|
144|Q18511695|
114|Q17503488|
86|Q11910247|
86|Q18218242|
78|Q15206070|
78|Q14694851|
@VladimirAlexiev
VladimirAlexiev / FD-grandchildren.json
Last active August 29, 2015 14:14
DBpedia Food and Drink Categories
{"name":"Food_and_drink",
"children":[{"name":"Agriculture",
"children":[{"name":"Agrarianism"},
{"name":"Agricultural_buildings"},
{"name":"Agricultural_chemicals"},
{"name":"Agricultural_education"},
{"name":"Agricultural_establishments"},
{"name":"Agricultural_health_and_safety"},
{"name":"Agricultural_insects"},
{"name":"Agricultural_labor"},
@VladimirAlexiev
VladimirAlexiev / README.md
Last active August 29, 2015 14:14
DBpedia Categories as Cluster Dendrogram
# Endpoint http://vocab.getty.edu/sparql
select ?t ?name (count(*) as ?c) {
?x gvp:placeType ?t. ?t gvp:prefLabelGVP/xl:literalForm ?name
} group by ?t ?name
# 0. Inspired by https://twitter.com/paregorios/status/568513448130187264
# 1. This includes place types AND cultures/styles (eg "religious center" and "Maya")
# 2. Exploring the AAT hierarchy above these types could also be interesting
# 3. We also provide TGN counts as per Mar 2015
# 4. The query is a bit expensive (1.2M places, 2.7M type instances), so be nice and use the attached TSV
@VladimirAlexiev
VladimirAlexiev / AAT-LCSH.tdv
Created May 29, 2015 10:07
AAT-LCSH alignments (444)
300000271 sh85088077
300000403 sh85121668
300000737 sh85061107
300002574 sh85131787
300005214 sh85011556
300005253 n92065258
300005421 sh2001011738
300005445 sh2003008376
300005756 sh85006225
300005767 sh85032780
Compiling no file at Thu Jul 30 08:35:12 2015
Leaving directory `c:/my/.emacs.d/elpa/test-simple-20150331.302'
Compiling file c:/my/.emacs.d/elpa/test-simple-20150331.302/test-simple-pkg.el at Thu Jul 30 08:48:08 2015
Entering directory `c:/my/.emacs.d/elpa/test-simple-20150331.302/'
Compiling file c:/my/.emacs.d/elpa/test-simple-20150331.302/test-simple.el at Thu Jul 30 08:48:08 2015
Compiling no file at Thu Jul 30 08:48:09 2015
Leaving directory `c:/my/.emacs.d/elpa/loc-changes-20150302.848'