[Date Prev][Date Next] [Thread Prev][Thread Next]
[Date Index] [Thread Index] [New search]

Database-Style Queries in structured FM

The most fundamental advantage of structured documents is the ability to parse them into their constituent components for storage in a relational or object-oriented database, where complex queries can be issued to retrieve, and or modify, selected data.

But a structured FrameMaker document or book is also a searchable database which could be searched using queries similar to those used in a database.

Unfortunately, the Find/Change feature in structured FM offers only a very rudimentary query capability.

The Find capability is limited to:
+ Finding a specified element
+ Finding a specified attribute value in all elements where is appears
+ Finding the combination of a specified element and a specified attribute value.

The Change capability is limited to:
+ Changing found element names
+ Changing found attribute names
+ Changing found attribute values

Clearly, productivity could be greatly increased by substantially expanding the Find/Change capability.

What's needed is a FrameScript or FDK client which would expand the Find/Change capability to more closely emulate the the query capabilities available when a structured FM document is exported to SGML or XML and then stored in a database. For instance:

The Find and Change capability should be expanded to include scripted expressions such as:
FIND ((ElemName = "W") OR (ElemName= "X"))
EVALUATE (AttName = "Y")
IF (VALUE = "aaa") 0R (VALUE = "bbb")
SET VALUE (AttName "Z") TO "xxx"
SET VALUE (AttName "Z") TO "yyy"
Where FIND, IF, ELSE, OR, AND, END, EVALUATE, SET, VALUE, TO, ElemName, and AttName are keywords in the expressions.

This script would find each instance of elements W and X in the file or book, evaluate attribute Y, and set the value of attribute Z accordingly in each found instance of element W or X.

The above expression would provide a viable solution to single-sourcing, where:

A. All W and X elements have attributes Y and Z.

B. AttName Y is a strings-type Effectivity attribute which lists all of the document versions in which an element's content is to be included.

C. Attname Z is a choice-type attribute having values of Show and Hide.

Execution of the script described above would set the value of the Show/Hide attribute in each found element to Show if any of the specified values of the Effectivity attribute were found, otherwise the Show/Hide attribute would be set to Hide.

Once the Show/Hide attribute is set to the proper value in all elements, the following expression would be executed to apply a Hide conditional text setting to all elements whose Show/Hide attribute is set to Hide:

EVALUATE (AttName "Show/Hide)
IF (VALUE = "Hide")
SET VALUE (CondText) TO "Hide"
Where EVALUATE, IF, SET, VALUE, TO, and CondText are expression keywords, and Hide is a predefined conditional text setting.
There are many other possibilities using this approach. For instance, it would be nice if you could search for cases where you want to find instances of an element when it is a nested child of a particular parent element, the following expression would be used:
FIND (ElemName = "A") WITH (NestedChild = ElemName "B")

Where FIND, ElemName, WITH, and NestedChild are keywords in the expression.

This script would find every instance in which element B is a nested child of element A.

The syntax of these expressions is easy to grasp, even by those without programming experience.

I can envision a FrameScript or FDK client which, upon its invocation, would open a dialog box allowing the user to type in the appropriate script using the syntax described above. Upon clicking a Go button, FrameScript or the FDK client would check the script for errors, and, if the script is error-free, it would execute the script.

FrameMaker/FrameMaker+SGML Document Design & Database Publishing
DW Emory <danemory@xxxxxxxxxxxxxxxxxx>

** To unsubscribe, send a message to majordomo@xxxxxxxxx ** ** with "unsubscribe framers" (no quotes) in the body. **