3 my $inputfile = $ARGV[0];
5 print "Now splitting file $inputfile\n";
6 open(IN, "<$inputfile") or die "Error opening file $inputfile";
8 while(($where = <IN>) && not ($where =~ /<h:Object/)) {}
10 $where =~ s/^[^"]*"([^"]*)">$/$1/;
11 while(($line1 = <IN>) && not ($line1 =~ /<\/h:Object>/)) { # <h:refObj
12 $line2 = <IN>; # <h:position rdf:resource="&hns;value"/>
15 $position =~ s/^[ \t]*[^"]*"&hns;([^"]*)"\/>/$1/;
16 if ($position eq 'MainHypothesis' || $position eq 'MainConclusion') {
17 $line3 = <IN>; # <h:depth>value</h:depth>
19 $line4 = <IN>; # <h:occurrence><h:Object rdf:about="value"/></h:occurrence>
20 $line5 = <IN>; # </h:refObj>
23 $uri =~ s/^[ \t]*<h:occurrence><h:Object rdf:about="([^"]*)"\/><\/h:occurrence>$/$1/;
25 $who =~ s/^cic:/backward/;
26 $who =~ s/#xpointer\(1\/([^\/]*)\/([^\/]*)\)/,$1,$2/;
27 $who =~ s/#xpointer\(1\/([^\/]*)\)/,$1/;
28 $line4 =~ s/\Q$uri\E/$where/;
30 open(OUT, ">>$who") or die "Error opening file $who";
31 print OUT "\t\t<h:backPointer rdf:parseType="Resource">\n";
33 if ($position eq 'MainHypothesis' || $position eq 'MainConclusion') {
37 print OUT "\t\t</h:backPointer>\n";