Add Zthes example
authorMike Taylor <mike@indexdata.com>
Fri, 8 Nov 2002 01:07:10 +0000 (01:07 +0000)
committerMike Taylor <mike@indexdata.com>
Fri, 8 Nov 2002 01:07:10 +0000 (01:07 +0000)
examples/.cvsignore [new file with mode: 0644]
examples/zthes/Makefile [new file with mode: 0644]
examples/zthes/Zthes.abs [new file with mode: 0644]
examples/zthes/dino.tree [new file with mode: 0644]
examples/zthes/records/.cvsignore [new file with mode: 0644]
examples/zthes/tagsetg.tag [new file with mode: 0644]
examples/zthes/tree2xml.pl [new file with mode: 0755]
examples/zthes/zebra.cfg [new file with mode: 0644]

diff --git a/examples/.cvsignore b/examples/.cvsignore
new file mode 100644 (file)
index 0000000..282522d
--- /dev/null
@@ -0,0 +1,2 @@
+Makefile
+Makefile.in
diff --git a/examples/zthes/Makefile b/examples/zthes/Makefile
new file mode 100644 (file)
index 0000000..51e59ca
--- /dev/null
@@ -0,0 +1,10 @@
+recdA-0.mf: records/dino.xml
+       zebraidx init
+       zebraidx update records
+
+records/dino.xml: tree2xml.pl dino.tree
+       ./tree2xml.pl dino.tree > records/dino.xml
+
+clean:
+       rm -f records/dino.xml *.mf *..LCK zebrasrv.pid
+
diff --git a/examples/zthes/Zthes.abs b/examples/zthes/Zthes.abs
new file mode 100644 (file)
index 0000000..a27b11d
--- /dev/null
@@ -0,0 +1,5 @@
+attset bib1.att
+tagset tagsetg.tag
+xpath enable
+
+elm (2,1)      title   !
diff --git a/examples/zthes/dino.tree b/examples/zthes/dino.tree
new file mode 100644 (file)
index 0000000..ee95adc
--- /dev/null
@@ -0,0 +1,118 @@
+Dinosauria     The MRCA of Saurischia and Ornithischia, and its descendants
+ *** Eoraptor  The most basal known dinosaur
+ Saurischia
+  Sauropodomorpha
+   Brontosauria
+    Plateosauria
+     Massospondylidae
+      Yunnanosaurinae
+       *** Yunnanosaurus
+    Sauropoda
+     Eusauropoda
+      *** Jobaria
+      Neosauropoda
+       Diplodocimorpha
+       Rebbachisauridae
+        Rebbachisaurinae
+         *** Rebbachisaurus
+       Macronaria
+       Camarasauromorpha
+        Titanosauriformes
+         Brachiosauridae
+          *** Sauroposeidon
+         Titanosauria
+          Eutitanosauria
+           *** Argentinosaurus
+  Theropoda
+   Neotheropoda
+    Ceratosauria
+     Coelophysoidea
+      Coelophysidae
+       Coelophysinae
+        *** Dilophosaurus
+     Neoceratosauria
+      *** Xenotarsosaurus
+    Tetanurae
+     Spinosauria
+      Spinosauridae
+       Spinosaurinae
+       Irritatorini
+        *** Irritator
+     Avetheropoda              aka. Neotetanurae
+      Carnosauria              Previously used just to mean "large theropods"
+       *** Fukuiraptor
+       Allosauroidea
+       Allosauridae
+        Carcharodontosaurinae  Some consider these animals derived abelisaurs
+         *** Giganotosaurus    Probably the heaviest known theropod
+      Coelurosauria            Previously used just to mean "small theropods"
+       Maniraptoriformes
+       [unnamed]               Unnamed clade {Ornithomimosauria+Tyrannosauria}
+        Arctometatarsalia
+         Ornithomimosauria
+          *** Harpymimus
+        Tyrannosauroidea
+         Tyrannosauridae
+          Tyrannosaurinae
+           Tyrannosaurini
+            *** Tyrannosaurus
+       Maniraptora
+        Oviraptorosauria
+         Oviraptoridae
+          *** Oviraptor
+        Therizinosauria
+         Therizinosauroidea
+          Therizinosauridae
+           *** Nanshiungosaurus
+        Paraves
+         Eumaniraptora
+          Deinonychosauria
+           Troodontidae
+            *** Byronosaurus
+           Dromaeosauridae
+            Velociraptorinae
+             *** Velociraptor
+          Avialae
+           Aves
+            Metornithes
+             Alvarezsauria
+              Alvarezsauridae
+               Mononykinae
+                *** Parvicursor
+ Ornithischia
+  Genasauria
+   Thyreophora
+    Thyreophoroidea
+     Eurypoda
+      Stegosauria
+       Stegosauridae
+       *** Kentrosaurus
+      Ankylosauria
+       *** Minmi
+   Cerapoda
+    Marginocephalia
+     Ceratopsia
+      Neoceratopsia
+       *** Udanoceratops
+       Coronosauria
+       Ceratopsoidea
+        Ceratopsomorpha
+         *** Zuniceratops
+     Pachycephalosauria
+      *** Wannanosaurus
+    Ornithopoda
+     *** Qantassaurus
+     Euornithopoda
+      Iguanodontia
+       Euiguanodontia
+       Dryomorpha
+        Ankylopollexia
+         Styracosterna
+          *** Lurdosaurus
+          Iguanodontoidea
+           Hadrosauroidea
+            Hadrosauridae
+             Euhadrosauria
+              Lambeosaurinae
+               Lambeosaurini
+                *** Corythosaurus
diff --git a/examples/zthes/records/.cvsignore b/examples/zthes/records/.cvsignore
new file mode 100644 (file)
index 0000000..54eeda1
--- /dev/null
@@ -0,0 +1 @@
+dino.xml
diff --git a/examples/zthes/tagsetg.tag b/examples/zthes/tagsetg.tag
new file mode 100644 (file)
index 0000000..6536cfe
--- /dev/null
@@ -0,0 +1,41 @@
+# TagSet-G Tags
+# $Id: tagsetg.tag,v 1.1 2002-11-08 01:07:10 mike Exp $
+name tagsetg
+reference TagsetG
+type 2
+
+tag    1       termName                                string
+tag    2       author                                  string
+tag    3       publicationPlace                        string
+tag    4       publicationDate/date-of-publication     string
+tag    5       documentId                              string
+tag    6       abstract                                string
+tag    7       name                                    string
+tag    8       dateTime                                generalizedtime
+tag    9       displayObject                           octetstring
+tag    10      organization/organisation               string
+tag    11      postalAddress                           string
+tag    12      networkAddress                          string
+tag    13      eMailAddress                            string
+tag    14      phoneNumber/telephone                   string
+tag    15      faxNumber/fax                           string
+tag    16      country                                 string
+tag    17      description                             string
+tag    18      time                                    intunit
+tag    19      documentcontent                         octetstring
+tag    20      language                                string
+tag    21      subject                                 string
+tag    22      resourceType                            string
+tag    23      city                                    string
+tag    24      stateOrProvince                         string
+tag    25      zipOrPostalCode                         string
+tag    26      cost                                    string
+tag    27      format                                  string
+tag    28      identifier                              string
+tag    29      rights                                  string
+tag    30      relation                                string
+tag    31      publisher                               string
+tag    32      contributor                             string
+tag    33      source                                  string
+tag    34      coverage                                string
+tag    35      private                                 string
diff --git a/examples/zthes/tree2xml.pl b/examples/zthes/tree2xml.pl
new file mode 100755 (executable)
index 0000000..92544a9
--- /dev/null
@@ -0,0 +1,90 @@
+#!/usr/bin/perl -w
+
+use strict;
+
+
+package Node;
+
+sub new {
+    my $class = shift();
+    my($name, $id, $parent, $note) = @_;
+
+    my $this = bless { name => $name,
+                      id => $id,
+                      parent => $parent,
+                      children => [],
+                      note => $note }, $class;
+    push @{ $parent->{children} }, $this
+       if defined $parent;
+
+    return $this;
+}
+
+sub walk {
+    my $this = shift();
+    my($coderef) = @_;
+
+    &$coderef($this);
+    foreach my $child (@{ $this->{children} }) {
+       $child->walk($coderef)
+    }
+}
+
+sub write_zthes {
+    my $this = shift();
+
+    print "<Zthes>\n";
+    $this->write_term(1);
+    my $note = $this->{note};
+    print " <termNote>$note</termNote>\n" if defined $note;
+    my $parent = $this->{parent};
+    if (defined $parent) {
+       $parent->write_relation('BT');
+    }
+    foreach my $child (@{ $this->{children} }) {
+       $child->write_relation('NT');
+    }
+    print "</Zthes>\n";
+}
+
+sub write_relation {
+    my $this = shift();
+    my($type) = @_;
+
+    print " <relation>\n";
+    print "  <relationType>$type</relationType>\n";
+    $this->write_term(2);
+    print " </relation>\n";
+}
+
+sub write_term {
+    my $this = shift();
+    my($level) = @_;
+
+    print ' ' x $level, "<termId>", $this->{id}, "</termId>\n";
+    print ' ' x $level, "<termName>", $this->{name}, "</termName>\n";
+    print ' ' x $level, "<termType>PT</termType>\n";
+}
+
+
+package main;
+
+my @stack;
+my $id = 1;
+
+while (<>) {
+    chomp();
+    s/\t/        /g;
+    s/^( *)//;
+    my $level = length($1);
+    s/^\*+ //;
+    my $note = undef;
+    if (s/[ \t]+(.*)//) {
+       $note = $1;
+    }
+    my $parent = undef;
+    $parent = $stack[$level-1] if $level > 0;
+    $stack[$level] = new Node($_, $id++, $parent, $note);
+}
+
+$stack[0]->walk(\&Node::write_zthes);
diff --git a/examples/zthes/zebra.cfg b/examples/zthes/zebra.cfg
new file mode 100644 (file)
index 0000000..b7cf63b
--- /dev/null
@@ -0,0 +1,4 @@
+# $Id: zebra.cfg,v 1.1 2002-11-08 01:07:10 mike Exp $
+profilePath: .:../../tab
+recordType: grs.sgml
+attset: bib1.att