#!/usr/bin/perl -w

if ($#ARGV != 1) {
	print("Usage: genJson.pl <N3Type> <N3File>\n");
	exit 0;
}

my $n3Type = $ARGV[0];
my $n3file = $ARGV[1];

# print("type: $n3Type, file: $n3file\n");

open(N3, $n3file);
@n3 = <N3>;
close N3;

my $numberOfEntries = @n3;

my $count = 1;
print("$n3Type = [\n");
foreach $item (@n3) {
	my($domain, $category, $label, $desc) = split(/\t/, $item);
	print("\t{");

#        print("$count: $label");
	print("\"domain\": \"$domain\", \"category\": \"$category\", \"label\": \"$label\"");

	print("}");

        if($count < $numberOfEntries) {
            print(",");
        }

	print("\n");
	$count++;
}

print("]\;\n");
