]> matita.cs.unibo.it Git - helm.git/blob - helm/metadata/create_V7_mowgli/fix_rdf.pl
Quotes problem fixed.
[helm.git] / helm / metadata / create_V7_mowgli / fix_rdf.pl
1 #!/usr/bin/perl
2
3 $filename = $uri = $ARGV[0];
4 $outputfile = $filename.".xml";
5 $uri =~ s/^backward/cic:/;
6 $uri =~ s/(.*),([^,]*),([^,]*)/$1#xpointer(1\/$2\/$3)/;
7 $uri =~ s/(.*),([^,]*)/$1#xpointer(1\/$2)/;
8
9 print "Now processing file $filename\n";
10
11 open(HEADER,">>$outputfile");
12 print HEADER <<EOT;
13 <?xml version="1.0" encoding="ISO-8859-1"?>
14
15 <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#">
16         <h:Object rdf:about="$uri">
17 EOT
18 close(HEADER);
19
20 $quotedfilename = $filename;
21 $quotedfilename =~ s/'/\\'/g;
22 $quotedoutputfile = $outputfile;
23 $quotedoutputfile =~ s/'/\\'/g;
24 system("cat $quotedfilename >> $quotedoutputfile");
25
26 open(FOOTER,">>$outputfile");
27 print FOOTER <<EOT;
28         </h:Object>
29 </rdf:RDF>
30 EOT
31 close(FOOTER);
32
33 unlink $filename;