time for i in `cat costanti_e_variabili.txt` ; do (cd tmp && wget -t 1 -O downloaded.xml.gz "http://mowgli.cs.unibo.it:58081/getxml?format=gz&uri=$$i" && wget -t 1 -O downloaded_body.xml.gz "http://mowgli.cs.unibo.it:58081/getxml?format=gz&uri=$$i.body") ; mkdir -p forward/`dirname $$i | sed "s/cic:\///"` && zcat tmp/downloaded.xml.gz > tmp/type.xml && zcat tmp/downloaded_body.xml.gz > tmp/body.xml ; METADATA/meta $$i > forward/`echo $$i | sed "s/cic:\///"`.xml && rm -f tmp/downloaded.xml.gz tmp/downloaded_body.xml.gz tmp/type.xml tmp/body.xml ; done > log 2>&1
time for i in `cat tipi_induttivi.txt` ; do (cd tmp && wget -t 1 -O downloaded.xml.gz "http://mowgli.cs.unibo.it:58081/getxml?format=gz&uri=$$i") && mkdir -p forward/`dirname $$i | sed "s/cic:\///"` && zcat tmp/downloaded.xml.gz > tmp/inductive_type.xml && METADATA/meta_ind forward/`echo $$i | sed "s/cic:\///"` $$i && rm tmp/downloaded.xml.gz tmp/inductive_type.xml ; done >> log 2>&1
(cd forward ; ../mkindex.sh forward)
+ cat forward_rel_or_sort_header.txt forward_rel.xml forward_rel_or_sort_footer.txt > forward_rel.xml.tmp && mv forward_rel.xml.tmp forward_rel.xml
+ cat forward_rel_or_sort_header.txt forward_sort.xml forward_rel_or_sort_footer.txt > forward_sort.xml.tmp && mv forward_sort.xml.tmp forward_sort.xml
backward:
time for i in `cat all_objects.txt` ; do touch/touch.opt $$i ; done
(cd backward ; ../mkindex.sh backward)
clean-forward:
- rm -rf forward/*
+ rm -rf forward_rel.xml forward_sort.xml forward/*
clean-backward:
rm -rf backward/*
print HEADER <<EOT;
<?xml version="1.0" encoding="ISO-8859-1"?>
-<rdf:RDF xml:lang="en" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:h="http://www.cs.unibo.it/helm/schemas/mattone.rdf#">
+<!DOCTYPE rdf:RDF [
+ <!ENTITY rdfns 'http://www.w3.org/1999/02/22-rdf-syntax-ns#'>
+ <!ENTITY hthns 'http://www.cs.unibo.it/helm/schemas/schema-helmth#'>
+ <!ENTITY hns 'http://www.cs.unibo.it/helm/schemas/schema-helm#'>
+
+ ]>
+<rdf:RDF xml:lang="en" xmlns:rdf="&rdfns;" xmlns:h="&hns;" xmlns:hth="&hthns;">
<h:Object rdf:about="$uri">
EOT
close(HEADER);
print "Now splitting file $inputfile\n";
open(IN, "<$inputfile") or die "Error opening file $inputfile";
-$dummy = <IN>; # <?xml version="1.0" encoding="ISO-8859-1"?>
-$dummy = <IN>; #
-$dummy = <IN>; # <rdf:RDF .../>
-$where = <IN>; # <h:Object rdf:about="...">
+my $where;
+while(($where = <IN>) && not ($where =~ /<h:Object/)) {}
chomp($where);
$where =~ s/^[^"]*"([^"]*)">$/$1/;
-while(($line1 = <IN>) && not ($line1 =~ /<\/h:Object>/)) {
- $line2 = <IN>; # <h:Occurrence>
- $line3 = <IN>; # <h:position>value</h:position>
- $line4 = <IN>; # <h:occurrence>value</h:occurrence>
- $line5 = <IN>; # </h:Occurrence>
- $line6 = <IN>; # </refObj>
+while(($line1 = <IN>) && not ($line1 =~ /<\/h:Object>/)) { # <h:refObj
+ $line2 = <IN>; # <h:position rdf:resource="&hns;value"/>
+ $position = $line2;
+ chomp($position);
+ $position =~ s/^[ \t]*[^"]*"&hns;([^"]*)"\/>/$1/;
+ if ($position eq 'MainHypothesis' || $position eq 'MainConclusion') {
+ $line3 = <IN>; # <h:depth>value</h:depth>
+ }
+ $line4 = <IN>; # <h:occurrence><h:Object rdf:about="value"/></h:occurrence>
+ $line5 = <IN>; # </h:refObj>
$uri = $line4;
chomp($uri);
- $uri =~ s/^[ \t]*<h:occurrence>([^<]*)<\/h:occurrence>$/$1/;
+ $uri =~ s/^[ \t]*<h:occurrence><h:Object rdf:about="([^"]*)"\/><\/h:occurrence>$/$1/;
$who = $uri;
$who =~ s/^cic:/backward/;
$who =~ s/#xpointer\(1\/([^\/]*)\/([^\/]*)\)/,$1,$2/;
open(OUT, ">>$who") or die "Error opening file $who";
print OUT "\t\t<h:backPointer>\n";
print OUT $line2;
- print OUT $line3;
+ if ($position eq 'MainHypothesis' || $position eq 'MainConclusion') {
+ print OUT $line3;
+ }
print OUT $line4;
- print OUT $line5;
print OUT "\t\t</h:backPointer>\n";
close(OUT);
}