Warn on frozen VCs and create jsonld instead of JSON

Change-Id: I051b1700136f192f6dce06a65ece232edbf790c3
diff --git a/lib/KorAP/Def.pm b/lib/KorAP/Def.pm
index aff0b4b..1f8413e 100644
--- a/lib/KorAP/Def.pm
+++ b/lib/KorAP/Def.pm
@@ -56,6 +56,22 @@
   return bless $self, $class;
 };
 
+
+# Check if the def is frozen
+sub frozen_check {
+  my ($self, $key) = @_;
+  my $fh = $self->{fh};
+  while (!eof($fh)) {
+    my $line = <$fh>;
+    if (index($line, '<frozen>') > 0) {
+      return 1;
+    }
+  };
+  return 0;
+};
+
+
+# Parse def file
 sub parse {
   my $self = shift;
 
diff --git a/lib/KorAP/DefList.pm b/lib/KorAP/DefList.pm
index 9f58856..6141f1a 100644
--- a/lib/KorAP/DefList.pm
+++ b/lib/KorAP/DefList.pm
@@ -74,10 +74,13 @@
 
   # Parse
   return unless $def;
+
+  # warn $file . ' is frozen' if $def->frozen_check;
+  # return;
   $def->parse or return;
 
   # Output
-  my $out = catfile($self->{output}, $file . '.json');
+  my $out = catfile($self->{output}, $file . '.jsonld');
   if (open(my $koral, '>' . $out)) {
     binmode($koral);
     print $koral encode('utf-8', $def->to_string);
@@ -97,7 +100,7 @@
   my $vc = from_regex($regex, $name, $desc);
 
   # Output
-  my $out = catfile($self->{output}, $name . '.json');
+  my $out = catfile($self->{output}, $name . '.jsonld');
   if (open(my $koral, '>' . $out)) {
     binmode($koral);
     print $koral encode('utf-8', $vc->to_string);
diff --git a/t/list2vc-deflist.t b/t/list2vc-deflist.t
index 89577fb..1cbd29b 100644
--- a/t/list2vc-deflist.t
+++ b/t/list2vc-deflist.t
@@ -30,33 +30,33 @@
 my $protocol = join('', `@call`);
 
 like($protocol, qr!bih from regex!);
-ok(-f catfile($output, 'bih.json'));
+ok(-f catfile($output, 'bih.jsonld'));
 like($protocol, qr!bio from regex!);
-ok(-f catfile($output, 'bio.json'));
+ok(-f catfile($output, 'bio.jsonld'));
 like($protocol, qr!bio-pub from regex!);
-ok(-f catfile($output, 'bio-pub.json'));
+ok(-f catfile($output, 'bio-pub.jsonld'));
 like($protocol, qr!l from regex!);
-ok(-f catfile($output, 'l.json'));
+ok(-f catfile($output, 'l.jsonld'));
 like($protocol, qr!dpa from regex!);
-ok(-f catfile($output, 'dpa.json'));
+ok(-f catfile($output, 'dpa.jsonld'));
 like($protocol, qr!fsp from regex!);
-ok(-f catfile($output, 'fsp.json'));
+ok(-f catfile($output, 'fsp.jsonld'));
 like($protocol, qr!fsp-pub from regex!);
-ok(-f catfile($output, 'fsp-pub.json'));
+ok(-f catfile($output, 'fsp-pub.jsonld'));
 like($protocol, qr!kjl from regex!);
-ok(-f catfile($output, 'kjl.json'));
+ok(-f catfile($output, 'kjl.jsonld'));
 like($protocol, qr!thm-lit from regex!);
-ok(-f catfile($output, 'thm-lit.json'));
+ok(-f catfile($output, 'thm-lit.jsonld'));
 like($protocol, qr!wxx11 from regex!);
-ok(-f catfile($output, 'wxx11.json'));
+ok(-f catfile($output, 'wxx11.jsonld'));
 like($protocol, qr!zca from regex!);
-ok(-f catfile($output, 'zca.json'));
+ok(-f catfile($output, 'zca.jsonld'));
 like($protocol, qr!list2 from def-file!);
-ok(-f catfile($output, 'list2.json'));
+ok(-f catfile($output, 'list2.jsonld'));
 like($protocol, qr!list5 from def-file!);
-ok(-f catfile($output, 'list5.json'));
+ok(-f catfile($output, 'list5.jsonld'));
 like($protocol, qr!misc-lit from regex!);
-ok(-f catfile($output, 'misc-lit.json'));
+ok(-f catfile($output, 'misc-lit.jsonld'));
 
 done_testing;
 __END__