/[hyperestraier_wrappers]/trunk/examples/nodegatherer.pl
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Contents of /trunk/examples/nodegatherer.pl

Parent Directory Parent Directory | Revision Log Revision Log


Revision 11 - (show annotations)
Thu Sep 8 21:22:10 2005 UTC (16 years, 2 months ago) by dpavlin
File MIME type: text/plain
File size: 991 byte(s)
Remove NetEnv class, and do network enviroment initialization
in constructor and destructor of node. Added example for gatherer
using node API.

1 #!/usr/bin/env perl
2 # the simplest implementation of a node gatherer
3
4 use strict;
5 use warnings;
6
7 use HyperEstraier;
8
9 # open the database
10 my $node = HyperEstraier::Node->new("http://localhost:1978/node/test1");
11 $node->set_auth('admin', 'admin');
12
13 print "Connected to node ", $node->name, " (", $node->label, ")\n";
14 print "docnum: ", $node->doc_num, " word_num: ", $node->word_num, " size: ",$node->size,"\n";
15
16 # create a document object
17 my $doc = HyperEstraier::Document->new;
18
19 # add attributes to the document object
20 $doc->add_attr('@uri', "http://estraier.gov/example001.txt");
21 $doc->add_attr('@title', "Over the Rainbow");
22
23 # add the body text to the document object
24 $doc->add_text("Somewhere over the rainbow. Way up high.");
25 $doc->add_text("There's a land that I heard of once in a lullaby.");
26
27 print $doc->dump_draft;
28
29
30 # register the document object to the database
31 my $id;
32 unless ($id = $node->put_doc($doc)) {
33 printf "ERROR: %d\n", $node->status;
34 } else {
35 print "id: $id\n";
36 }

Properties

Name Value
svn:executable *

  ViewVC Help
Powered by ViewVC 1.1.26