From: Adam Dickmeiss Date: Fri, 30 Nov 2001 08:24:05 +0000 (+0000) Subject: New ZOOM option schema. X-Git-Tag: YAZ.1.8.4~10 X-Git-Url: http://lists.indexdata.dk/?a=commitdiff_plain;h=bd67bd91a1ef6340ba08db039aa04b6fc424fc8d;p=yaz-moved-to-github.git New ZOOM option schema. --- diff --git a/CHANGELOG b/CHANGELOG index 2e286f7..4279066 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -2,6 +2,8 @@ Possible compatibility problems with earlier versions marked with '*'. --- 1.8.4 2001/XX/XX +New ZOOM option, schema, that specifies shema OID for retrieval. + New CCL feature. Qualifiers can be aliases for one or more other qualifiers (if more than one is given, OR is used). diff --git a/doc/zoom.xml b/doc/zoom.xml index d2c561c..63bff81 100644 --- a/doc/zoom.xml +++ b/doc/zoom.xml @@ -1,4 +1,4 @@ - + Building clients with ZOOM @@ -304,6 +304,10 @@ USMARC, SUTRS, etc. none + schemaSchema for retrieval, such as + Gils-schema, Geo-schema, etc. + none + smallSetUpperBoundIf hits is less than or equal to this value, then target will return all records using small element set name 0 diff --git a/zoom/zoom-c.c b/zoom/zoom-c.c index d801960..862811b 100644 --- a/zoom/zoom-c.c +++ b/zoom/zoom-c.c @@ -1,5 +1,5 @@ /* - * $Id: zoom-c.c,v 1.13 2001-11-28 23:00:19 adam Exp $ + * $Id: zoom-c.c,v 1.14 2001-11-30 08:24:06 adam Exp $ * * ZOOM layer for C, connections, result sets, queries. */ @@ -370,7 +370,7 @@ ZOOM_resultset ZOOM_connection_search(ZOOM_connection c, ZOOM_query q) cp = ZOOM_options_get (r->options, "setname"); if (cp) r->setname = xstrdup (cp); - + r->connection = c; r->next = c->resultsets; @@ -440,6 +440,7 @@ static void ZOOM_resultset_retrieve (ZOOM_resultset r, { ZOOM_task task; ZOOM_connection c; + const char *cp; if (!r) return; @@ -659,6 +660,7 @@ static int ZOOM_connection_send_search (ZOOM_connection c) const char *elementSetName; const char *smallSetElementSetName; const char *mediumSetElementSetName; + const char *schema; assert (c->tasks); assert (c->tasks->which == ZOOM_TASK_SEARCH); @@ -671,6 +673,8 @@ static int ZOOM_connection_send_search (ZOOM_connection c) ZOOM_options_get (r->options, "smallSetElementSetName"); mediumSetElementSetName = ZOOM_options_get (r->options, "mediumSetElementSetName"); + schema = + ZOOM_options_get (r->options, "schema"); if (!smallSetElementSetName) smallSetElementSetName = elementSetName; @@ -701,7 +705,7 @@ static int ZOOM_connection_send_search (ZOOM_connection c) *search_req->mediumSetPresentNumber = mspn; } else if (r->start == 0 && r->count > 0 - && r->piggyback && !r->r_sort_spec) + && r->piggyback && !r->r_sort_spec && !schema) { /* Regular piggyback - do it unless we're going to do sort */ *search_req->largeSetLowerBound = 2000000000; @@ -1108,6 +1112,8 @@ static int send_present (ZOOM_connection c) ZOOM_options_get (c->options, "preferredRecordSyntax"); const char *element = ZOOM_options_get (c->options, "elementSetName"); + const char *schema = + ZOOM_options_get (c->options, "schema"); ZOOM_resultset resultset; if (!c->tasks) @@ -1156,7 +1162,48 @@ static int send_present (ZOOM_connection c) req->preferredRecordSyntax = yaz_str_to_z3950oid (c->odr_out, CLASS_RECSYN, syntax); - if (element && *element) + if (schema && *schema) + { + Z_RecordComposition *compo = odr_malloc (c->odr_out, sizeof(*compo)); + + req->recordComposition = compo; + compo->which = Z_RecordComp_complex; + compo->u.complex = (Z_CompSpec *) + odr_malloc(c->odr_out, sizeof(*compo->u.complex)); + compo->u.complex->selectAlternativeSyntax = (bool_t *) + odr_malloc(c->odr_out, sizeof(bool_t)); + *compo->u.complex->selectAlternativeSyntax = 0; + + compo->u.complex->generic = (Z_Specification *) + odr_malloc(c->odr_out, sizeof(*compo->u.complex->generic)); + + compo->u.complex->generic->schema = (Odr_oid *) + yaz_str_to_z3950oid (c->odr_out, CLASS_SCHEMA, schema); + + if (!compo->u.complex->generic->schema) + { + /* OID wasn't a schema! Try record syntax instead. */ + + compo->u.complex->generic->schema = (Odr_oid *) + yaz_str_to_z3950oid (c->odr_out, CLASS_RECSYN, schema); + } + if (element && *element) + { + compo->u.complex->generic->elementSpec = (Z_ElementSpec *) + odr_malloc(c->odr_out, sizeof(Z_ElementSpec)); + compo->u.complex->generic->elementSpec->which = + Z_ElementSpec_elementSetName; + compo->u.complex->generic->elementSpec->u.elementSetName = + odr_strdup (c->odr_out, element); + } + else + compo->u.complex->generic->elementSpec = 0; + compo->u.complex->num_dbSpecific = 0; + compo->u.complex->dbSpecific = 0; + compo->u.complex->num_recordSyntax = 0; + compo->u.complex->recordSyntax = 0; + } + else if (element && *element) { Z_ElementSetNames *esn = odr_malloc (c->odr_out, sizeof(*esn)); Z_RecordComposition *compo = odr_malloc (c->odr_out, sizeof(*compo)); diff --git a/zoom/zoomtst4.c b/zoom/zoomtst4.c index a2eb137..7be0b96 100644 --- a/zoom/zoomtst4.c +++ b/zoom/zoomtst4.c @@ -1,5 +1,5 @@ /* - * $Id: zoomtst4.c,v 1.6 2001-11-22 09:45:31 adam Exp $ + * $Id: zoomtst4.c,v 1.7 2001-11-30 08:24:06 adam Exp $ * * Asynchronous multi-target going through proxy doing search and retrieve * using present. @@ -42,6 +42,8 @@ int main(int argc, char **argv) /* get 20 (at most) records from offset 5 */ ZOOM_options_set (o, "start", "5"); ZOOM_options_set (o, "count", "20"); + ZOOM_options_set (o, "schema", "gils-schema"); + ZOOM_options_set (o, "elementSetName", "F"); /* set proxy */ ZOOM_options_set (o, "proxy", argv[1]);