Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
test diff sizes
#!/usr/bin/perl
my $f = shift @ARGV;
runcmd("save-in-all-formats.sh $f");
our $N=16;
our $ITERATIONS=10;
for (my $iter=1; $iter<= $ITERATIONS; $iter++) {
for (my $i=1; $i<$N; $i++) {
my $x = 2 ** $i;
my $df = "DIFF-$i.owl";
my $cmd = "owljs-remove-random-axioms -n $x -o $df $f";
runcmd($cmd);
runcmd("save-in-all-formats.sh $df");
foreach my $fmt (qw(owl ofn obo ttl omn)) {
my $out = runcmd("diff $df.$fmt $f.$fmt | wc -l");
print STDERR "OUT: $out\n";
if ($out =~ /^\s*(\d+)/) {
print "$fmt\t$i\t$1\t$iter\n";
}
else {
warn($out);
}
}
}
}
exit 0;
sub runcmd {
my $c = shift;
print STDERR "CMD: $c\n";
open(F, "$c|") || die $c;
my $out = join("",<F>);
close(F);
chomp $out;
$out =~ s/^\s+//;
$out =~ s/\s+$//;
return $out;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment