3 # $Id: ezeerex2pqfproperties.pl,v 1.3 2006-06-19 08:15:37 mike Exp $
8 use XML::LibXML::XPathContext;
10 my $text = join('', <>);
11 my $parser = new XML::LibXML();
12 my $doc = $parser->parse_string($text);
13 my $root = $doc->getDocumentElement();
14 my $xc = XML::LibXML::XPathContext->new($root);
15 $xc->registerNs(zeerex => 'http://explain.z3950.org/dtd/2.0/');
18 print_default_set($xc);
20 #print_relations($xc);
21 #print_relation_modifiers($xc);
22 #print_positions($xc);
23 #print_structures($xc);
24 #print_truncations($xc);
26 # We could limit the sets output to those that are actually used by an
27 # SRU index: that way we could avoid defining
28 # set.bib1 = 1.2.840.10003.3.1
29 # which is a Z39.50 attribute set that we don't need for CQL. But
30 # doing that would be a marginal gain.
35 my(@nodes) = $xc->findnodes('zeerex:indexInfo/zeerex:set');
36 print "found ", scalar(@nodes), " values\n";
37 foreach my $node (@nodes) {
38 my $name = $node->findvalue('@name');
39 my $identifier = $node->findvalue('@identifier');
40 print "set.$name = $identifier\n";
44 sub print_default_set {
47 my (@nodes) = $xc->findnodes('zeerex:configInfo/' .
48 'zeerex:default[@type="contextSet"]');
49 foreach my $node (@nodes) {
50 print "set = ", $node->findvalue('.'), "\n";
57 foreach my $node ($xc->findnodes('zeerex:indexInfo/' .
58 'zeerex:index[@search="true"]')) {
59 print "node=$node = ", $node->toString(), "\n";
60 foreach my $map ($node->findnodes("zeerex:map")) {
61 print "map=$map = ", $map->toString(), "\n";
62 print("index.", $map->findvalue('@set'),
63 " = ", $map->findvalue('.'));