From acb4d21d95679dde4fe2256d2e46eefee04f4f97 Mon Sep 17 00:00:00 2001 From: Claudio Sacerdoti Coen Date: Tue, 5 Nov 2002 16:21:16 +0000 Subject: [PATCH] first commit --- 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 ++++++ 8 files changed, 150 insertions(+) create mode 100644 helm/metadata/dc_mowgli/.cvsignore create mode 100644 helm/metadata/dc_mowgli/Makefile create mode 100644 helm/metadata/dc_mowgli/create_dc_indexes create mode 100644 helm/metadata/dc_mowgli/create_dc_tables create mode 100644 helm/metadata/dc_mowgli/drop_dc_tables create mode 100755 helm/metadata/dc_mowgli/mkindex.sh create mode 100755 helm/metadata/dc_mowgli/upload.pl create mode 100755 helm/metadata/dc_mowgli/uris_of_filenames.pl diff --git a/helm/metadata/dc_mowgli/.cvsignore b/helm/metadata/dc_mowgli/.cvsignore new file mode 100644 index 000000000..f08240acc --- /dev/null +++ b/helm/metadata/dc_mowgli/.cvsignore @@ -0,0 +1 @@ +dc diff --git a/helm/metadata/dc_mowgli/Makefile b/helm/metadata/dc_mowgli/Makefile new file mode 100644 index 000000000..571221a1d --- /dev/null +++ b/helm/metadata/dc_mowgli/Makefile @@ -0,0 +1,7 @@ +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 new file mode 100644 index 000000000..132570f18 --- /dev/null +++ b/helm/metadata/dc_mowgli/create_dc_indexes @@ -0,0 +1,37 @@ +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 new file mode 100644 index 000000000..c547f336a --- /dev/null +++ b/helm/metadata/dc_mowgli/create_dc_tables @@ -0,0 +1,18 @@ +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 new file mode 100644 index 000000000..d13a2a8ed --- /dev/null +++ b/helm/metadata/dc_mowgli/drop_dc_tables @@ -0,0 +1,18 @@ +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 new file mode 100755 index 000000000..3a814ba17 --- /dev/null +++ b/helm/metadata/dc_mowgli/mkindex.sh @@ -0,0 +1,4 @@ +#!/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 new file mode 100755 index 000000000..944f21bc2 --- /dev/null +++ b/helm/metadata/dc_mowgli/upload.pl @@ -0,0 +1,51 @@ +#!/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 new file mode 100755 index 000000000..e896a6f2f --- /dev/null +++ b/helm/metadata/dc_mowgli/uris_of_filenames.pl @@ -0,0 +1,14 @@ +#!/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"; + } +} -- 2.39.2