background image
C H A P T E R 1 1
Data Storage and Retrieval
About Data Storage on Newton Devices
11-9
You can create your own specialized indexes for any soup. You need to create an
index for each slot or set of slots on which the soup will be searched frequently. It
is preferable to define your indexes in the appropriate soup definition, but you can
add indexes to an existing soup if necessary.
An index generated against a single key value is called a single-slot index. A
single-slot index selects and sorts soup entries according to the value of a single
slot specified when the index is created. An index generated against multiple key
values is called a multiple-slot index. A multiple-slot index can select and sort
soup entries according to the values of multiple slots. A multiple-slot index can
associate up to a total of six key values with each entry it indexes. You can create
multiple indexes for any soup.
The characteristics of an index are specified by an index specification frame or
index spec. The values in the index spec frame indicate the kind of index to build,
which slot values to use as index data, and the kind of data stored in the indexed
slots. The precise format of the index spec frame varies according to whether it
defines a single-slot index or a multiple-slot index. For complete descriptions of
index specs, see "Single-Slot Index Specification Frame" on page 9-5 and
"Multiple-Slot Index Specification Frame" (page 9-6) in Newton Programmer's
Reference
.
A tag is an optional developer-defined symbol used to mark one or more soup
entries. Tags reside in a developer-specified slot that can be indexed, with the
results stored in a special index called the tags index.
The tags index is used to select soup entries according to their associated symbolic
values without reading the entries into memory; for example, one could select the
subset of entries tagged
'business
from the
ROM_CardFileSoupName
soup
used by the built-in Names application. In fact, "filing" Newton data items in
"folders" is a user-interface illusion--the data really resides in soup entries and its
display is filtered for the user according to the tags associated with each soup entry.
Note that the system allows only one tags index per soup. Each soup can contain a
maximum of 624 tags. The system treats missing tags as
nil
values. For more
information, see "Tag-based Queries" on page 11-14.
A tags index specification frame, or tags index spec, defines the characteristics of
a soup's tags index. Like an index spec, a tags index spec can be used to create a
default tags index on a new soup or add a tags index to an existing soup. For a
complete description of the slots in a tags index spec frame, see the section "Tags
Index Specification Frame" (page 9-8) in Newton Programmer's Reference.
To better support the use of languages other than English, soup indexes and queries
can be made sensitive to case and diacritical marks in string values. (Normally,
string comparison in NewtonScript is insensitive to case and diacritics.) This
behavior is intended to allow applications to support the introduction of non-
English data easily; for example, the user might insert a PCMCIA card containing
© 2007-2017, o7 studio » при воспроизведении материала сайта ссылка обязательна