🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.text.sgml
Article #202

SGML query program

#202
From: "Dr. "Eliot Kimber" Macro"
Date: Mon, 14 Sep 1992 12:52
52 lines
3186 bytes
References: <3602@bcstec.ca.boeing.com>

Paul Hardiman asks about query mechanisms for SGML documents.

I don't know of any off-the-shelf query engines, but HyTime
(ISO 10744) defines a query language (HyQ) specifically for
doing queries into SGML documents.  It shouldn't be too hard
to write a HyQ server on top of any reasonably-sophisticated
SGML parser.   If you need special purpose queries to meet
a specific application, you could do it pretty easily using
a system like the IBM SGML Translator and a fairly small amount
of REXX code, on the order of a few hundred lines.

I've said a few things in this forum about SGML documents as
databases.  In fact, I've started to think about all processing
done against SGML documents as retrieval, in the sense that
the processing application retrieves elements from the SGML
source for the purpose of creating the output object.  The simplest
retrieval query is "retrieve all elements in the order they
occur in the document.", but that is only one of many possible
retrieval strategies.  I find that this way of thinking about
SGML documents breaks me out of the sequential processing
for formatting paradigm that most document processing systems
use, and frees me to think of more interesting and powerful
ways of using SGML documents.  Also, if retrieval is a basic
processing function of your application, it gives you a base
on which to build all sorts of useful functions such as
retrieval of specific elements based on element properties.
If you think of your document source as a general-purpose
database of information intended to be used and re-used in
many ways, then retrieval is the natural mechanism for
accessing that data, just as you would use retrieval to access
data in any other kind of database.

One interesting aspect of this way of thinking is that if you
have a processing system that uses retrieval as its model
for data access and provides mechanisms for controlling retrieval
based on properties of elements, then very nutty problems like
multiversioning become very easy to solve, because they are
reduced to specific query specifications made using a general-purpose
query and retrieval mechanism.  For example, assuming I've
defined the property element "VERSION=" for all GIs, I can
modify the basic query above to "retrieve all elements
that have the property value VERSION=1 in the order they
occur."  This would retrieve only elements of the correct
version (and any elements they contain).

Eliot Kimber                      Internet:  drmacro@ralvm13.vnet.ibm.com
Dept E14/B500                     IBMMAIL:   USIB2DK9@IBMMAIL
Network Programs Information Development     Phone: 1-919-543-7091
IBM Corporation
Research Triangle Park, NC 27709
Technical Details
Message-ID: <9209141317.AA00913@ucbvax.Berkeley.EDU>
Path: arc1-ca.pugleaf.net!sparky!uunet!pmafire!news.dell.com!swrinde!zaphod.mps.ohio-state.edu!pacific.mps.ohio-state.edu!linac!att!ucbvax!RALVM13.VNET.IBM.COM!DRMACRO

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!pmafire!news.dell.com!swrinde!zaphod.mps.ohio-state.edu!pacific.mps.ohio-state.edu!linac!att!ucbvax!RALVM13.VNET.IBM.COM!DRMACRO
From: DRMACRO@RALVM13.VNET.IBM.COM ("Dr. "Eliot Kimber" Macro")
Newsgroups: comp.text.sgml
Subject: SGML query program
Message-ID: <9209141317.AA00913@ucbvax.Berkeley.EDU>
Date: 14 Sep 92 12:52:08 GMT
Sender: daemon@ucbvax.BERKELEY.EDU
Lines: 52