Description

Reviews a string and divides it into "words," the boundaries of which are determined by delimiters you specify. XREF will exclude words according to a stop list or include words according to a go list.

Syntax

XREF(array, delimiters, stop_list, mode)

Parameters

XREF is a module used by native tables cross reference indexing. Cross reference indexing differs from full Btree indexing in that cross reference breaks data strings into individual words before building the Btree cross reference index.

The array that you pass to XREF is returned, value mark-delimited, in @ANS. XREF does not keep track of the location of each word in the original data.

XREF operates in one of four modes. It will use a default stop (or exclusion) list, a user-specified stop list, or a combination of the two. Alternatively, you can reverse the logic and use the stop list as the list of words to be found rather than ignored; that is, a go list.

The XREF subroutine has the following parameters:

ParameterDescription
arrayUsed to pass data to XREF. The values in array must be value mark-delimited; XREF treats all other system delimiters as text.
delimitersA string of characters that are word boundaries. Common delimiters include the space character, "," (comma), "'" (apostrophe), ";" (semicolon), and "." (period). If you want XREF to return individual words, you must include the space character among these delimiters. Otherwise, space-delimited values will be returned as one long word.
stop_listUsed for two purposes:

Identify the words that appear in array that you do not want to appear in the string that is returned @ANS.

-OR-

Identify the words that you want to search for in array. In this case, XREF returns in @ANS only the words in stop_list that are also in array.

mode

Determines how XREF handles the values both in stop_list and in the system stop list, which is stored in the system variable @DEFAULT.STOPS.

ModeDescription
1Exclude words in the default stop list.
2Exclude words in the default stop list, plus those in stop_list.
3Exclude only words in stop_list.
4Include only words in stop_list.

Example

/* The following code provides an array of data items for evaluation by XREF.
XREF is instructed to regard spaces, commas, apostrophes, and semicolons as word delimiters.
All standard OpenInsight data delimiters are converted to value marks.
The default stop list is used, 
to which is appended a user-supplied list of the letter "s" (to ignore an apostrophe "s").
Both stop lists are then utilized by specifying by a MODE argument of 2.
The system stop list (@DEFAULT.STOPS) is in uppercase letters, 
so you must convert your data to uppercase (using TOUPPER, as an option) before evaluating it with  XREF. */
 
declare subroutine Xref, Toupper, Msg
 
array  = "Revelation Software, Inc.":@SVM
array<-1>     = "Ralph Waldo Emerson; writer"
array<-1>     = "Phil Rizzuto's spouse":@FM:"Dom Dimaggio"
 
delimiters    = ",';."
 
stop_list     = "s":@VM:"S"
* to ignore the apostrophe s
mode = 2
 
TRANSFER array to @ANS
Toupper()
Convert @TM:@SVM:@VM:@FM:@RM TO @VM:@VM:@VM:@VM:@VM IN @ANS
 
Xref(@ANS, delimiters, stop_list, mode)
 
text  = QUOTE(@ANS)
Msg(@window, text)
  • No labels