2 * Copyright (C) 1994-1998, Index Data I/S
4 * Sebastian Hammer, Adam Dickmeiss
6 * $Log: attribute.c,v $
7 * Revision 1.8 1998-03-05 08:45:11 adam
8 * New result set model and modular ranking system. Moved towards
9 * descent server API. System information stored as "SGML" records.
11 * Revision 1.7 1997/10/29 12:05:01 adam
12 * Server produces diagnostic "Unsupported Attribute Set" when appropriate.
14 * Revision 1.6 1997/09/17 12:19:11 adam
15 * Zebra version corresponds to YAZ version 1.4.
16 * Changed Zebra server so that it doesn't depend on global common_resource.
18 * Revision 1.5 1997/09/05 15:30:08 adam
19 * Changed prototype for chr_map_input - added const.
20 * Added support for C++, headers uses extern "C" for public definitions.
22 * Revision 1.4 1996/10/29 14:06:48 adam
23 * Include zebrautl.h instead of alexutil.h.
25 * Revision 1.3 1996/05/09 07:28:54 quinn
26 * Work towards phrases and multiple registers
28 * Revision 1.2 1995/11/15 19:13:07 adam
29 * Work on record management.
32 * This interface is used by other modules (the Z-server in particular)
33 * to normalize the attributes given in queries.
43 static void att_loadset(void *p, const char *n, const char *name)
48 if (!(cnew = data1_read_attset(zi->dh, (char*) name)))
50 logf(LOG_WARN|LOG_ERRNO, "%s", name);
53 cnew->next = zi->registered_sets;
54 zi->registered_sets = cnew;
57 static void load_atts(ZebraHandle zi)
59 res_trav(zi->res, "attset", zi, att_loadset);
62 static data1_att *getatt(data1_attset *p, int att)
66 for (; p; p = p->next)
69 for (a = p->atts; a; a = a->next)
72 /* scan included sets */
73 if (p->children && (a = getatt(p->children, att)))
79 int att_getentbyatt(ZebraHandle zi, attent *res, oid_value set, int att)
84 if (!zi->registered_sets)
86 for (p = zi->registered_sets; p; p = p->next)
87 if (p->reference == set)
91 if (!(r = getatt(p, att)))
93 res->attset_ordinal = r->parent->ordinal;
94 res->local_attributes = r->locals;