From f9c4a1158888982406aca8960b6d50cdce677507 Mon Sep 17 00:00:00 2001 From: Claudio Sacerdoti Coen Date: Mon, 23 Feb 2004 12:59:35 +0000 Subject: [PATCH] (Very)* Old stuff removed. --- helm/metadata/create/.cvsignore | 1 - helm/metadata/create2/Makefile | 27 - helm/metadata/create2/fix_rdf.pl | 29 -- helm/metadata/create2/invert.pl | 31 -- helm/metadata/create2/mk_forward/.cvsignore | 1 - helm/metadata/create2/mk_forward/.depend | 0 helm/metadata/create2/mk_forward/Makefile | 41 -- .../metadata/create2/mk_forward/mk_forward.ml | 385 -------------- helm/metadata/create2/mkindex.sh | 4 - helm/metadata/create2/touch/.cvsignore | 1 - helm/metadata/create2/touch/.depend | 0 helm/metadata/create2/touch/Makefile | 41 -- helm/metadata/create2/touch/touch.ml | 132 ----- helm/metadata/create2/uris_of_filenames.pl | 14 - helm/metadata/create4/METADATA/Makefile | 17 - helm/metadata/create4/METADATA/meta_lex.l | 263 ---------- helm/metadata/create4/METADATA/sthandler.c | 263 ---------- helm/metadata/create4/METADATA/sthandler.h | 8 - helm/metadata/create4/Makefile | 27 - helm/metadata/create_V7_mowgli/.cvsignore | 2 - .../create_V7_mowgli/METADATA/.cvsignore | 4 - .../create_V7_mowgli/METADATA/Makefile | 28 -- .../metadata/create_V7_mowgli/METADATA/README | 9 - .../create_V7_mowgli/METADATA/meta_lex.l | 393 --------------- .../create_V7_mowgli/METADATA/meta_lex_ind.l | 390 --------------- .../create_V7_mowgli/METADATA/sthandler.c | 469 ------------------ .../create_V7_mowgli/METADATA/sthandler.h | 8 - .../create_V7_mowgli/METADATA/sthandler_ind.c | 423 ---------------- .../create_V7_mowgli/METADATA/sthandler_ind.h | 8 - helm/metadata/create_V7_mowgli/Makefile | 27 - helm/metadata/create_V7_mowgli/fix_rdf.pl | 39 -- .../forward_rel_or_sort_footer.txt | 1 - .../forward_rel_or_sort_header.txt | 9 - helm/metadata/create_V7_mowgli/invert.pl | 40 -- helm/metadata/create_V7_mowgli/mkindex.sh | 4 - .../create_V7_mowgli/touch/.cvsignore | 1 - helm/metadata/create_V7_mowgli/touch/.depend | 0 helm/metadata/create_V7_mowgli/touch/Makefile | 41 -- helm/metadata/create_V7_mowgli/touch/touch.ml | 132 ----- .../create_V7_mowgli/uris_of_filenames.pl | 14 - helm/metadata/dc_mowgli/.cvsignore | 1 - helm/metadata/dc_mowgli/Makefile | 7 - helm/metadata/dc_mowgli/create_dc_indexes | 37 -- helm/metadata/dc_mowgli/create_dc_tables | 18 - helm/metadata/dc_mowgli/drop_dc_tables | 18 - helm/metadata/dc_mowgli/mkindex.sh | 4 - helm/metadata/dc_mowgli/upload.pl | 51 -- helm/metadata/dc_mowgli/uris_of_filenames.pl | 14 - helm/metadata/postgresql_V7_mowgli/.cvsignore | 6 - helm/metadata/postgresql_V7_mowgli/Makefile | 16 - helm/metadata/postgresql_V7_mowgli/README | 29 -- .../postgresql_V7_mowgli/inserisci.pl | 24 - .../postgresql_V7_mowgli/inserisci_names.pl | 13 - .../metadata_for_names/.cvsignore | 1 - .../metadata_for_names/Makefile | 2 - .../postgresql_V7_mowgli/metainfo.xsl | 60 --- .../postgresql_V7_mowgli/upload_rel.pl | 30 -- .../postgresql_V7_mowgli/upload_sort.pl | 36 -- 58 files changed, 3694 deletions(-) delete mode 100644 helm/metadata/create/.cvsignore delete mode 100644 helm/metadata/create2/Makefile delete mode 100755 helm/metadata/create2/fix_rdf.pl delete mode 100755 helm/metadata/create2/invert.pl delete mode 100644 helm/metadata/create2/mk_forward/.cvsignore delete mode 100644 helm/metadata/create2/mk_forward/.depend delete mode 100644 helm/metadata/create2/mk_forward/Makefile delete mode 100644 helm/metadata/create2/mk_forward/mk_forward.ml delete mode 100755 helm/metadata/create2/mkindex.sh delete mode 100644 helm/metadata/create2/touch/.cvsignore delete mode 100644 helm/metadata/create2/touch/.depend delete mode 100644 helm/metadata/create2/touch/Makefile delete mode 100644 helm/metadata/create2/touch/touch.ml delete mode 100755 helm/metadata/create2/uris_of_filenames.pl delete mode 100644 helm/metadata/create4/METADATA/Makefile delete mode 100644 helm/metadata/create4/METADATA/meta_lex.l delete mode 100644 helm/metadata/create4/METADATA/sthandler.c delete mode 100644 helm/metadata/create4/METADATA/sthandler.h delete mode 100644 helm/metadata/create4/Makefile delete mode 100644 helm/metadata/create_V7_mowgli/.cvsignore delete mode 100644 helm/metadata/create_V7_mowgli/METADATA/.cvsignore delete mode 100644 helm/metadata/create_V7_mowgli/METADATA/Makefile delete mode 100644 helm/metadata/create_V7_mowgli/METADATA/README delete mode 100644 helm/metadata/create_V7_mowgli/METADATA/meta_lex.l delete mode 100644 helm/metadata/create_V7_mowgli/METADATA/meta_lex_ind.l delete mode 100644 helm/metadata/create_V7_mowgli/METADATA/sthandler.c delete mode 100644 helm/metadata/create_V7_mowgli/METADATA/sthandler.h delete mode 100644 helm/metadata/create_V7_mowgli/METADATA/sthandler_ind.c delete mode 100644 helm/metadata/create_V7_mowgli/METADATA/sthandler_ind.h delete mode 100644 helm/metadata/create_V7_mowgli/Makefile delete mode 100755 helm/metadata/create_V7_mowgli/fix_rdf.pl delete mode 100644 helm/metadata/create_V7_mowgli/forward_rel_or_sort_footer.txt delete mode 100644 helm/metadata/create_V7_mowgli/forward_rel_or_sort_header.txt delete mode 100755 helm/metadata/create_V7_mowgli/invert.pl delete mode 100755 helm/metadata/create_V7_mowgli/mkindex.sh delete mode 100644 helm/metadata/create_V7_mowgli/touch/.cvsignore delete mode 100644 helm/metadata/create_V7_mowgli/touch/.depend delete mode 100644 helm/metadata/create_V7_mowgli/touch/Makefile delete mode 100644 helm/metadata/create_V7_mowgli/touch/touch.ml delete mode 100755 helm/metadata/create_V7_mowgli/uris_of_filenames.pl delete mode 100644 helm/metadata/dc_mowgli/.cvsignore delete mode 100644 helm/metadata/dc_mowgli/Makefile delete mode 100644 helm/metadata/dc_mowgli/create_dc_indexes delete mode 100644 helm/metadata/dc_mowgli/create_dc_tables delete mode 100644 helm/metadata/dc_mowgli/drop_dc_tables delete mode 100755 helm/metadata/dc_mowgli/mkindex.sh delete mode 100755 helm/metadata/dc_mowgli/upload.pl delete mode 100755 helm/metadata/dc_mowgli/uris_of_filenames.pl delete mode 100644 helm/metadata/postgresql_V7_mowgli/.cvsignore delete mode 100644 helm/metadata/postgresql_V7_mowgli/Makefile delete mode 100644 helm/metadata/postgresql_V7_mowgli/README delete mode 100755 helm/metadata/postgresql_V7_mowgli/inserisci.pl delete mode 100755 helm/metadata/postgresql_V7_mowgli/inserisci_names.pl delete mode 100644 helm/metadata/postgresql_V7_mowgli/metadata_for_names/.cvsignore delete mode 100644 helm/metadata/postgresql_V7_mowgli/metadata_for_names/Makefile delete mode 100644 helm/metadata/postgresql_V7_mowgli/metainfo.xsl delete mode 100755 helm/metadata/postgresql_V7_mowgli/upload_rel.pl delete mode 100755 helm/metadata/postgresql_V7_mowgli/upload_sort.pl diff --git a/helm/metadata/create/.cvsignore b/helm/metadata/create/.cvsignore deleted file mode 100644 index 1039a2b22..000000000 --- a/helm/metadata/create/.cvsignore +++ /dev/null @@ -1 +0,0 @@ -output rdf diff --git a/helm/metadata/create2/Makefile b/helm/metadata/create2/Makefile deleted file mode 100644 index b1ce8e195..000000000 --- a/helm/metadata/create2/Makefile +++ /dev/null @@ -1,27 +0,0 @@ -all: - @echo Available targets: - @echo " forward, backward, compress, clean-forward, clean-backward" - -forward: - time for i in `cat pluto` ; do mk_forward/mk_forward.opt $$i ; done > log 2>&1 - (cd forward ; ../mkindex.sh forward) - -backward: - time for i in `cat pluto` ; do touch/touch.opt $$i ; done - find forward -type f -exec ./invert.pl {} \; - find backward -type f -exec ./fix_rdf.pl {} \; - (cd backward ; ../mkindex.sh backward) - -compress: - find forward -name "*.xml" -exec gzip {} \; - find backward -name "*.xml" -exec gzip {} \; - (cd forward ; ../mkindex.sh forward) - (cd backward ; ../mkindex.sh backward) - -clean-forward: - rm -rf forward/* - -clean-backward: - rm -rf backward/* - -.PHONY: all forward backward compress clean-forward clean-backward diff --git a/helm/metadata/create2/fix_rdf.pl b/helm/metadata/create2/fix_rdf.pl deleted file mode 100755 index 5d86c45c7..000000000 --- a/helm/metadata/create2/fix_rdf.pl +++ /dev/null @@ -1,29 +0,0 @@ -#!/usr/bin/perl - -$filename = $uri = $ARGV[0]; -$outputfile = $filename.".xml"; -$uri =~ s/^backward/cic:/; -$uri =~ s/(.*),([^,]*),([^,]*)/$1#xpointer(1\/$2\/$3)/; -$uri =~ s/(.*),([^,]*)/$1#xpointer(1\/$2)/; - -print "Now processing file $filename\n"; - -open(HEADER,">>$outputfile"); -print HEADER < - - - -EOT -close(HEADER); - -system("cat $filename >> $outputfile"); - -open(FOOTER,">>$outputfile"); -print FOOTER < - -EOT -close(FOOTER); - -unlink $filename; diff --git a/helm/metadata/create2/invert.pl b/helm/metadata/create2/invert.pl deleted file mode 100755 index f4a490dcb..000000000 --- a/helm/metadata/create2/invert.pl +++ /dev/null @@ -1,31 +0,0 @@ -#!/usr/bin/perl - -my $inputfile = $ARGV[0]; - -print "Now splitting file $inputfile\n"; -open(IN, "<$inputfile") or die "Error opening file $inputfile"; -$dummy = ; # -$dummy = ; # -$dummy = ; # -$where = ; # -chomp($where); -$where =~ s/^[^"]*"([^"]*)">$/$1/; -while(($line1 = ) && not ($line1 =~ /<\/h:Object>/)) { - $line2 = ; - $line3 = ; # - $uri = $line2; - chomp($uri); - $uri =~ s/^ *$/$1/; - $who = $uri; - $who =~ s/^cic:/backward/; - $who =~ s/#xpointer\(1\/([^\/]*)\/([^\/]*)\)/,$1,$2/; - $who =~ s/#xpointer\(1\/([^\/]*)\)/,$1/; - $line2 =~ s/\Q$uri\E/$where/; - - open(OUT, ">>$who") or die "Error opening file $who"; - print OUT " \n"; - print OUT $line2; - print OUT " \n"; - close(OUT); -} -close(IN); diff --git a/helm/metadata/create2/mk_forward/.cvsignore b/helm/metadata/create2/mk_forward/.cvsignore deleted file mode 100644 index 9aee29b36..000000000 --- a/helm/metadata/create2/mk_forward/.cvsignore +++ /dev/null @@ -1 +0,0 @@ -*.cmi *.cmo *.cmx mk_forward mk_forward.opt diff --git a/helm/metadata/create2/mk_forward/.depend b/helm/metadata/create2/mk_forward/.depend deleted file mode 100644 index e69de29bb..000000000 diff --git a/helm/metadata/create2/mk_forward/Makefile b/helm/metadata/create2/mk_forward/Makefile deleted file mode 100644 index 3eccfbf95..000000000 --- a/helm/metadata/create2/mk_forward/Makefile +++ /dev/null @@ -1,41 +0,0 @@ -REQUIRES = helm-xml helm-cic_proof_checking -PREDICATES = miniReduction -OCAMLOPTIONS = -package "$(REQUIRES)" -predicates "$(PREDICATES)" -pp camlp4o -OCAMLDEP = ocamldep -OCAMLFIND = ocamlfind -OCAMLC = $(OCAMLFIND) ocamlc $(OCAMLOPTIONS) -OCAMLOPT = $(OCAMLFIND) ocamlopt $(OCAMLOPTIONS) - -LIBRARIES = $(shell ocamlfind query -recursive -predicates "byte $(PREDICATES)" -format "%d/%a" $(REQUIRES)) -LIBRARIES_OPT = $(shell ocamlfind query -recursive -predicates "native $(PREDICATES)" -format "%d/%a" $(REQUIRES)) - -all: mk_forward -opt: mk_forward.opt - -DEPOBJS = mk_forward.ml - -MKFORWARDOBJS = mk_forward.cmo - -depend: - $(OCAMLDEP) $(DEPOBJS) > .depend - -mk_forward: $(MKFORWARDOBJS) $(LIBRARIES) - $(OCAMLC) -linkpkg -o mk_forward $(MKFORWARDOBJS) - -mk_forward.opt: $(MKFORWARDOBJS:.cmo=.cmx) $(LIBRARIES_OPT) - $(OCAMLOPT) -linkpkg -o mk_forward.opt $(MKFORWARDOBJS:.cmo=.cmx) - -.SUFFIXES: .ml .mli .cmo .cmi .cmx -.ml.cmo: $(LIBRARIES) - $(OCAMLC) -c $< -.mli.cmi: $(LIBRARIES) - $(OCAMLC) -c $< -.ml.cmx: $(LIBRARIES_OPT) - $(OCAMLOPT) -c $< - -clean: - rm -f *.cm[iox] *.o mk_forward mk_forward.opt - -.PHONY: clean - -include .depend diff --git a/helm/metadata/create2/mk_forward/mk_forward.ml b/helm/metadata/create2/mk_forward/mk_forward.ml deleted file mode 100644 index e97ed3347..000000000 --- a/helm/metadata/create2/mk_forward/mk_forward.ml +++ /dev/null @@ -1,385 +0,0 @@ -(* Copyright (C) 2000, HELM Team. - * - * This file is part of HELM, an Hypertextual, Electronic - * Library of Mathematics, developed at the Computer Science - * Department, University of Bologna, Italy. - * - * HELM is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * HELM is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with HELM; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, - * MA 02111-1307, USA. - * - * For details, see the HELM World-Wide-Web page, - * http://cs.unibo.it/helm/. - *) - -(******************************************************************************) -(* *) -(* PROJECT HELM *) -(* *) -(* Claudio Sacerdoti Coen *) -(* 03/04/2001 *) -(* *) -(* Missing description *) -(* *) -(******************************************************************************) - -let iteri foo = - let counter = ref 0 in - List.iter (function e -> incr counter ; foo e !counter) -;; - -let pathname_of_uri uristring = - "forward" ^ - Str.replace_first (Str.regexp "^cic:") "" uristring -;; - -let make_dirs dirpath = - ignore (Unix.system ("mkdir -p \"" ^ dirpath ^ "\"")) -;; - -module UriHash = - struct - type classification = - Backbone - | Branch - | InConclusion - | InHypothesis - | InBody - ;; - -let soften_classification = - function - Backbone -> InConclusion - | Branch -> InHypothesis - | InBody -> assert false - | k -> k -;; - - let hash = Hashtbl.create 117 ;; - - let add_uri uri kind = - let old_kinds = - try - Hashtbl.find hash uri - with - Not_found -> [] - in - let new_kinds = - match kind,old_kinds with - InBody,[] -> [InBody] - | InBody,_ -> old_kinds - | k,_ when List.mem k old_kinds -> old_kinds - | k,_ -> k::old_kinds - in - Hashtbl.replace hash uri new_kinds - ;; - - (* It also removes every element in the hash *) - let uris_fold foo init = - let xml_element_name_of_kind = - function - Backbone -> "MainConclusion" - | Branch -> "MainHypothesis" - | InConclusion -> "InConclusion" - | InHypothesis -> "InHypothesis" - | InBody -> "InBody" - in - let res = - Hashtbl.fold - (fun uri kinds i -> - List.fold_left - (fun j kind -> - foo j uri (xml_element_name_of_kind kind) - ) i kinds - ) hash init - in - Hashtbl.clear hash ; - res - ;; - end -;; - -let output_content () = - UriHash.uris_fold - (fun i uri kind -> - [< Xml.xml_nempty "h:refObj" [] - (Xml.xml_empty "h:Occurrence" - ["rdf:about","http://www.cs.unibo.it/helm/schemas/schema-h.rdf#" ^ kind ; - "rdf:value",uri] - ) ; - i - >] - ) [<>] -;; - -let output_file cic_string_uri rdf_string_uri = - let module U = UriManager in - let module X = Xml in - let content = output_content () in - let rdf_uri = U.uri_of_string rdf_string_uri in - make_dirs (pathname_of_uri (U.buri_of_uri rdf_uri)) ; - X.pp - [< X.xml_cdata "\n" ; - X.xml_nempty "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#"] - - (try - Stream.empty content ; (* raise Stream.failure if not empty *) - X.xml_empty "h:Object" ["rdf:about",cic_string_uri] - with - Stream.Failure -> - X.xml_nempty "h:Object" ["rdf:about",cic_string_uri] content - ) - >] - (Some (pathname_of_uri rdf_string_uri ^ ".xml")) -;; - -let get_obj uri = - let cicfilename = Getter.getxml uri in - let res = CicParser.obj_of_xml cicfilename uri in - Unix.unlink cicfilename ; - res -;; - -let add_every_constructor uri typeno kind = - let module C = Cic in - match (get_obj uri) with - (C.InductiveDefinition (itys,_,_)) -> - let string_uri = UriManager.string_of_uri uri in - let sn = string_of_int (typeno + 1) in - let (_,_,_,cons) = List.nth itys typeno in - iteri - (fun (_,cty,_) m -> - let sm = string_of_int m in - UriHash.add_uri - (string_uri ^ "#xpointer(1/" ^ sn ^ "/" ^ sm ^ ")") - kind - ) cons - | _ -> assert false -;; - -let process_type term = - let module U = UriManager in - let module H = UriHash in - let module C = Cic in - let rec process_type_aux kind = - function - | C.Var uri -> - H.add_uri (U.string_of_uri uri) kind - | C.Cast (te,_) -> - (* type ignored *) - process_type_aux kind te - | C.Prod (_,sou,ta) -> - let (source_kind,target_kind) = - match kind with - H.Backbone -> (H.Branch,H.Backbone) - | H.Branch -> (H.InHypothesis,H.InHypothesis) - | H.InBody -> assert false - | k -> (k,k) - in - process_type_aux source_kind sou ; - process_type_aux target_kind ta - | C.Lambda (_,sou,ta) -> - let kind' = H.soften_classification kind in - process_type_aux kind' sou ; - process_type_aux kind' ta - | C.LetIn (_,te,ta)-> - let kind' = H.soften_classification kind in - process_type_aux kind' te ; - process_type_aux kind ta - | C.Appl (he::tl) -> - let kind' = H.soften_classification kind in - process_type_aux kind he ; - List.iter (process_type_aux kind') tl - | C.Appl _ -> assert false - | C.Const (uri,_) -> - UriHash.add_uri (U.string_of_uri uri) kind - | C.MutInd (uri,_,typeno) -> - H.add_uri - (U.string_of_uri uri ^ "#xpointer(1/" ^ - string_of_int (typeno + 1) ^ ")") - kind - | C.MutConstruct (uri,_,typeno,consno) -> - H.add_uri - (U.string_of_uri uri ^ "#xpointer(1/" ^ - string_of_int (typeno + 1) ^ "/" ^ string_of_int consno ^ ")") - kind - | C.MutCase (uri,_,typeno,_,term,patterns) -> - (* outtype ignored *) - let kind' = H.soften_classification kind in - add_every_constructor uri typeno kind' ; - process_type_aux kind' term ; - List.iter (process_type_aux kind') patterns - | C.Fix (_,funs) -> - let kind' = H.soften_classification kind in - List.iter - (function (_,_,bo,ty) -> - process_type_aux kind' bo ; - process_type_aux kind' ty ; - ) funs - | C.CoFix (_,funs) -> - let kind' = H.soften_classification kind in - List.iter - (function (_,bo,ty) -> - process_type_aux kind' bo ; - process_type_aux kind' ty ; - ) funs - | _ -> () -in - process_type_aux H.Backbone (CicMiniReduction.letin_nf term) -;; - -let process_body = - let module U = UriManager in - let module H = UriHash in - let module C = Cic in - let rec process_body_aux = - function - C.Var uri -> - H.add_uri (U.string_of_uri uri) H.InBody - | C.Cast (te,ty) -> - process_body_aux te ; - process_body_aux ty - | C.Prod (_,sou,ta) -> - process_body_aux sou ; - process_body_aux ta - | C.Lambda (_,sou,ta) -> - process_body_aux sou ; - process_body_aux ta - | C.LetIn (_,te,ta)-> - process_body_aux te ; - process_body_aux ta - | C.Appl l -> - List.iter process_body_aux l - | C.Const (uri,_) -> - UriHash.add_uri (U.string_of_uri uri) H.InBody - | C.MutInd (uri,_,typeno) -> - H.add_uri - (U.string_of_uri uri ^ "#xpointer(1/" ^ - string_of_int (typeno + 1) ^ ")") - H.InBody - | C.MutConstruct (uri,_,typeno,consno) -> - H.add_uri - (U.string_of_uri uri ^ "#xpointer(1/" ^ - string_of_int (typeno + 1) ^ "/" ^ string_of_int consno ^ ")") - H.InBody - | C.MutCase (uri,_,typeno,outtype,term,patterns) -> - add_every_constructor uri typeno H.InBody ; - process_body_aux outtype ; - process_body_aux term ; - List.iter process_body_aux patterns - | C.Fix (_,funs) -> - List.iter - (function (_,_,bo,ty) -> - process_body_aux bo ; - process_body_aux ty ; - ) funs - | C.CoFix (_,funs) -> - List.iter - (function (_,bo,ty) -> - process_body_aux bo ; - process_body_aux ty ; - ) funs - | _ -> () -in - process_body_aux -;; - -let process_obj string_uri = - let module U = UriManager in - let module C = Cic in - function - (C.Definition (_,bo,ty,_)) -> - process_type ty ; - process_body bo ; - output_file string_uri string_uri - | (C.Axiom (_,ty,_)) -> - process_type ty ; - output_file string_uri string_uri - | (C.Variable (_,bo,ty)) -> - process_type ty ; - begin - match bo with - (Some bo') -> process_body bo' - | _ -> () - end ; - output_file string_uri string_uri - | (C.InductiveDefinition _) as id -> - begin - let id' = - CicSubstitution.undebrujin_inductive_def - (U.uri_of_string string_uri) id - in - match id' with - (C.InductiveDefinition (itys,_,_)) -> - iteri - (fun (_,_,ty,cons) n -> - let sn = string_of_int n in - process_type ty ; - output_file - (string_uri ^ "#xpointer(1/" ^ sn ^ ")") - (string_uri ^ "," ^ sn) ; - iteri - (fun (_,cty,_) m -> - let sm = string_of_int m in - process_type cty ; - output_file - (string_uri ^ "#xpointer(1/" ^ sn ^ "/" ^ sm ^ ")") - (string_uri ^ "," ^ sn ^ "," ^ sm) - ) cons - ) itys - | _ -> assert false - end - | (C.CurrentProof _) -> assert false -;; - -let mk_forward string_uri = - let module U = UriManager in - print_endline ("Now computing metadata of " ^ string_uri) ; - flush stdout ; - let uri = U.uri_of_string string_uri in - let obj = get_obj uri in - process_obj string_uri obj -;; - -let _ = - let usage_msg = "usage: mk_forward[.opt] URI" in - let uri = ref "" in - Arg.parse [] - (fun x -> - if x = "" then - begin - prerr_string "No URI provided.\n" ; - Arg.usage [] usage_msg ; - exit (-1) - end - else if !uri = "" then - uri := x - else - begin - prerr_string "More than two arguments provided.\n" ; - Arg.usage [] usage_msg ; - exit (-1) - end - ) usage_msg ; - if !uri = "" then - begin - prerr_string "No URI provided.\n" ; - Arg.usage [] usage_msg ; - exit (-1) - end ; - mk_forward !uri -;; diff --git a/helm/metadata/create2/mkindex.sh b/helm/metadata/create2/mkindex.sh deleted file mode 100755 index 3a814ba17..000000000 --- a/helm/metadata/create2/mkindex.sh +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/bash - -echo `find . -name "*.xml"` | ../uris_of_filenames.pl $1 > rdf_index.txt -echo `find . -name "*.xml.gz"` | ../uris_of_filenames.pl $1 -gz >> rdf_index.txt diff --git a/helm/metadata/create2/touch/.cvsignore b/helm/metadata/create2/touch/.cvsignore deleted file mode 100644 index 10bc8bd91..000000000 --- a/helm/metadata/create2/touch/.cvsignore +++ /dev/null @@ -1 +0,0 @@ -*.cmi *.cmo *.cmx touch touch.opt diff --git a/helm/metadata/create2/touch/.depend b/helm/metadata/create2/touch/.depend deleted file mode 100644 index e69de29bb..000000000 diff --git a/helm/metadata/create2/touch/Makefile b/helm/metadata/create2/touch/Makefile deleted file mode 100644 index 636a804da..000000000 --- a/helm/metadata/create2/touch/Makefile +++ /dev/null @@ -1,41 +0,0 @@ -REQUIRES = helm-getter helm-cic str -PREDICATES = -OCAMLOPTIONS = -package "$(REQUIRES)" -predicates "$(PREDICATES)" -OCAMLDEP = ocamldep -OCAMLFIND = ocamlfind -OCAMLC = $(OCAMLFIND) ocamlc $(OCAMLOPTIONS) -OCAMLOPT = $(OCAMLFIND) ocamlopt $(OCAMLOPTIONS) - -LIBRARIES = $(shell ocamlfind query -recursive -predicates "byte $(PREDICATES)" -format "%d/%a" $(REQUIRES)) -LIBRARIES_OPT = $(shell ocamlfind query -recursive -predicates "native $(PREDICATES)" -format "%d/%a" $(REQUIRES)) - -all: touch -opt: touch.opt - -DEPOBJS = touch.ml - -TOUCHOBJS = touch.cmo - -depend: - $(OCAMLDEP) $(DEPOBJS) > .depend - -touch: $(TOUCHOBJS) $(LIBRARIES) - $(OCAMLC) -linkpkg -o touch $(TOUCHOBJS) - -touch.opt: $(TOUCHOBJS:.cmo=.cmx) $(LIBRARIES_OPT) - $(OCAMLOPT) -linkpkg -o touch.opt $(TOUCHOBJS:.cmo=.cmx) - -.SUFFIXES: .ml .mli .cmo .cmi .cmx -.ml.cmo: $(LIBRARIES) - $(OCAMLC) -c $< -.mli.cmi: $(LIBRARIES) - $(OCAMLC) -c $< -.ml.cmx: $(LIBRARIES_OPT) - $(OCAMLOPT) -c $< - -clean: - rm -f *.cm[iox] *.o touch touch.opt - -.PHONY: clean - -include .depend diff --git a/helm/metadata/create2/touch/touch.ml b/helm/metadata/create2/touch/touch.ml deleted file mode 100644 index 8fea03e0e..000000000 --- a/helm/metadata/create2/touch/touch.ml +++ /dev/null @@ -1,132 +0,0 @@ -(* Copyright (C) 2000, HELM Team. - * - * This file is part of HELM, an Hypertextual, Electronic - * Library of Mathematics, developed at the Computer Science - * Department, University of Bologna, Italy. - * - * HELM is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * HELM is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with HELM; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, - * MA 02111-1307, USA. - * - * For details, see the HELM World-Wide-Web page, - * http://cs.unibo.it/helm/. - *) - -(******************************************************************************) -(* *) -(* PROJECT HELM *) -(* *) -(* Claudio Sacerdoti Coen *) -(* 03/04/2001 *) -(* *) -(* Missing description *) -(* *) -(******************************************************************************) - -let iteri foo = - let counter = ref 0 in - List.iter (function e -> incr counter ; foo e !counter) -;; - -let pathname_of_uri uristring = - "backward" ^ - Str.replace_first (Str.regexp "^cic:") "" uristring -;; - -let make_dirs dirpath = - ignore (Unix.system ("mkdir -p \"" ^ dirpath ^ "\"")) -;; - -let touch_file rdf_string_uri = - let module U = UriManager in - let rdf_uri = U.uri_of_string rdf_string_uri in - make_dirs (pathname_of_uri (U.buri_of_uri rdf_uri)) ; - ignore ( - Unix.system - ("touch \"" ^ (pathname_of_uri rdf_string_uri) ^ "\"") - ) -;; - -let get_obj uri = - let cicfilename = Getter.getxml uri in - let res = CicParser.obj_of_xml cicfilename uri in - Unix.unlink cicfilename ; - res -;; - -let touch_obj string_uri = - let module U = UriManager in - let module C = Cic in - function - Some (C.InductiveDefinition (itys,_,_)) -> - iteri - (fun (_,_,_,cons) n -> - let sn = string_of_int n in - touch_file - (string_uri ^ "," ^ sn) ; - iteri - (fun (_,_,_) m -> - let sm = string_of_int m in - touch_file - (string_uri ^ "," ^ sn ^ "," ^ sm) - ) cons - ) itys - | Some _ -> assert false - | None -> - touch_file string_uri -;; - -let touch string_uri = - let module S = String in - let module U = UriManager in - print_endline ("Now touching metadata file for " ^ string_uri) ; - flush stdout ; - let uri = U.uri_of_string string_uri in - let obj = - if S.sub string_uri (S.length string_uri - 3) 3 = "ind" then - Some (get_obj uri) - else - None - in - touch_obj string_uri obj -;; - -let _ = - let usage_msg = "usage: touch[.opt] URI" in - let uri = ref "" in - Arg.parse [] - (fun x -> - if x = "" then - begin - prerr_string "No URI provided.\n" ; - Arg.usage [] usage_msg ; - exit (-1) - end - else if !uri = "" then - uri := x - else - begin - prerr_string "More than two arguments provided.\n" ; - Arg.usage [] usage_msg ; - exit (-1) - end - ) usage_msg ; - if !uri = "" then - begin - prerr_string "No URI provided.\n" ; - Arg.usage [] usage_msg ; - exit (-1) - end ; - touch !uri -;; diff --git a/helm/metadata/create2/uris_of_filenames.pl b/helm/metadata/create2/uris_of_filenames.pl deleted file mode 100755 index db835bf9c..000000000 --- a/helm/metadata/create2/uris_of_filenames.pl +++ /dev/null @@ -1,14 +0,0 @@ -#!/usr/bin/perl - -while() { - chomp; - split / /; - for (@_) { - $GZSUFF = ""; - if (/.gz$/) - { s/.gz$//; $GZSUFF = " gz" if ($ARGV[1] == "-gz"); } - s/\./helm:rdf:www.cs.unibo.it\/helm\/rdf\/$ARGV[0]\/\/cic:/; - s/\.xml//; - print $_.$GZSUFF."\n"; - } -} diff --git a/helm/metadata/create4/METADATA/Makefile b/helm/metadata/create4/METADATA/Makefile deleted file mode 100644 index 160f0bbf9..000000000 --- a/helm/metadata/create4/METADATA/Makefile +++ /dev/null @@ -1,17 +0,0 @@ -CC = gcc - -meta: lex.yy.o sthandler.o - gcc lex.yy.o sthandler.o -o meta - -lex.yy.c: meta_lex.l sthandler.h - flex meta_lex.l - -sthandler.o: sthandler.c sthandler.h - -lex.yy.o: lex.yy.c sthandler.h - gcc -c lex.yy.c - -clean: - -rm *.o - -rm lex.yy.c - -rm meta diff --git a/helm/metadata/create4/METADATA/meta_lex.l b/helm/metadata/create4/METADATA/meta_lex.l deleted file mode 100644 index 7c3d0b43f..000000000 --- a/helm/metadata/create4/METADATA/meta_lex.l +++ /dev/null @@ -1,263 +0,0 @@ - /******************************************************************/ - /* Copyright (C) 2000, HELM Team */ - /* */ - /* This file is part of HELM, an Hypertextual, Electronic */ - /* Library of Mathematics, developed at the Computer Science */ - /* Department, University of Bologna, Italy. */ - /* */ - /* HELM is free software; you can redistribute it and/or */ - /* modify it under the terms of the GNU General Public License */ - /* as published by the Free Software Foundation; either version */ - /* 2 of the License, or (at your option) any later version. */ - /* */ - /* HELM is distributed in the hope that it will be useful, */ - /* but WITHOUT ANY WARRANTY; without even the implied warranty of */ - /* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */ - /* GNU General Public License for more details. */ - /* */ - /* You should have received a copy of the GNU General Public */ - /* License along with HELM; if not, write to the Free Software */ - /* Foundation, Inc., 59 Temple Place - Suite 330, Boston, */ - /* MA 02111-1307, USA. */ - /* */ - /* For details, see the HELM World-Wide-Web page, */ - /* http://cs.unibo.it/helm/. */ - /******************************************************************/ - - /***************************************************************/ - /* META_LEXAN */ - /* Automatic Metadata Extractor */ - /* First draft 11/12/2001, by Andrea Asperti */ - /***************************************************************/ - - /***************************************************************/ - /* 1. Inclusion of header files. */ - /***************************************************************/ - -%{ -#include -#include -#include "sthandler.h" -%} - - /***************************************************************/ - /* 2. Constants and Variables Definitions */ - /***************************************************************/ - -%{ -#define NOWHERE 0 -#define CONST 1 -#define MUTIND 2 -#define MUTCONSTRUCT 3 - -#define INBODY 0 -#define MAINHYP 1 -#define INHYP 2 -#define INCONCL 3 -#define MAINCONCL 4 -#define INTYPE 5 -#define NOTFOUND 6 - -#define BEFORE 0 -#define HERE 1 -#define AFTER 2 - - -int where = NOWHERE; -int found = NOTFOUND; -int position = INBODY; -int first_child = BEFORE; -int no_open_source =0; -int tmp_n; -char sep = '"'; -char *xpointer = "#xpointer(1/"; -char *uri; -char *tmp; -%} - - /***************************************************************/ - /* 3. Regular definitions. */ - /***************************************************************/ - -uri [^"]+ -digits [0-9]+ - - /***************************************************************/ - /* 4. Rules. */ - /***************************************************************/ - - - -%% - -"" { - position = INTYPE; - first_child = BEFORE; - } - -"" { - if (position == INHYP) - { - no_open_source--; - /* printf("source %d\n", no_open_source); */ - if (no_open_source == 0) - { position = INTYPE; - first_child = BEFORE; }; - }; - } - - -"" { - position = INBODY; - } - -.|\n { - } - -"\n\n"); - printf("\n"); - printf("\n"); - print_all(); - printf("\n"); - printf("\n"); - } - -search(uri,first_child,position) -char *uri; -int first_child; -int position; -{ - if (first_child == HERE) - { - if (position == INHYP) - found = search_bucket(uri,MAINHYP); - else if (position == INCONCL) - found = search_bucket(uri,MAINCONCL); - /* if (found == NOTFOUND) - printf( "pos = %d, uri = %s\n", MAINCONCL, uri); */ - } - else found = search_bucket(uri,position); - /* if (found == NOTFOUND) - printf( "pos = %d, uri = %s\n", position, uri); */ - } - -int yywrap() { - return 1; - } - - - - - - - diff --git a/helm/metadata/create4/METADATA/sthandler.c b/helm/metadata/create4/METADATA/sthandler.c deleted file mode 100644 index 6eb2b0eee..000000000 --- a/helm/metadata/create4/METADATA/sthandler.c +++ /dev/null @@ -1,263 +0,0 @@ -/*********************************************************************/ -/* Copyright (C) 2000, HELM Team */ -/* */ -/* This file is part of HELM, an Hypertextual, Electronic */ -/* Library of Mathematics, developed at the Computer Science */ -/* Department, University of Bologna, Italy. */ -/* */ -/* HELM is free software; you can redistribute it and/or */ -/* modify it under the terms of the GNU General Public License */ -/* as published by the Free Software Foundation; either version 2 */ -/* of the License, or (at your option) any later version. */ -/* */ -/* HELM is distributed in the hope that it will be useful, */ -/* but WITHOUT ANY WARRANTY; without even the implied warranty of */ -/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */ -/* GNU General Public License for more details. */ -/* */ -/* You should have received a copy of the GNU General Public License */ -/* along with HELM; if not, write to the Free Software */ -/* Foundation, Inc., 59 Temple Place - Suite 330, Boston, */ -/* MA 02111-1307, USA. */ -/* */ -/* For details, see the HELM World-Wide-Web page, */ -/* http://cs.unibo.it/helm/. */ - /*********************************************************************/ - -/****************************************************************/ -/* STHANDLER.C */ -/****************************************************************/ -/* This module supplies routines for symbol table handling. */ -/* - init_symbol_table(): it initializes the symbol table */ -/* to void. */ -/* - search_bucket(): it searches the symbol table for the */ -/* bucket containing a given identifier, and */ -/* inserts it if it is not present; */ -/****************************************************************/ -/* First draft 11/12/2001, by Andrea Asperti */ -/****************************************************************/ - -/****************************************************************/ -/* 1. Inclusion of header files. */ -/****************************************************************/ - -#include -#include - -/****************************************************************/ -/* 2. Declarations */ -/****************************************************************/ - - -#define DICTSIZE 211 -#define HASH1 4 -#define HASH2 0xf0000000 -#define HASH3 24 -#define EOS '\0' - -#define INBODY 0 -#define MAINHYP 1 -#define INHYP 2 -#define INCONCL 3 -#define MAINCONCL 4 -#define INTYPE 5 -#define NOTFOUND 6 - -/****************************************************************/ -/* 3. Types. */ -/****************************************************************/ - -struct st_bucket { - char *id; - /* identifier */ - struct st_bucket *next_st_bucket; - /* next bucket in the list */ - struct st_bucket *all_next; - /* all buckets in symbol - table are linked together */ - int pos[5]; - - }; - -struct st_bucket *dictionary[DICTSIZE]; - /* pointers to bucket lists */ - -/****************************************************************/ -/* 4. Definitions of functions to be exported. */ -/****************************************************************/ - -struct st_bucket *all; - - /* The following function initializes the symbol table to NULL */ -void init_symbol_table() -{ - struct st_bucket *st; - int i; - - /* initialize the dictionary */ - for (i = 0; i < DICTSIZE; i++) - dictionary[i] = NULL; - all = NULL; -} - - /* The following function searches the symbol table for an identifier */ - /* and inserts it if it is not present. - /* The bucket associated with the given identifier */ - /* becomes the first one in its list. */ - -search_bucket(id, where) - char *id; - /* identifier */ - int where; -{ - int dict_index; - /* value returned by the */ - /* hash function */ - struct st_bucket - *prev, - *curr; - - struct st_bucket *st; - - /* apply the hash function */ - dict_index = hash_pjw(id); - /* printf( "%d\n", dict_index); */ - - /* scan the bucket list indicated by the hash function */ - prev = curr = dictionary[dict_index]; - while ((curr != NULL) && (strcmp(id, curr->id))) - { - prev = curr; - curr = curr->next_st_bucket; - } - if (curr == NULL) - /* the identifier is not in the list */ - { - allocate_bucket(&st,id,where); - move_bucket(st,dict_index); - return NOTFOUND; - } - else - /* printf("uno=%s\n", id); - printf("st=%s\n", curr->id); */ - - /* the identifier is already in the list */ - { - /* st = curr; */ - curr->pos[where] = 1; - if (where >= 1) - curr->pos[0] = 0; /* it will never be set again to 1 */ - if (prev != curr) - /* the identifier is not in the first position */ - { - prev->next_st_bucket = curr->next_st_bucket; - move_bucket(curr, - dict_index); - }; - return where; - } -} - -print_all() -{ - int i; - struct st_bucket *curr; - curr = all; - - while (curr != NULL) - { - for (i = 0; i < 5; ++i) - if (curr->pos[i] == 1) - print_one(curr->id,i); - curr = curr->all_next; - } -} - - -/****************************************************************/ -/* 5. Definitions of functions local to the module. */ -/****************************************************************/ - -print_one(uri,pos) - char *uri; - int pos; -{ - printf("\n"); - printf("\n"); - printf("\n"); -} - - /* The following function allocates a bucket for an identifier. */ -allocate_bucket(st, id, where) - struct st_bucket - **st; - /* pointer to the bucket to be */ - /* allocated */ - char *id; - /* identifier */ - int where; -{ - int i; - - *st = (struct st_bucket *)malloc(sizeof(struct st_bucket)); - (*st)->id = (char *)malloc(sizeof('a')*strlen(id)); - strcpy((*st)->id,id); - (*st)->next_st_bucket = NULL; - (*st)->all_next = all; - all = *st; - for (i = 0; i < 5; ++i) - (*st)->pos[i] = 0; - (*st)->pos[where] = 1; -} - - /* The following function moves a bucket to the head of the */ - /* list in which it lies. */ -move_bucket(st, dict_index) - struct st_bucket - *st; - /* pointer to the bucket to */ - /* be moved */ - int dict_index; - /* index corresponding to */ - /* the list in which the */ - /* bucket lies */ -{ - st->next_st_bucket = dictionary[dict_index]; - dictionary[dict_index] = st; -} - - /* The following function implements Weinberger's hash function. */ -int -hash_pjw(id) - char *id; - /* identifier to be hashed */ -{ - unsigned h, - g; - - for (h = 0; *id != EOS; id++) - { - h = (h << HASH1) + (*id); - if (g = h & HASH2) - h = h ^ (g >> HASH3) ^ g; - } - return(h % DICTSIZE); -} - - - - - diff --git a/helm/metadata/create4/METADATA/sthandler.h b/helm/metadata/create4/METADATA/sthandler.h deleted file mode 100644 index d4e17d587..000000000 --- a/helm/metadata/create4/METADATA/sthandler.h +++ /dev/null @@ -1,8 +0,0 @@ -/****************************************************************/ -/* STHANDLER.H */ -/****************************************************************/ - - -extern void init_symbol_table(); -extern void print_all(); -extern int search_bucket(); diff --git a/helm/metadata/create4/Makefile b/helm/metadata/create4/Makefile deleted file mode 100644 index 30f0540d3..000000000 --- a/helm/metadata/create4/Makefile +++ /dev/null @@ -1,27 +0,0 @@ -all: - @echo Available targets: - @echo " forward, backward, compress, clean-forward, clean-backward" - -forward: - time for i in `cat pluto` ; do (cd tmp ; wget -t 1 "http://phd.cs.unibo.it:8081/getxml?format=gz&uri=$$i") ; mkdir -p forward/`dirname $$i | sed "s/cic:\///"` ; zcat tmp/`basename $$i` | METADATA/meta `basename $$i` > forward/`echo $$i | sed "s/cic:\///"` ; rm tmp/`basename $$i` ; done > log 2>&1 - (cd forward ; ../mkindex.sh forward) - -backward: - time for i in `cat pluto` ; do touch/touch.opt $$i ; done - find forward -type f -exec ./invert.pl {} \; - find backward -type f -exec ./fix_rdf.pl {} \; - (cd backward ; ../mkindex.sh backward) - -compress: - find forward -name "*.xml" -exec gzip {} \; - find backward -name "*.xml" -exec gzip {} \; - (cd forward ; ../mkindex.sh forward) - (cd backward ; ../mkindex.sh backward) - -clean-forward: - rm -rf forward/* - -clean-backward: - rm -rf backward/* - -.PHONY: all forward backward compress clean-forward clean-backward diff --git a/helm/metadata/create_V7_mowgli/.cvsignore b/helm/metadata/create_V7_mowgli/.cvsignore deleted file mode 100644 index d6d5bf69d..000000000 --- a/helm/metadata/create_V7_mowgli/.cvsignore +++ /dev/null @@ -1,2 +0,0 @@ -backward -forward diff --git a/helm/metadata/create_V7_mowgli/METADATA/.cvsignore b/helm/metadata/create_V7_mowgli/METADATA/.cvsignore deleted file mode 100644 index 1d5ca6be6..000000000 --- a/helm/metadata/create_V7_mowgli/METADATA/.cvsignore +++ /dev/null @@ -1,4 +0,0 @@ -meta -meta_ind -lex.yy.c -lex.yy_ind.c diff --git a/helm/metadata/create_V7_mowgli/METADATA/Makefile b/helm/metadata/create_V7_mowgli/METADATA/Makefile deleted file mode 100644 index 27b5fe5e6..000000000 --- a/helm/metadata/create_V7_mowgli/METADATA/Makefile +++ /dev/null @@ -1,28 +0,0 @@ -CC = gcc - -all: meta meta_ind - -meta: lex.yy.o sthandler.o - gcc lex.yy.o sthandler.o -lpq -o meta - -meta_ind: lex.yy_ind.o sthandler.o - gcc lex.yy_ind.o sthandler.o -lpq -o meta_ind - -lex.yy.c: meta_lex.l sthandler.h - flex meta_lex.l - -lex.yy_ind.c: meta_lex_ind.l sthandler.h - flex -olex.yy_ind.c meta_lex_ind.l - -sthandler.o: sthandler.c sthandler.h - -lex.yy.o: lex.yy.c sthandler.h - gcc -c lex.yy.c - -lex.yy_ind.o: lex.yy_ind.c sthandler.h - gcc -c lex.yy_ind.c - -clean: - -rm *.o - -rm lex.yy.c lex.yy_ind.c - -rm meta meta_ind diff --git a/helm/metadata/create_V7_mowgli/METADATA/README b/helm/metadata/create_V7_mowgli/METADATA/README deleted file mode 100644 index 6c9fe0bcb..000000000 --- a/helm/metadata/create_V7_mowgli/METADATA/README +++ /dev/null @@ -1,9 +0,0 @@ -Note: - - LetIn e Variabili con corpo: da pensarci (capita solamente una 30ina - di volte... per ora!) Per il momento ci mettiamo una pezza. - - Variabili: non consideriamo l'occorrenza di una variabile come una - vera occorrenza (perche' puo' essere istanziata). In ogni caso c'e' - l'attributo @params che fornisce questa informazione. - - META e IMPLICIT non trattati - - CAST non considerati ==> di default vado in ricorsione sia sul tipo - che sul corpo diff --git a/helm/metadata/create_V7_mowgli/METADATA/meta_lex.l b/helm/metadata/create_V7_mowgli/METADATA/meta_lex.l deleted file mode 100644 index 18ea05cc9..000000000 --- a/helm/metadata/create_V7_mowgli/METADATA/meta_lex.l +++ /dev/null @@ -1,393 +0,0 @@ - /******************************************************************/ - /* Copyright (C) 2000, HELM Team */ - /* */ - /* This file is part of HELM, an Hypertextual, Electronic */ - /* Library of Mathematics, developed at the Computer Science */ - /* Department, University of Bologna, Italy. */ - /* */ - /* HELM is free software; you can redistribute it and/or */ - /* modify it under the terms of the GNU General Public License */ - /* as published by the Free Software Foundation; either version */ - /* 2 of the License, or (at your option) any later version. */ - /* */ - /* HELM is distributed in the hope that it will be useful, */ - /* but WITHOUT ANY WARRANTY; without even the implied warranty of */ - /* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */ - /* GNU General Public License for more details. */ - /* */ - /* You should have received a copy of the GNU General Public */ - /* License along with HELM; if not, write to the Free Software */ - /* Foundation, Inc., 59 Temple Place - Suite 330, Boston, */ - /* MA 02111-1307, USA. */ - /* */ - /* For details, see the HELM World-Wide-Web page, */ - /* http://cs.unibo.it/helm/. */ - /******************************************************************/ - - /***************************************************************/ - /* META_LEXAN */ - /* Automatic Metadata Extractor */ - /* First draft 11/12/2001, by Andrea Asperti */ - /* more bugs added by domenico lordi on mon 12/17/2001 */ - /***************************************************************/ - - /***************************************************************/ - /* 1. Inclusion of header files. */ - /***************************************************************/ - -%{ -#include -#include -#include -#include -#include "sthandler.h" -%} - - /***************************************************************/ - /* 2. Constants and Variables Definitions */ - /***************************************************************/ - -%{ -#define NOWHERE 0 -#define CONST 1 -#define MUTIND 2 -#define MUTCONSTRUCT 3 -#define SORT 4 - -#define INBODY 0 -#define MAINHYP 1 -#define INHYP 2 -#define INCONCL 3 -#define MAINCONCL 4 -#define INTYPE 5 -#define NOTFOUND 6 - -#define HERE 0 -#define AFTER 1 - - -int where = NOWHERE; -int found = NOTFOUND; -int position = INBODY; -int first_child = HERE; -int skip = 0; // boolean to skip the insertion of a URI -int no_open_source = 0; -int spine_depth = 0; -int depth = 0; -int tmp_n; -char sep = '"'; -char *xpointer = "#xpointer(1/"; -char *uri; -char *tmp; -%} - - /***************************************************************/ - /* 3. Regular definitions. */ - /***************************************************************/ - -uri [^"]+ -digits [0-9]+ -value [^"]+ - - /***************************************************************/ - /* 4. Rules. */ - /***************************************************************/ - - -%% - -"]*">"(" "|\n)*""(" "|\n)*"" | -"" { - if (position == INHYP) - { - no_open_source--; - if (no_open_source == 0) - { - position = MAINHYP; - depth++; - first_child = HERE; - } - } - else if (position == MAINHYP) - { - position = INTYPE; - spine_depth++; - depth = 0; - first_child = HERE; - } - /* bug? first_child = HERE; */ - } - - -.|\n { - } - -" \n"); - exit(1); - } - - /* - * begin, by setting the parameters for a backend connection if the - * parameters are null, then the system will try to use reasonable - * defaults by looking up environment variables or, failing that, - * using hardwired constants - */ - - /* make a connection to the database */ - conn = PQconnectdb("user=helm dbname=mowgli_test"); - - /* - * check to see that the backend connection was successfully made - */ - if (PQstatus(conn) == CONNECTION_BAD) - { - fprintf(stderr, "Connection to database '%s' failed.\n", dbName); - fprintf(stderr, "%s", PQerrorMessage(conn)); - exit_nicely(conn); - } - - /* debug = fopen("/tmp/trace.out","w"); */ - /* PQtrace(conn, debug); */ - - /* initialize the symbol table */ - init_symbol_table(); - - // We process the body - if (!stat(argv[2],&buf)) - { - yyin = fopen(argv[2], "r"); - position = INBODY; - yylex(); - fclose(yyin); - } - - // We process the type - yyin = fopen(argv[3], "r"); - position = INTYPE; - first_child = HERE; - no_open_source = 0; - spine_depth = 0; - depth = 0; - yylex(); - fclose(yyin); - print_all(argv[1],conn); - - return 0; -} - - -search(uri,first_child,position,depth) -char *uri; -int first_child; -int position; -{ - if (position == MAINHYP) - { - if (first_child == HERE) - found = search_bucket(uri,MAINHYP,depth); - else - found = search_bucket(uri,INHYP,0); - } - else if (position == INCONCL) - { - if (first_child == HERE) - found = search_bucket(uri,MAINCONCL,depth); - else - found = search_bucket(uri,INCONCL,0); - } - - else - found = search_bucket(uri,position,depth); - /* - if (found == NOTFOUND) - fprintf(stderr,"here = %d, pos = %d, uri = %s\n", first_child,position, uri); */ -} -/* - (first_child == HERE) - { - if (position == MAINHYP) - found = search_bucket(uri,MAINHYP,depth); - else if (position == INCONCL) - found = search_bucket(uri,MAINCONCL,0); - else if (position == INHYP) - found = search_bucket(uri,INHYP,0); - if (found == NOTFOUND) - printf( "pos = %d, uri = %s\n", MAINCONCL, uri); - } - else if ((position == MAINHYP) && (first_child == AFTER)) - found = search_bucket(uri,INHYP,0); - else found = search_bucket(uri,position,0); - if (found == NOTFOUND) - printf( "pos = %d, uri = %s\n", position, uri); - } */ - -int yywrap() { - return 1; - } - - - - diff --git a/helm/metadata/create_V7_mowgli/METADATA/meta_lex_ind.l b/helm/metadata/create_V7_mowgli/METADATA/meta_lex_ind.l deleted file mode 100644 index 31e1416f0..000000000 --- a/helm/metadata/create_V7_mowgli/METADATA/meta_lex_ind.l +++ /dev/null @@ -1,390 +0,0 @@ - /******************************************************************/ - /* Copyright (C) 2000, HELM Team */ - /* */ - /* This file is part of HELM, an Hypertextual, Electronic */ - /* Library of Mathematics, developed at the Computer Science */ - /* Department, University of Bologna, Italy. */ - /* */ - /* HELM is free software; you can redistribute it and/or */ - /* modify it under the terms of the GNU General Public License */ - /* as published by the Free Software Foundation; either version */ - /* 2 of the License, or (at your option) any later version. */ - /* */ - /* HELM is distributed in the hope that it will be useful, */ - /* but WITHOUT ANY WARRANTY; without even the implied warranty of */ - /* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */ - /* GNU General Public License for more details. */ - /* */ - /* You should have received a copy of the GNU General Public */ - /* License along with HELM; if not, write to the Free Software */ - /* Foundation, Inc., 59 Temple Place - Suite 330, Boston, */ - /* MA 02111-1307, USA. */ - /* */ - /* For details, see the HELM World-Wide-Web page, */ - /* http://cs.unibo.it/helm/. */ - /******************************************************************/ - - /***************************************************************/ - /* META_LEXAN */ - /* Automatic Metadata Extractor */ - /* First draft 11/12/2001, by Andrea Asperti */ - /* more bugs added by domenico lordi on mon 12/17/2001 */ - /***************************************************************/ - - /***************************************************************/ - /* 1. Inclusion of header files. */ - /***************************************************************/ - -%{ -#include -#include -#include -#include -#include "sthandler.h" -%} - - /***************************************************************/ - /* 2. Constants and Variables Definitions */ - /***************************************************************/ - -%{ -#define NOWHERE 0 -#define CONST 1 -#define MUTIND 2 -#define MUTCONSTRUCT 3 -#define SORT 4 - -#define INBODY 0 -#define MAINHYP 1 -#define INHYP 2 -#define INCONCL 3 -#define MAINCONCL 4 -#define INTYPE 5 -#define NOTFOUND 6 - -#define HERE 0 -#define AFTER 1 - - -int where = NOWHERE; -int found = NOTFOUND; -int position = INBODY; -int first_child = HERE; -int skip = 0; // boolean to skip the insertion of a URI -int no_open_source =0; -int spine_depth = 0; -int depth = 0; -int tmp_n; -int inductive_type = 0; -int constructor = 0; -int deep_type = 0; -char sep = '"'; -char *xpointer = "#xpointer(1/"; -char *uri; -char *tmp; -char *source_uri; -char *source_uri_prefix; -PGconn *conn; -%} - - /***************************************************************/ - /* 3. Regular definitions. */ - /***************************************************************/ - -uri [^"]+ -digits [0-9]+ -value [^"]+ - - /***************************************************************/ - /* 4. Rules. */ - /***************************************************************/ - - -%% - -"" { tmp = (char *)malloc(sizeof('a')*128); - strcpy(source_uri,source_uri_prefix); - sprintf(tmp,"#xpointer(1/%d)", inductive_type); - strcat(source_uri,tmp); - /* fprintf(stderr,"cinque"); */ - free(tmp); - print_all(source_uri,conn); - /* print_file(); */ - } - -"" { tmp = (char *)malloc(sizeof('a')*128); - strcpy(source_uri,source_uri_prefix); - sprintf(tmp,"#xpointer(1/%d/%d)",inductive_type,constructor); - strcat(source_uri,tmp); - free(tmp); - print_all(source_uri,conn); - /* print_file(); */ - } - -"" | -"" { - if (position == INHYP) - { - no_open_source--; - if (no_open_source == 0) - { - position = MAINHYP; - depth++; - first_child = HERE; - } - } - else if (position == MAINHYP) - { - position = INTYPE; - spine_depth++; - depth = 0; - first_child = HERE; - } - } - - -.|\n { - } - -" \n"); - exit(1); - } - - /* - * begin, by setting the parameters for a backend connection if the - * parameters are null, then the system will try to use reasonable - * defaults by looking up environment variables or, failing that, - * using hardwired constants - */ - - /* make a connection to the database */ - conn = PQconnectdb("user=helm dbname=mowgli"); - - /* - * check to see that the backend connection was successfully made - */ - if (PQstatus(conn) == CONNECTION_BAD) - { - fprintf(stderr, "Connection to database '%s' failed.\n", dbName); - fprintf(stderr, "%s", PQerrorMessage(conn)); - exit_nicely(conn); - } - - /* debug = fopen("/tmp/trace.out","w"); */ - /* PQtrace(conn, debug); */ - - source_uri = malloc((sizeof('a')*2000)); - source_uri_prefix=argv[1]; - /* fprintf(stderr,"qua"); */ - yyin = fopen(argv[2], "r"); - yylex(); - - return 0; -} - -search(uri,first_child,position,depth) -char *uri; -int first_child; -int position; -{ - if (position == MAINHYP) - { - if (first_child == HERE) - found = search_bucket(uri,MAINHYP,depth); - else - found = search_bucket(uri,INHYP,0); - } - else if (position == INCONCL) - { - if (first_child == HERE) - found = search_bucket(uri,MAINCONCL,depth); - else - found = search_bucket(uri,INCONCL,0); - } - - else - found = search_bucket(uri,position,depth); - if (found == NOTFOUND) - printf( "pos = %d, uri = %s\n", position, uri); -} - - -int yywrap() { - return 1; - } - - - - diff --git a/helm/metadata/create_V7_mowgli/METADATA/sthandler.c b/helm/metadata/create_V7_mowgli/METADATA/sthandler.c deleted file mode 100644 index 94b87c0c4..000000000 --- a/helm/metadata/create_V7_mowgli/METADATA/sthandler.c +++ /dev/null @@ -1,469 +0,0 @@ -/*********************************************************************/ -/* Copyright (C) 2000, HELM Team */ -/* */ -/* This file is part of HELM, an Hypertextual, Electronic */ -/* Library of Mathematics, developed at the Computer Science */ -/* Department, University of Bologna, Italy. */ -/* */ -/* HELM is free software; you can redistribute it and/or */ -/* modify it under the terms of the GNU General Public License */ -/* as published by the Free Software Foundation; either version 2 */ -/* of the License, or (at your option) any later version. */ -/* */ -/* HELM is distributed in the hope that it will be useful, */ -/* but WITHOUT ANY WARRANTY; without even the implied warranty of */ -/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */ -/* GNU General Public License for more details. */ -/* */ -/* You should have received a copy of the GNU General Public License */ -/* along with HELM; if not, write to the Free Software */ -/* Foundation, Inc., 59 Temple Place - Suite 330, Boston, */ -/* MA 02111-1307, USA. */ -/* */ -/* For details, see the HELM World-Wide-Web page, */ -/* http://cs.unibo.it/helm/. */ - /*********************************************************************/ - -/****************************************************************/ -/* STHANDLER.C */ -/****************************************************************/ -/* This module supplies routines for symbol table handling. */ -/* - init_symbol_table(): it initializes the symbol table */ -/* to void. */ -/* - search_bucket(): it searches the symbol table for the */ -/* bucket containing a given identifier, and */ -/* inserts it if it is not present; */ -/****************************************************************/ -/* First draft 11/12/2001, by Andrea Asperti */ -/****************************************************************/ - -/****************************************************************/ -/* 1. Inclusion of header files. */ -/****************************************************************/ - -#include -#include -#include - -/****************************************************************/ -/* 2. Declarations */ -/****************************************************************/ - - -#define DICTSIZE 211 -#define HASH1 4 -#define HASH2 0xf0000000 -#define HASH3 24 -#define EOS '\0' - -#define INBODY 0 -#define MAINHYP 1 -#define INHYP 2 -#define INCONCL 3 -#define MAINCONCL 4 -#define INTYPE 5 -#define NOTFOUND 6 - -/****************************************************************/ -/* 3. Types. */ -/****************************************************************/ - -struct int_list { - int val; - struct int_list *next; - }; - -struct st_bucket { - char *id; - /* identifier */ - int main_depth; - struct int_list *depths; - struct st_bucket *next_st_bucket; - /* next bucket in the list */ - struct st_bucket *all_next; - /* all buckets in symbol - table are linked together */ - int pos[5]; - - }; - -struct st_bucket *dictionary[DICTSIZE]; - /* pointers to bucket lists */ - -/****************************************************************/ -/* 4. Local functions. */ -/****************************************************************/ -struct int_list *add(struct int_list *,int); - -/****************************************************************/ -/* 5. Definitions of functions to be exported. */ -/****************************************************************/ - -struct st_bucket *all; - - /* The following function initializes the symbol table to NULL */ -void init_symbol_table() -{ - struct st_bucket *st; - int i; - - /* initialize the dictionary */ - for (i = 0; i < DICTSIZE; i++) - dictionary[i] = NULL; - all = NULL; -} - - /* The following function searches the symbol table for an identifier */ - /* and inserts it if it is not present. - /* The bucket associated with the given identifier */ - /* becomes the first one in its list. */ - -search_bucket(id, where, depth) - char *id; - /* identifier */ - int where; - int depth; -{ - int dict_index; - /* value returned by the */ - /* hash function */ - struct st_bucket - *prev, - *curr; - - struct st_bucket *st; - - /* apply the hash function */ - dict_index = hash_pjw(id); - /* fprintf(stderr,"%d\n", dict_index); */ - - /* scan the bucket list indicated by the hash function */ - prev = curr = dictionary[dict_index]; - while ((curr != NULL) && (strcmp(id, curr->id))) - { - prev = curr; - curr = curr->next_st_bucket; - } - if (curr == NULL) - /* the identifier is not in the list */ - { - allocate_bucket(&st,id,where); - if (where == MAINCONCL) - st->main_depth = depth; - else if (where == MAINHYP) - st->depths = add(st->depths,depth); - move_bucket(st,dict_index); - return NOTFOUND; - } - else - /* - printf("uno=%s\n", id); - printf("st=%s\n", curr->id); fflush(stdout) */ - - /* the identifier is already in the list */ - { - /* st = curr; */ - curr->pos[where] = 1; - if (where >= 1) - curr->pos[INBODY] = 0; /* it will never be set again to 1 */ - if (where == MAINHYP) - curr->depths=add(curr->depths,depth); - else if (where == MAINCONCL) - curr->main_depth = depth; - if (prev != curr) - /* the identifier is not in the first position */ - { - prev->next_st_bucket = curr->next_st_bucket; - move_bucket(curr,dict_index); - }; - return where; - } -} - -print_all(about,conn) - char *about; - PGconn *conn; -{ - - int i; - struct st_bucket *curr; - curr = all; - while (curr != NULL) - { - for (i = 0; i < 5; ++i) - if ((curr->pos[i]) == 1) - { - if (i == MAINHYP) - print_mainhyp(about,conn,curr->id,curr->depths); - else if (i == MAINCONCL) - print_mainconcl(about,conn,curr->id,curr->main_depth); - else - print_one(conn,about,curr->id,i); - } - curr = curr->all_next; - } -} - - -/****************************************************************/ -/* 5. Definitions of functions local to the module. */ -/****************************************************************/ - -void exit_nicely(PGconn *conn) -{ - PQfinish(conn); - exit(1); -} - -struct int_list *add(l,m) - struct int_list *l; - int m; -{ - struct int_list *curr; - /* scan the list looking for m */ - curr = l; - while ((curr != NULL) && (m != (curr->val))) - curr = curr->next; - if (curr == NULL) - /* m is not in the list */ - { - curr = (struct int_list *)malloc(sizeof(struct int_list)); - curr->val = m; - curr->next = l; - return curr; - } - else - return l; - -} - -print_mainhyp(about,conn,uri,l) - char *about; - PGconn *conn; - char *uri; - struct int_list *l; -{ - PGresult *res; - char *command = (char *)malloc((sizeof('a')*200)); - struct int_list *curr; - curr = l; - if (!strcmp(uri,"Rel")) - { - /* scan the list */ - while (curr != NULL) - { - size_t len = strlen(about) + 1; - char *qabout = malloc (sizeof(char) * len * 2); - PQescapeString(qabout,about,len); - sprintf(command,"INSERT INTO refRel values ('%s', 'http://www.cs.unibo.it/helm/schemas/schema-helm#MainHypothesis', %d)",qabout,curr->val); - /* fprintf(stderr, "%s\n", command); */ - res = PQexec(conn, command); - if (!res || PQresultStatus(res) != PGRES_COMMAND_OK) - { - fprintf(stderr, "BEGIN command failed\n"); - PQclear(res); - exit_nicely(conn); - } - curr = curr->next; - } - } - else if ((!strcmp(uri,"Prop")) || (!strcmp(uri,"Type")) || - (!strcmp(uri,"Set"))) - { - /* scan the list */ - while (curr != NULL) - { - size_t len = strlen(about) + 1; - char *qabout = malloc (sizeof(char) * len * 2); - PQescapeString(qabout,about,len); - sprintf(command,"INSERT INTO refSort values ('%s', 'http://www.cs.unibo.it/helm/schemas/schema-helm#MainHypothesis', %d, '%s')",qabout,curr->val,uri); - /* fprintf(stderr, "%s\n", command); */ - res = PQexec(conn, command); - if (!res || PQresultStatus(res) != PGRES_COMMAND_OK) - { - fprintf(stderr, "BEGIN command failed\n"); - PQclear(res); - exit_nicely(conn); - } - curr = curr->next; - } - } - else - { - /* scan the list */ - while (curr != NULL) - { - size_t len = strlen(about) + 1; - char *qabout = malloc (sizeof(char) * len * 2); - char *quri; - PQescapeString(qabout,about,len); - len = strlen(uri) + 1; - quri = malloc (sizeof(char) * len * 2); - PQescapeString(quri,uri,len); - sprintf(command,"INSERT INTO refObj values ('%s', '%s', 'http://www.cs.unibo.it/helm/schemas/schema-helm#MainHypothesis', %d)",qabout,quri,curr->val); - /* fprintf(stderr, "%s\n", command); */ - res = PQexec(conn, command); - if (!res || PQresultStatus(res) != PGRES_COMMAND_OK) - { - fprintf(stderr, "BEGIN command failed\n"); - PQclear(res); - exit_nicely(conn); - } - curr = curr->next; - } - } -} - -print_mainconcl(about,conn,uri,depth) - char *about; - PGconn *conn; - char *uri; - int depth; - -{ - PGresult *res; - char *command = (char *)malloc((sizeof('a')*200)); - /* fprintf(stderr,"about = %s\n",about); */ - if (!strcmp(uri,"Rel")) - { - size_t len = strlen(about) + 1; - char *qabout = malloc (sizeof(char) * len * 2); - PQescapeString(qabout,about,len); - sprintf(command,"INSERT INTO refRel values ('%s', 'http://www.cs.unibo.it/helm/schemas/schema-helm#MainConclusion', %d)",qabout,depth); - /* fprintf(stderr, "%s\n", command); */ - res = PQexec(conn, command); - } - else if ((!strcmp(uri,"Prop")) || (!strcmp(uri,"Type")) || - (!strcmp(uri,"Set"))) - { - size_t len = strlen(about) + 1; - char *qabout = malloc (sizeof(char) * len * 2); - PQescapeString(qabout,about,len); - sprintf(command,"INSERT INTO refSort values ('%s', 'http://www.cs.unibo.it/helm/schemas/schema-helm#MainConclusion', %d, '%s')",qabout,depth,uri); - /* fprintf(stderr, "%s\n", command); */ - res = PQexec(conn, command); - } - else - { - size_t len = strlen(about) + 1; - char *qabout = malloc (sizeof(char) * len * 2); - char *quri; - PQescapeString(qabout,about,len); - len = strlen(uri) + 1; - quri = malloc (sizeof(char) * len * 2); - PQescapeString(quri,uri,len); - sprintf(command,"INSERT INTO refObj values ('%s', '%s','http://www.cs.unibo.it/helm/schemas/schema-helm#MainConclusion', %d)",qabout,quri,depth); - /* fprintf(stderr, "%s\n", command); */ - res = PQexec(conn, command); - } - if (!res || PQresultStatus(res) != PGRES_COMMAND_OK) - { - fprintf(stderr, "BEGIN command failed\n"); - PQclear(res); - exit_nicely(conn); - } - /* fprintf(stderr,"FINITO\n"); */ -} - -// dome: cambiata per usare il modello con position -print_one(conn,about,uri,pos) - PGconn *conn; - char *about, - *uri; - int pos; -{ - PGresult *res; - char *command = (char *)malloc((sizeof('a')*200)); - char *position = (char *)malloc((sizeof('a')*20)); - size_t len = strlen(about) + 1; - char *qabout = malloc (sizeof(char) * len * 2); - char *quri; - PQescapeString(qabout,about,len); - len = strlen(uri) + 1; - quri = malloc (sizeof(char) * len * 2); - PQescapeString(quri,uri,len); - if (pos == INBODY) - position="InBody"; - else if (pos == MAINHYP) - position="MainHypothesis"; /* This should never happen */ - else if (pos == INHYP) - position="InHypothesis"; - else if (pos == INCONCL) - position="InConclusion"; - else if (pos == MAINCONCL) - position="MainConclusion"; /* This should never happen */ - sprintf(command,"INSERT INTO refObj values ('%s', '%s', 'http://www.cs.unibo.it/helm/schemas/schema-helm#%s')",qabout,quri,position); - /* fprintf(stderr, "%s\n", command); */ - res = PQexec(conn, command); - if (!res || PQresultStatus(res) != PGRES_COMMAND_OK) - { - fprintf(stderr, "BEGIN command failed\n"); - PQclear(res); - exit_nicely(conn); - } -} - - /* The following function allocates a bucket for an identifier. */ -allocate_bucket(st, id, where) - struct st_bucket - **st; - /* pointer to the bucket to be */ - /* allocated */ - char *id; - /* identifier */ - int where; -{ - int i; - - *st = (struct st_bucket *)malloc(sizeof(struct st_bucket)); - (*st)->id = (char *)malloc(sizeof('a')*(strlen(id) + 1)); - strcpy((*st)->id,id); - (*st)->main_depth = 0; - (*st)->depths = NULL; - (*st)->next_st_bucket = NULL; - (*st)->all_next = all; - all = *st; - for (i = 0; i < 5; ++i) - (*st)->pos[i] = 0; - (*st)->pos[where] = 1; -} - - /* The following function moves a bucket to the head of the */ - /* list in which it lies. */ -move_bucket(st, dict_index) - struct st_bucket - *st; - /* pointer to the bucket to */ - /* be moved */ - int dict_index; - /* index corresponding to */ - /* the list in which the */ - /* bucket lies */ -{ - st->next_st_bucket = dictionary[dict_index]; - dictionary[dict_index] = st; -} - - /* The following function implements Weinberger's hash function. */ -int -hash_pjw(id) - char *id; - /* identifier to be hashed */ -{ - unsigned h, - g; - - for (h = 0; *id != EOS; id++) - { - h = (h << HASH1) + (*id); - if (g = h & HASH2) - h = h ^ (g >> HASH3) ^ g; - } - return(h % DICTSIZE); -} - - - - - - diff --git a/helm/metadata/create_V7_mowgli/METADATA/sthandler.h b/helm/metadata/create_V7_mowgli/METADATA/sthandler.h deleted file mode 100644 index e8ee4849f..000000000 --- a/helm/metadata/create_V7_mowgli/METADATA/sthandler.h +++ /dev/null @@ -1,8 +0,0 @@ -/****************************************************************/ -/* STHANDLER.H */ -/****************************************************************/ - - -extern void init_symbol_table(); -extern void print_all(char *, PGconn *); -extern int search_bucket(char *, int, int); diff --git a/helm/metadata/create_V7_mowgli/METADATA/sthandler_ind.c b/helm/metadata/create_V7_mowgli/METADATA/sthandler_ind.c deleted file mode 100644 index bfdc795d5..000000000 --- a/helm/metadata/create_V7_mowgli/METADATA/sthandler_ind.c +++ /dev/null @@ -1,423 +0,0 @@ -/*********************************************************************/ -/* Copyright (C) 2000, HELM Team */ -/* */ -/* This file is part of HELM, an Hypertextual, Electronic */ -/* Library of Mathematics, developed at the Computer Science */ -/* Department, University of Bologna, Italy. */ -/* */ -/* HELM is free software; you can redistribute it and/or */ -/* modify it under the terms of the GNU General Public License */ -/* as published by the Free Software Foundation; either version 2 */ -/* of the License, or (at your option) any later version. */ -/* */ -/* HELM is distributed in the hope that it will be useful, */ -/* but WITHOUT ANY WARRANTY; without even the implied warranty of */ -/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */ -/* GNU General Public License for more details. */ -/* */ -/* You should have received a copy of the GNU General Public License */ -/* along with HELM; if not, write to the Free Software */ -/* Foundation, Inc., 59 Temple Place - Suite 330, Boston, */ -/* MA 02111-1307, USA. */ -/* */ -/* For details, see the HELM World-Wide-Web page, */ -/* http://cs.unibo.it/helm/. */ - /*********************************************************************/ - -/****************************************************************/ -/* STHANDLER.C */ -/****************************************************************/ -/* This module supplies routines for symbol table handling. */ -/* - init_symbol_table(): it initializes the symbol table */ -/* to void. */ -/* - search_bucket(): it searches the symbol table for the */ -/* bucket containing a given identifier, and */ -/* inserts it if it is not present; */ -/****************************************************************/ -/* First draft 11/12/2001, by Andrea Asperti */ -/****************************************************************/ - -/****************************************************************/ -/* 1. Inclusion of header files. */ -/****************************************************************/ - -#include -#include - -/****************************************************************/ -/* 2. Declarations */ -/****************************************************************/ - - -#define DICTSIZE 211 -#define HASH1 4 -#define HASH2 0xf0000000 -#define HASH3 24 -#define EOS '\0' - -#define INBODY 0 -#define MAINHYP 1 -#define INHYP 2 -#define INCONCL 3 -#define MAINCONCL 4 -#define INTYPE 5 -#define NOTFOUND 6 - -/****************************************************************/ -/* 3. Types. */ -/****************************************************************/ - -struct int_list { - int val; - struct int_list *next; - }; - -struct st_bucket { - char *id; - /* identifier */ - int main_depth; - struct int_list *depths; - struct st_bucket *next_st_bucket; - /* next bucket in the list */ - struct st_bucket *all_next; - /* all buckets in symbol - table are linked together */ - int pos[5]; - - }; - -struct st_bucket *dictionary[DICTSIZE]; - /* pointers to bucket lists */ - -/****************************************************************/ -/* 4. Local functions. */ -/****************************************************************/ -struct int_list *add(struct int_list *,int); - -/****************************************************************/ -/* 5. Definitions of functions to be exported. */ -/****************************************************************/ - -struct st_bucket *all; - - /* The following function initializes the symbol table to NULL */ -void init_symbol_table() -{ - struct st_bucket *st; - int i; - - /* initialize the dictionary */ - for (i = 0; i < DICTSIZE; i++) - dictionary[i] = NULL; - all = NULL; -} - - /* The following function searches the symbol table for an identifier */ - /* and inserts it if it is not present. - /* The bucket associated with the given identifier */ - /* becomes the first one in its list. */ - -search_bucket(id, where, depth) - char *id; - /* identifier */ - int where; - int depth; -{ - int dict_index; - /* value returned by the */ - /* hash function */ - struct st_bucket - *prev, - *curr; - - struct st_bucket *st; - - /* apply the hash function */ - dict_index = hash_pjw(id); - /* fprintf(stderr,"%d\n", dict_index); fflush(stdout); */ - - /* scan the bucket list indicated by the hash function */ - prev = curr = dictionary[dict_index]; - while ((curr != NULL) && (strcmp(id, curr->id))) - { - prev = curr; - curr = curr->next_st_bucket; - } - if (curr == NULL) - /* the identifier is not in the list */ - { - allocate_bucket(&st,id,where); - if (where == MAINCONCL) - st->main_depth = depth; - else if (where == MAINHYP) - st->depths = add(st->depths,depth); - move_bucket(st,dict_index); - return NOTFOUND; - } - else - /* - fprintf(stderr,"uno=%s\n", id); - fprintf(stderr,"st=%s\n", curr->id); fflush(stdout) */ - - /* the identifier is already in the list */ - { - /* st = curr; */ - curr->pos[where] = 1; - if (where >= 1) - curr->pos[INBODY] = 0; /* it will never be set again to 1 */ - if (where == MAINHYP) - curr->depths=add(curr->depths,depth); - else if (where == MAINCONCL) - curr->main_depth = depth; - if (prev != curr) - /* the identifier is not in the first position */ - { - prev->next_st_bucket = curr->next_st_bucket; - move_bucket(curr, - dict_index); - }; - return where; - } -} - -print_all(about,out,outrel,outsort) - char *about; - FILE *out, - *outrel, - *outsort; -{ - - int i; - struct st_bucket *curr; - curr = all; - while (curr != NULL) - { - for (i = 0; i < 5; ++i) - if ((curr->pos[i]) == 1) - { - if (i == MAINHYP) - print_mainhyp(about,out,outrel,outsort,curr->id,curr->depths); - else if (i == MAINCONCL) - print_mainconcl(about,out,outrel,outsort,curr->id,curr->main_depth); - else - print_one(out,curr->id,i); - } - curr = curr->all_next; - } -} - - -/****************************************************************/ -/* 5. Definitions of functions local to the module. */ -/****************************************************************/ - -struct int_list *add(l,m) - struct int_list *l; - int m; -{ - struct int_list *curr; - /* scan the list looking for m */ - curr = l; - while ((curr != NULL) && (m != (curr->val))) - curr = curr->next; - if (curr == NULL) - /* m is not in the list */ - { - curr = (struct int_list *)malloc(sizeof(struct int_list)); - curr->val = m; - curr->next = l; - return curr; - } - else - return l; - -} - -print_mainhyp(about,out,outrel,outsort,uri,l) - char *about; - FILE *out, - *outrel, - *outsort; - char *uri; - struct int_list *l; -{ - struct int_list *curr; - curr = l; - if (!strcmp(uri,"Rel")) - { - /* scan the list */ - while (curr != NULL) - { - fprintf(outrel,"\t\n"); - fprintf(outrel,"\t\t"); - fprintf(outrel,"\n\t\t\t\t"); - fprintf(outrel,"\n\t\t\t\t%d",curr->val); - fprintf(outrel,"\n\t\t\n"); - fprintf(outrel,"\t\n"); - curr = curr->next; - } - } - else if ((!strcmp(uri,"Prop")) || (!strcmp(uri,"Type")) || - (!strcmp(uri,"Set"))) - { - /* scan the list */ - while (curr != NULL) - { - fprintf(outsort,"\t\n"); - fprintf(outsort,"\t\t"); - fprintf(outsort,"\n\t\t\t\t"); - fprintf(outsort,"\n\t\t\t\t",uri); - fprintf(outsort,"\n\t\t\t\t%d",curr->val); - fprintf(outsort,"\n\t\t\n"); - fprintf(outsort,"\t\n"); - curr = curr->next; - } - } - else - { - /* scan the list */ - while (curr != NULL) - { - fprintf(out,"\t\t"); - fprintf(out,"\n\t\t\t\t"); - fprintf(out,"\n\t\t\t\t%d",curr->val); - fprintf(out,"\n\t\t\t\t",uri); - fprintf(out,"\n\t\t\n"); - curr = curr->next; - } - } -} - -print_mainconcl(about,out,outrel,outsort,uri,depth) - char *about; - FILE *out, - *outrel, - *outsort; - char *uri; - int depth; - -{ - if (!strcmp(uri,"Rel")) - { - fprintf(outrel,"\t\n"); - fprintf(outrel,"\t\t"); - fprintf(outrel,"\n\t\t\t\t"); - fprintf(outrel,"\n\t\t\t\t%d",depth); - fprintf(outrel,"\n\t\t\n"); - fprintf(outrel,"\t\n"); - } - else if ((!strcmp(uri,"Prop")) || (!strcmp(uri,"Type")) || - (!strcmp(uri,"Set"))) - { - fprintf(outsort,"\t\n"); - fprintf(outsort,"\t\t"); - fprintf(outsort,"\n\t\t\t\t"); - fprintf(outsort,"\n\t\t\t\t",uri); - fprintf(outsort,"\n\t\t\t\t%d",depth); - fprintf(outsort,"\n\t\t\n"); - fprintf(outsort,"\t\n"); - } - else - { - fprintf(out,"\t\t"); - fprintf(out,"\n\t\t\t\t"); - fprintf(out,"\n\t\t\t\t%d",depth); - fprintf(out,"\n\t\t\t\t",uri); - fprintf(out,"\n\t\t\n"); - } -} - -// dome: cambiata per usare il modello con position -print_one(out,uri,pos) - FILE *out; - char *uri; - int pos; -{ - fprintf(out,"\t\t"); - fprintf(out,"\n\t\t\t\t\n\t\t\t\t\n\t\t\n", uri); - -} - - /* The following function allocates a bucket for an identifier. */ -allocate_bucket(st, id, where) - struct st_bucket - **st; - /* pointer to the bucket to be */ - /* allocated */ - char *id; - /* identifier */ - int where; -{ - int i; - - *st = (struct st_bucket *)malloc(sizeof(struct st_bucket)); - (*st)->id = (char *)malloc(sizeof('a')*(strlen(id) + 1)); - strcpy((*st)->id,id); - (*st)->main_depth = 0; - (*st)->depths = NULL; - (*st)->next_st_bucket = NULL; - (*st)->all_next = all; - all = *st; - for (i = 0; i < 5; ++i) - (*st)->pos[i] = 0; - (*st)->pos[where] = 1; -} - - /* The following function moves a bucket to the head of the */ - /* list in which it lies. */ -move_bucket(st, dict_index) - struct st_bucket - *st; - /* pointer to the bucket to */ - /* be moved */ - int dict_index; - /* index corresponding to */ - /* the list in which the */ - /* bucket lies */ -{ - st->next_st_bucket = dictionary[dict_index]; - dictionary[dict_index] = st; -} - - /* The following function implements Weinberger's hash function. */ -int -hash_pjw(id) - char *id; - /* identifier to be hashed */ -{ - unsigned h, - g; - - for (h = 0; *id != EOS; id++) - { - h = (h << HASH1) + (*id); - if (g = h & HASH2) - h = h ^ (g >> HASH3) ^ g; - } - return(h % DICTSIZE); -} - - - - - - diff --git a/helm/metadata/create_V7_mowgli/METADATA/sthandler_ind.h b/helm/metadata/create_V7_mowgli/METADATA/sthandler_ind.h deleted file mode 100644 index 2536b0f60..000000000 --- a/helm/metadata/create_V7_mowgli/METADATA/sthandler_ind.h +++ /dev/null @@ -1,8 +0,0 @@ -/****************************************************************/ -/* STHANDLER.H */ -/****************************************************************/ - - -extern void init_symbol_table(); -extern void print_all(char *, FILE *, FILE *, FILE *); -extern int search_bucket(char *, int, int); diff --git a/helm/metadata/create_V7_mowgli/Makefile b/helm/metadata/create_V7_mowgli/Makefile deleted file mode 100644 index 4f871e46a..000000000 --- a/helm/metadata/create_V7_mowgli/Makefile +++ /dev/null @@ -1,27 +0,0 @@ -all: - @echo Available targets: - @echo " forward, backward, compress, clean-forward, clean-backward" - -forward: - 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") ; zcat tmp/downloaded.xml.gz > tmp/inductive_type.xml ; METADATA/meta_ind $$i ; rm -f tmp/downloaded.xml.gz tmp/inductive_type.xml; done > log 2>&1 - 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"); zcat tmp/downloaded.xml.gz > tmp/type.xml ; zcat tmp/downloaded_body.xml.gz > tmp/body.xml ; METADATA/meta $$i ; rm -f tmp/downloaded.xml.gz tmp/downloaded_body.xml.gz tmp/type.xml tmp/body.xml ; done > log 2>&1 - -backward: - time for i in `cat all_objects.txt` ; do touch/touch.opt $$i ; done - find forward -type f -exec ./invert.pl {} \; - find backward -type f -exec ./fix_rdf.pl {} \; - (cd backward ; ../mkindex.sh backward) - -compress: - find forward -name "*.xml" -exec gzip {} \; - find backward -name "*.xml" -exec gzip {} \; - (cd forward ; ../mkindex.sh forward) - (cd backward ; ../mkindex.sh backward) - -clean-forward: - rm -rf forward_rel.xml forward_sort.xml forward/* - -clean-backward: - rm -rf backward/* - -.PHONY: all forward backward compress clean-forward clean-backward diff --git a/helm/metadata/create_V7_mowgli/fix_rdf.pl b/helm/metadata/create_V7_mowgli/fix_rdf.pl deleted file mode 100755 index 23b4b7fda..000000000 --- a/helm/metadata/create_V7_mowgli/fix_rdf.pl +++ /dev/null @@ -1,39 +0,0 @@ -#!/usr/bin/perl - -$filename = $uri = $ARGV[0]; -$outputfile = $filename.".xml"; -$uri =~ s/^backward/cic:/; -$uri =~ s/(.*),([^,]*),([^,]*)/$1#xpointer(1\/$2\/$3)/; -$uri =~ s/(.*),([^,]*)/$1#xpointer(1\/$2)/; - -print "Now processing file $filename\n"; - -open(HEADER,">>$outputfile"); -print HEADER < - - - - - - ]> - - -EOT -close(HEADER); - -$quotedfilename = $filename; -$quotedfilename =~ s/'/\\'/g; -$quotedoutputfile = $outputfile; -$quotedoutputfile =~ s/'/\\'/g; -system("cat $quotedfilename >> $quotedoutputfile"); - -open(FOOTER,">>$outputfile"); -print FOOTER < - -EOT -close(FOOTER); - -unlink $filename; diff --git a/helm/metadata/create_V7_mowgli/forward_rel_or_sort_footer.txt b/helm/metadata/create_V7_mowgli/forward_rel_or_sort_footer.txt deleted file mode 100644 index 7edcd7861..000000000 --- a/helm/metadata/create_V7_mowgli/forward_rel_or_sort_footer.txt +++ /dev/null @@ -1 +0,0 @@ - diff --git a/helm/metadata/create_V7_mowgli/forward_rel_or_sort_header.txt b/helm/metadata/create_V7_mowgli/forward_rel_or_sort_header.txt deleted file mode 100644 index 3802d0e3a..000000000 --- a/helm/metadata/create_V7_mowgli/forward_rel_or_sort_header.txt +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - ]> - diff --git a/helm/metadata/create_V7_mowgli/invert.pl b/helm/metadata/create_V7_mowgli/invert.pl deleted file mode 100755 index 902479920..000000000 --- a/helm/metadata/create_V7_mowgli/invert.pl +++ /dev/null @@ -1,40 +0,0 @@ -#!/usr/bin/perl - -my $inputfile = $ARGV[0]; - -print "Now splitting file $inputfile\n"; -open(IN, "<$inputfile") or die "Error opening file $inputfile"; -my $where; -while(($where = ) && not ($where =~ /$/$1/; -while(($line1 = ) && not ($line1 =~ /<\/h:Object>/)) { # ; # - $position = $line2; - chomp($position); - $position =~ s/^[ \t]*[^"]*"&hns;([^"]*)"\/>/$1/; - if ($position eq 'MainHypothesis' || $position eq 'MainConclusion') { - $line3 = ; # value - } - $line4 = ; # - $line5 = ; # - $uri = $line4; - chomp($uri); - $uri =~ s/^[ \t]*<\/h:occurrence>$/$1/; - $who = $uri; - $who =~ s/^cic:/backward/; - $who =~ s/#xpointer\(1\/([^\/]*)\/([^\/]*)\)/,$1,$2/; - $who =~ s/#xpointer\(1\/([^\/]*)\)/,$1/; - $line4 =~ s/\Q$uri\E/$where/; - - open(OUT, ">>$who") or die "Error opening file $who"; - print OUT "\t\t\n"; - print OUT $line2; - if ($position eq 'MainHypothesis' || $position eq 'MainConclusion') { - print OUT $line3; - } - print OUT $line4; - print OUT "\t\t\n"; - close(OUT); -} -close(IN); diff --git a/helm/metadata/create_V7_mowgli/mkindex.sh b/helm/metadata/create_V7_mowgli/mkindex.sh deleted file mode 100755 index 3a814ba17..000000000 --- a/helm/metadata/create_V7_mowgli/mkindex.sh +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/bash - -echo `find . -name "*.xml"` | ../uris_of_filenames.pl $1 > rdf_index.txt -echo `find . -name "*.xml.gz"` | ../uris_of_filenames.pl $1 -gz >> rdf_index.txt diff --git a/helm/metadata/create_V7_mowgli/touch/.cvsignore b/helm/metadata/create_V7_mowgli/touch/.cvsignore deleted file mode 100644 index 10bc8bd91..000000000 --- a/helm/metadata/create_V7_mowgli/touch/.cvsignore +++ /dev/null @@ -1 +0,0 @@ -*.cmi *.cmo *.cmx touch touch.opt diff --git a/helm/metadata/create_V7_mowgli/touch/.depend b/helm/metadata/create_V7_mowgli/touch/.depend deleted file mode 100644 index e69de29bb..000000000 diff --git a/helm/metadata/create_V7_mowgli/touch/Makefile b/helm/metadata/create_V7_mowgli/touch/Makefile deleted file mode 100644 index 636a804da..000000000 --- a/helm/metadata/create_V7_mowgli/touch/Makefile +++ /dev/null @@ -1,41 +0,0 @@ -REQUIRES = helm-getter helm-cic str -PREDICATES = -OCAMLOPTIONS = -package "$(REQUIRES)" -predicates "$(PREDICATES)" -OCAMLDEP = ocamldep -OCAMLFIND = ocamlfind -OCAMLC = $(OCAMLFIND) ocamlc $(OCAMLOPTIONS) -OCAMLOPT = $(OCAMLFIND) ocamlopt $(OCAMLOPTIONS) - -LIBRARIES = $(shell ocamlfind query -recursive -predicates "byte $(PREDICATES)" -format "%d/%a" $(REQUIRES)) -LIBRARIES_OPT = $(shell ocamlfind query -recursive -predicates "native $(PREDICATES)" -format "%d/%a" $(REQUIRES)) - -all: touch -opt: touch.opt - -DEPOBJS = touch.ml - -TOUCHOBJS = touch.cmo - -depend: - $(OCAMLDEP) $(DEPOBJS) > .depend - -touch: $(TOUCHOBJS) $(LIBRARIES) - $(OCAMLC) -linkpkg -o touch $(TOUCHOBJS) - -touch.opt: $(TOUCHOBJS:.cmo=.cmx) $(LIBRARIES_OPT) - $(OCAMLOPT) -linkpkg -o touch.opt $(TOUCHOBJS:.cmo=.cmx) - -.SUFFIXES: .ml .mli .cmo .cmi .cmx -.ml.cmo: $(LIBRARIES) - $(OCAMLC) -c $< -.mli.cmi: $(LIBRARIES) - $(OCAMLC) -c $< -.ml.cmx: $(LIBRARIES_OPT) - $(OCAMLOPT) -c $< - -clean: - rm -f *.cm[iox] *.o touch touch.opt - -.PHONY: clean - -include .depend diff --git a/helm/metadata/create_V7_mowgli/touch/touch.ml b/helm/metadata/create_V7_mowgli/touch/touch.ml deleted file mode 100644 index 207750a6d..000000000 --- a/helm/metadata/create_V7_mowgli/touch/touch.ml +++ /dev/null @@ -1,132 +0,0 @@ -(* Copyright (C) 2000, HELM Team. - * - * This file is part of HELM, an Hypertextual, Electronic - * Library of Mathematics, developed at the Computer Science - * Department, University of Bologna, Italy. - * - * HELM is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * HELM is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with HELM; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, - * MA 02111-1307, USA. - * - * For details, see the HELM World-Wide-Web page, - * http://cs.unibo.it/helm/. - *) - -(******************************************************************************) -(* *) -(* PROJECT HELM *) -(* *) -(* Claudio Sacerdoti Coen *) -(* 03/04/2001 *) -(* *) -(* Missing description *) -(* *) -(******************************************************************************) - -let iteri foo = - let counter = ref 0 in - List.iter (function e -> incr counter ; foo e !counter) -;; - -let pathname_of_uri uristring = - "backward" ^ - Str.replace_first (Str.regexp "^cic:") "" uristring -;; - -let make_dirs dirpath = - ignore (Unix.system ("mkdir -p \"" ^ dirpath ^ "\"")) -;; - -let touch_file rdf_string_uri = - let module U = UriManager in - let rdf_uri = U.uri_of_string rdf_string_uri in - make_dirs (pathname_of_uri (U.buri_of_uri rdf_uri)) ; - ignore ( - Unix.system - ("touch \"" ^ (pathname_of_uri rdf_string_uri) ^ "\"") - ) -;; - -let get_obj uri = - let cicfilename = Getter.getxml uri in - let res = CicParser.obj_of_xml cicfilename None in - Unix.unlink cicfilename ; - res -;; - -let touch_obj string_uri = - let module U = UriManager in - let module C = Cic in - function - Some (C.InductiveDefinition (itys,_,_)) -> - iteri - (fun (_,_,_,cons) n -> - let sn = string_of_int n in - touch_file - (string_uri ^ "," ^ sn) ; - iteri - (fun (_,_) m -> - let sm = string_of_int m in - touch_file - (string_uri ^ "," ^ sn ^ "," ^ sm) - ) cons - ) itys - | Some _ -> assert false - | None -> - touch_file string_uri -;; - -let touch string_uri = - let module S = String in - let module U = UriManager in - print_endline ("Now touching metadata file for " ^ string_uri) ; - flush stdout ; - let uri = U.uri_of_string string_uri in - let obj = - if S.sub string_uri (S.length string_uri - 3) 3 = "ind" then - Some (get_obj uri) - else - None - in - touch_obj string_uri obj -;; - -let _ = - let usage_msg = "usage: touch[.opt] URI" in - let uri = ref "" in - Arg.parse [] - (fun x -> - if x = "" then - begin - prerr_string "No URI provided.\n" ; - Arg.usage [] usage_msg ; - exit (-1) - end - else if !uri = "" then - uri := x - else - begin - prerr_string "More than two arguments provided.\n" ; - Arg.usage [] usage_msg ; - exit (-1) - end - ) usage_msg ; - if !uri = "" then - begin - prerr_string "No URI provided.\n" ; - Arg.usage [] usage_msg ; - exit (-1) - end ; - touch !uri -;; diff --git a/helm/metadata/create_V7_mowgli/uris_of_filenames.pl b/helm/metadata/create_V7_mowgli/uris_of_filenames.pl deleted file mode 100755 index db835bf9c..000000000 --- a/helm/metadata/create_V7_mowgli/uris_of_filenames.pl +++ /dev/null @@ -1,14 +0,0 @@ -#!/usr/bin/perl - -while() { - chomp; - split / /; - for (@_) { - $GZSUFF = ""; - if (/.gz$/) - { s/.gz$//; $GZSUFF = " gz" if ($ARGV[1] == "-gz"); } - s/\./helm:rdf:www.cs.unibo.it\/helm\/rdf\/$ARGV[0]\/\/cic:/; - s/\.xml//; - print $_.$GZSUFF."\n"; - } -} diff --git a/helm/metadata/dc_mowgli/.cvsignore b/helm/metadata/dc_mowgli/.cvsignore deleted file mode 100644 index f08240acc..000000000 --- a/helm/metadata/dc_mowgli/.cvsignore +++ /dev/null @@ -1 +0,0 @@ -dc diff --git a/helm/metadata/dc_mowgli/Makefile b/helm/metadata/dc_mowgli/Makefile deleted file mode 100644 index 571221a1d..000000000 --- a/helm/metadata/dc_mowgli/Makefile +++ /dev/null @@ -1,7 +0,0 @@ -upload: - cat create_dc_tables | psql -h mowgli -U helm helm_mowgli - cat create_dc_indexes | psql -h mowgli -U helm helm_mowgli - find dc -name "*.xml" -exec ./upload.pl {} \; | psql -h mowgli -U helm helm_mowgli - -download: - cat drop_dc_tables | psql -h mowgli -U helm helm_mowgli diff --git a/helm/metadata/dc_mowgli/create_dc_indexes b/helm/metadata/dc_mowgli/create_dc_indexes deleted file mode 100644 index 132570f18..000000000 --- a/helm/metadata/dc_mowgli/create_dc_indexes +++ /dev/null @@ -1,37 +0,0 @@ -create index dccreator_index on dccreator (value); -create index dcdate_index on dcdate (value); -create index dcdescription_index on dcdescription (value); -create index dcformat_index on dcformat (value); -create index dcidentifier_index on dcidentifier (value); -create index dclanguage_index on dclanguage (value); -create index dcpublisher_index on dcpublisher (value); -create index dcqRelationType_index on dcqRelationType (value); -create index dcrelation_index on dcrelation (value); -create index dcrights_index on dcrights (value); -create index dcsource_index on dcsource (value); -create index dcsubject_index on dcsubject (value); -create index dctitle_index on dctitle (value); -create index hthResourceFormat_index on hthResourceFormat (value); -create index hthcontact_index on hthcontact (value); -create index hthfirstVersion_index on hthfirstVersion (value); -create index hthinstitution_index on hthinstitution (value); -create index hthmodified_index on hthmodified (value); - -create index dccreator_rev_index on dccreator (uri); -create index dcdate_rev_index on dcdate (uri); -create index dcdescription_rev_index on dcdescription (uri); -create index dcformat_rev_index on dcformat (uri); -create index dcidentifier_rev_index on dcidentifier (uri); -create index dclanguage_rev_index on dclanguage (uri); -create index dcpublisher_rev_index on dcpublisher (uri); -create index dcqRelationType_rev_index on dcqRelationType (uri); -create index dcrelation_rev_index on dcrelation (uri); -create index dcrights_rev_index on dcrights (uri); -create index dcsource_rev_index on dcsource (uri); -create index dcsubject_rev_index on dcsubject (uri); -create index dctitle_rev_index on dctitle (uri); -create index hthResourceFormat_rev_index on hthResourceFormat (uri); -create index hthcontact_rev_index on hthcontact (uri); -create index hthfirstVersion_rev_index on hthfirstVersion (uri); -create index hthinstitution_rev_index on hthinstitution (uri); -create index hthmodified_rev_index on hthmodified (uri); diff --git a/helm/metadata/dc_mowgli/create_dc_tables b/helm/metadata/dc_mowgli/create_dc_tables deleted file mode 100644 index c547f336a..000000000 --- a/helm/metadata/dc_mowgli/create_dc_tables +++ /dev/null @@ -1,18 +0,0 @@ -create table dccreator (value varchar, uri varchar); -create table dcdate (value varchar, uri varchar); -create table dcdescription (value varchar, uri varchar); -create table dcformat (value varchar, uri varchar); -create table dcidentifier (value varchar, uri varchar); -create table dclanguage (value varchar, uri varchar); -create table dcpublisher (value varchar, uri varchar); -create table dcqRelationType (value varchar, uri varchar); -create table dcrelation (value varchar, uri varchar); -create table dcrights (value varchar, uri varchar); -create table dcsource (value varchar, uri varchar); -create table dcsubject (value varchar, uri varchar); -create table dctitle (value varchar, uri varchar); -create table hthResourceFormat (value varchar, uri varchar); -create table hthcontact (value varchar, uri varchar); -create table hthfirstVersion (value varchar, uri varchar); -create table hthinstitution (value varchar, uri varchar); -create table hthmodified (value varchar, uri varchar); diff --git a/helm/metadata/dc_mowgli/drop_dc_tables b/helm/metadata/dc_mowgli/drop_dc_tables deleted file mode 100644 index d13a2a8ed..000000000 --- a/helm/metadata/dc_mowgli/drop_dc_tables +++ /dev/null @@ -1,18 +0,0 @@ -drop table dccreator; -drop table dcdate; -drop table dcdescription; -drop table dcformat; -drop table dcidentifier; -drop table dclanguage; -drop table dcpublisher; -drop table dcqRelationType; -drop table dcrelation; -drop table dcrights; -drop table dcsource; -drop table dcsubject; -drop table dctitle; -drop table hthResourceFormat; -drop table hthcontact; -drop table hthfirstVersion; -drop table hthinstitution; -drop table hthmodified; diff --git a/helm/metadata/dc_mowgli/mkindex.sh b/helm/metadata/dc_mowgli/mkindex.sh deleted file mode 100755 index 3a814ba17..000000000 --- a/helm/metadata/dc_mowgli/mkindex.sh +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/bash - -echo `find . -name "*.xml"` | ../uris_of_filenames.pl $1 > rdf_index.txt -echo `find . -name "*.xml.gz"` | ../uris_of_filenames.pl $1 -gz >> rdf_index.txt diff --git a/helm/metadata/dc_mowgli/upload.pl b/helm/metadata/dc_mowgli/upload.pl deleted file mode 100755 index 944f21bc2..000000000 --- a/helm/metadata/dc_mowgli/upload.pl +++ /dev/null @@ -1,51 +0,0 @@ -#!/usr/bin/perl - -use XML::Parser; - -$p = new XML::Parser(Handlers => {Start => \&handle_start, - End => \&handle_end, - Char => \&handle_char}); -$p->parsefile($ARGV[0]); - - -$skipped = 0; -$open = 0; -$content = ""; -$uri = ""; - -sub handle_start -{ - my ($expat, $element, @attrs) = @_; - if ($skipped == 1) { - $uri = $attrs[1]; - $uri =~ s/'/\\'/g; - } - if ($skipped < 2) { $skipped++ ; } - else { - $open++; - $content = ""; - } -} - -sub handle_end -{ - my ($expat,$element) = @_; - $open--; - if ($open >= 0) { - $content =~ s/'/\\'/g; - $element =~ s/://g; # dc:pippo ==> dcpippo - print "insert into $element values ('$content','$uri');\n"; - } -} - -sub handle_char -{ - my ($expat,$char) = @_; - if ($open >= 1) { - chomp($char); - $char =~ s/ +/ /g; - $char =~ s/^ //g; - $char =~ s/ $//g; - $content .= $char; - } -} diff --git a/helm/metadata/dc_mowgli/uris_of_filenames.pl b/helm/metadata/dc_mowgli/uris_of_filenames.pl deleted file mode 100755 index e896a6f2f..000000000 --- a/helm/metadata/dc_mowgli/uris_of_filenames.pl +++ /dev/null @@ -1,14 +0,0 @@ -#!/usr/bin/perl - -while() { - chomp; - split / /; - for (@_) { - $GZSUFF = ""; - if (/.gz$/) - { s/.gz$//; $GZSUFF = " gz" if ($ARGV[1] == "-gz"); } - s/\./helm:rdf:www.cs.unibo.it\/helm\/rdf\/dc$ARGV[0]\/\/cic:/; - s/\.xml//; - print $_.$GZSUFF."\n"; - } -} diff --git a/helm/metadata/postgresql_V7_mowgli/.cvsignore b/helm/metadata/postgresql_V7_mowgli/.cvsignore deleted file mode 100644 index 89ea3bfee..000000000 --- a/helm/metadata/postgresql_V7_mowgli/.cvsignore +++ /dev/null @@ -1,6 +0,0 @@ -forward -backward -forward_rel.xml -forward_sort.xml -txt -txt.saved diff --git a/helm/metadata/postgresql_V7_mowgli/Makefile b/helm/metadata/postgresql_V7_mowgli/Makefile deleted file mode 100644 index 271004ede..000000000 --- a/helm/metadata/postgresql_V7_mowgli/Makefile +++ /dev/null @@ -1,16 +0,0 @@ -CWD=/projects/helm/metadata/postgresql_V7_mowgli_new_schema - -txt: - (cd forward && find . -type d -exec mkdir -p $(CWD)/txt/{} \;) - (cd forward && find . -name "*.xml" -exec xsltproc --param path '"{}"' -o $(CWD)/txt/{}.txt $(CWD)/metainfo.xsl {} \; -exec echo {} \;) - -upload: - ./upload_rel.pl forward_rel.xml | psql -h mowgli -U helm helm_mowgli_new_schema - ./upload_sort.pl forward_sort.xml | psql -h mowgli -U helm helm_mowgli_new_schema - (cd txt && find */* -name "*.txt" > index.txt) - (cd txt && cat index.txt | ../inserisci.pl) - -clean: - rm -rf txt/* - -.PHONY: txt diff --git a/helm/metadata/postgresql_V7_mowgli/README b/helm/metadata/postgresql_V7_mowgli/README deleted file mode 100644 index 0d1b720a1..000000000 --- a/helm/metadata/postgresql_V7_mowgli/README +++ /dev/null @@ -1,29 +0,0 @@ -* da utente postgres: - - $ createuser helm # con permessi minimi (i.e. no create altri database, - # no create altri utenti) - $ createdb helm - $ pg_passwd data/passwords - # settare una password - -* da un utente qualsiasi: - - $ psql -h mowgli -U helm helm_mowgli_new_schema - - create table registry (uri varchar, id int); - CREATE INDEX registry_index ON registry (uri); - - create table objectName (value varchar, uri varchar); - CREATE INDEX objectName_index ON objectName (value); - CREATE INDEX objectName_rev_index ON objectName (uri); - - create table hrefRel (uri varchar, position varchar, depth int); - create table hrefSort (uri varchar, position varchar, sort varchar, depth int); - CREATE INDEX hrefRel_rev_index ON hrefRel (uri); - CREATE INDEX hrefSort_rev_index ON hrefSort (uri); - -* svuotamento: - drop table tn; - delete from registry; -* svuotamento totale: - come postgres: dropdb helm diff --git a/helm/metadata/postgresql_V7_mowgli/inserisci.pl b/helm/metadata/postgresql_V7_mowgli/inserisci.pl deleted file mode 100755 index 17c882418..000000000 --- a/helm/metadata/postgresql_V7_mowgli/inserisci.pl +++ /dev/null @@ -1,24 +0,0 @@ -#!/usr/bin/perl - -$max = 0; -open (OUT, "| psql -U helm helm_mowgli_new_schema"); -while () { - open (IN,$_); - $uri1 = ; - chomp($uri1); - print "$uri1:\n"; - $uri1 =~ s/'/\\'/g; - $max++; - print OUT "create table t$max (prop_id varchar, position varchar, uri varchar, depth int);"; - print OUT "insert into registry values ('$uri1', $max);"; - while () { - chomp; - ($dir,$context,$uri2,$depth) = split(/\|/); - print " Inserisco $dir#$context#$uri2#$depth\n"; - $uri2 =~ s/'/\\'/g; - print OUT "insert into t$max values ('$dir', '$context', '$uri2', $depth);"; - } - print "\n"; - close IN; -} -close OUT; diff --git a/helm/metadata/postgresql_V7_mowgli/inserisci_names.pl b/helm/metadata/postgresql_V7_mowgli/inserisci_names.pl deleted file mode 100755 index 68cc93eb7..000000000 --- a/helm/metadata/postgresql_V7_mowgli/inserisci_names.pl +++ /dev/null @@ -1,13 +0,0 @@ -#!/usr/bin/perl - -open (OUT, "| psql -h mowgli -U helm helm_mowgli_new_schema"); -while () { - chomp; - ($name,$uri) = split(/\|/); - print " Inserisco $name#$uri\n"; - $name =~ s/'/\\'/g; - $uri =~ s/'/\\'/g; - print OUT "insert into objectName values ('$name', '$uri');"; - print "\n"; -} -close OUT; diff --git a/helm/metadata/postgresql_V7_mowgli/metadata_for_names/.cvsignore b/helm/metadata/postgresql_V7_mowgli/metadata_for_names/.cvsignore deleted file mode 100644 index d873963bf..000000000 --- a/helm/metadata/postgresql_V7_mowgli/metadata_for_names/.cvsignore +++ /dev/null @@ -1 +0,0 @@ -objectName.txt diff --git a/helm/metadata/postgresql_V7_mowgli/metadata_for_names/Makefile b/helm/metadata/postgresql_V7_mowgli/metadata_for_names/Makefile deleted file mode 100644 index cbde30733..000000000 --- a/helm/metadata/postgresql_V7_mowgli/metadata_for_names/Makefile +++ /dev/null @@ -1,2 +0,0 @@ -upload: - cat objectName.txt | ../inserisci_names.pl diff --git a/helm/metadata/postgresql_V7_mowgli/metainfo.xsl b/helm/metadata/postgresql_V7_mowgli/metainfo.xsl deleted file mode 100644 index 472a35fd2..000000000 --- a/helm/metadata/postgresql_V7_mowgli/metainfo.xsl +++ /dev/null @@ -1,60 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - F| - - - B| - - - - | - - | - - - - - - null - - - - - - - diff --git a/helm/metadata/postgresql_V7_mowgli/upload_rel.pl b/helm/metadata/postgresql_V7_mowgli/upload_rel.pl deleted file mode 100755 index 6fece8441..000000000 --- a/helm/metadata/postgresql_V7_mowgli/upload_rel.pl +++ /dev/null @@ -1,30 +0,0 @@ -#!/usr/bin/perl - -my $inputfile = $ARGV[0]; - -#print "Now splitting file $inputfile\n"; -open(IN, "<$inputfile") or die "Error opening file $inputfile"; -while(($skip = ) && not ($skip =~ /) && not ($line0 =~ /<\/rdf:RDF>/)) { # $/$1/; - $line1 = ; #; # - $position = $line2; - chomp($position); - $position =~ s/^[ \t]*[^"]*"&hns;([^"]*)"\/>/$1/; - $position = "http://www.cs.unibo.it/helm/schemas/schema-helm#$position"; - $line3 = ; #([^<]*)<\/h:depth>$/$1/; - $line4 = ; # ; # - - $line0 =~ s/'/\\'/g; - $position =~ s/'/\\'/g; - $depth =~ s/'/\\'/g; - print "insert into hrefRel values ('$line0', '$position', $depth);\n\n"; -} -close(IN); diff --git a/helm/metadata/postgresql_V7_mowgli/upload_sort.pl b/helm/metadata/postgresql_V7_mowgli/upload_sort.pl deleted file mode 100755 index 1215ceb3a..000000000 --- a/helm/metadata/postgresql_V7_mowgli/upload_sort.pl +++ /dev/null @@ -1,36 +0,0 @@ -#!/usr/bin/perl - -my $inputfile = $ARGV[0]; - -#print "Now splitting file $inputfile\n"; -open(IN, "<$inputfile") or die "Error opening file $inputfile"; -while(($skip = ) && not ($skip =~ /) && not ($line0 =~ /<\/rdf:RDF>/)) { # $/$1/; - $line1 = ; #; # - $position = $line2; - chomp($position); - $position =~ s/^[ \t]*[^"]*"&hns;([^"]*)"\/>/$1/; - $position = "http://www.cs.unibo.it/helm/schemas/schema-helm#$position"; - $line3 = ;#/$1/; - $sort = "http://www.cs.unibo.it/helm/schemas/schema-helm#$sort"; - $line4 = ; #([^<]*)<\/h:depth>$/$1/; - $line5 = ; # ; # - - $line0 =~ s/'/\\'/g; - $position =~ s/'/\\'/g; - $depth =~ s/'/\\'/g; - $sort =~ s/'/\\'/g; - print "insert into hrefSort values ('$line0', '$position', '$sort', $depth);\n\n"; -} -close(IN); -- 2.39.2