]> matita.cs.unibo.it Git - helm.git/blob - helm/metadata/create2/fix_rdf.pl
...
[helm.git] / helm / metadata / create2 / 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/schema-h.rdf#">
16   <h:Object rdf:about="$uri">
17 EOT
18 close(HEADER);
19
20 system("cat $filename >> $outputfile");
21
22 open(FOOTER,">>$outputfile");
23 print FOOTER <<EOT;
24   </h:Object>
25 </rdf:RDF>
26 EOT
27 close(FOOTER);
28
29 unlink $filename;