Skip to content

Instantly share code, notes, and snippets.

@njh
Created April 27, 2012 09:47
Show Gist options
  • Save njh/2507922 to your computer and use it in GitHub Desktop.
Save njh/2507922 to your computer and use it in GitHub Desktop.
#!/usr/bin/perl
use strict;
open(TSV, "freebase-sameas-dbpedialite-20120424.tsv") or die "Failed to open file: $!";
my %map;
while(<TSV>) {
my ($freebase, $dbpedialite) = split(/\s+/);
if ($dbpedialite =~ m|http://dbpedialite.org/things/(\d+)|) {
$map{$1} = $freebase;
}
}
close(TSV);
foreach my $key (sort { $a <=> $b } keys %map) {
print "<http://dbpedialite.org/things/$key#id> <http://www.w3.org/2002/07/owl#sameAs> <".$map{$key}."> .\n";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment