A Typical Use Case: Matching People
In this section, you can learn about TIBCO Patterns concepts by working through a set of examples in connection with a typical use case: finding matches in a table representing people. First load a table and then search it, using both simple queries and more advanced queries. You can also learn how to add capabilities to the search such as a thesaurus to catch nicknames and other variants of a name, and predicate expressions to automatically filter the result set based on the contents of a field.
For our purpose in this section, you must work through these examples using Java™, the Patterns NSC command line tool, and some sample programs. The Patterns NSC command line tool allows you to load data from local files into a running instance of TIBCO Patterns. The sample programs demonstrate how to design and submit queries, and visualize results. Only features that directly pertain to our set of examples are illustrated here. For a complete reference on the use of the NSC command line tool, see TIBCO Patterns Server Command Line Interface.
| • | Starting TIBCO Patterns Server |
| • | Loading a Table of Person Data |
| • | Loading a Thesaurus of Nicknames |
| • | Building and Executing Queries |
Starting TIBCO Patterns Server
On Windows, you can start TIBCO Patterns server as a standalone process, or as a Windows service.
Run as a Standalone Process
To run TIBCO Patterns server as a standalone process,
-
From the command prompt, go to the
PATTERNS_HOME\server\binfolder. -
Run the following command:
TIB_tps_server.exe *.*.*.*
For options, see "Running the TIBCO Patterns Server" in TIBCO® Patterns Installation.
This starts the server as a standalone process and instructs it to accept connections from clients at any IP address.
- The server accepts connections from the local host (IP address
127.0.0.1) and any addresses given on the command line (this is called the authentication list). Addresses given on the command line can include wildcards and subnet mask lengths, for instance129.48.34.*; 192.168.*.*;or129.48.34.0/24. - For additional information about TIBCO Patterns command-line arguments, see TIBCO® Patterns Installation.
The newly started TIBCO Patterns server listens on the default port 5051
Windows Service
To run TIBCO Patterns as a Windows service, run the Windows sc program as Administrator to install the service. The command is as follows:
sc create "TIBCO Patterns Server version" binpath= PATTERNS_HOME\server\bin\TIB_tps_server.exe
Note the space after binpath=, and ensure that you specify the correct path to the server.
Optionally, select Install as a Windows Service during product installation to start TIBCO Patterns server as a Windows service.
Now use the Services applet to control the service called “TIBCO Patterns Server version”. You can find the applet in the Control Panel under Administrative Tools, but the position of the applet might differ depending on the version of Windows on your machine. With the applet, you can start and stop the service. To remove the service, use the following command:
sc delete "TIBCO Patterns Server version"
Loading a Table of Person Data
Here are the steps to load a sample table containing 10,000 rows of person records:
- Procedure
-
Review
$PATTERNS_HOME/java/sample/data/persons.csvusing a text editor. For Patterns installed at$TIBCO_HOME, $PATTERNS_HOMEis$TIBCO_HOME/tps/6.1.2. -
Load
persons.csvin a Patterns table.cd $PATTERNS_HOME java -jar NSC/bin/NSC.jar -cmd tblload -table person -file java/sample/data/persons.csv -fieldnamesfirst
This lists the statistics for the loaded table, including the number of records.
$PATTERNS_HOME\tps\6.1.2>java -jar NSC/bin/NSC.jar -cmd tblload -table person -file java/sample/data/persons.csv -fieldnamesfirst Copyright (c) 2000-2024 Cloud Software Group, Inc. All rights reserved. Cloud Software Group, Inc. Confidential & Proprietary Information.
TIBCO® Patterns Server Commands (NSC): Version - 6.1.2 >>> nsc start. List: GENERIC DBDESCRIPTOR: person OBJ_ID: a62c5e34-3a52-43c7-90aa-6f2163f43b2b CHECKPOINT_STATUS: Automatic TRAN_ID: 1037 TRAN_OBJ_STATE: 10 DBINFO: DBNUMFIELDS: 7 FIELDNAMES: ["last","first","ssn","street","city","state","zip"] FIELDTYPES: [ 5, 5, 5, 5, 5, 5, 5] FIELDBYTECOUNTS: [ 63348, 50387, 45108, 170818, 88926, 20028, 49707] FIELDCHARCOUNTS: [ 63348, 50387, 45108, 170818, 88926, 20028, 49707] CHARMAPS: ["=STD=","=STD=","=STD=","=STD=","=STD=","=STD=","=STD="] DBGIPFILTER: true DBGIPGPU: false DBSORTFILTER: false DBPSIFILTER: false DBNUMRECORDS: 10014 DBKEYTREEKBYTES: 96 DBRECFIELDKBYTES: 524 DBHEADERKBYTES: 246 DBIDXTOTALKBYTES: 3120 DBTOTALKBYTES: 5406 TABLE_TYPE: Standard >>> nsc end.
Loading a Thesaurus of Nicknames
Since the data in a sample table includes names, load a thesaurus containing nicknames or variants of a name. A thesaurus lets us equate certain words, or even phrases, that are textually dissimilar such as the name “Margaret” and the nickname “Peggy”.
The thesaurus capability of TIBCO Patterns works in concert with inexact or fuzzy matching based on textual similarity. A certain level of error-tolerance is even supported in the recognition of terms with thesaurus equivalents.
-
Using a text editor, review
PATTERNS_HOME/java/sample/data/nicknames.csv. -
Load nicknames.csv into a Patterns thesaurus
cd $PATTERNS_HOME java -jar NSC/bin/NSC.jar -cmd thcreate –thesaurus nicknames -file java/sample/data/nicknames.csv -local
-
The output is as follows:
$PATTERNS_HOME\tps\6.1.2>java -jar NSC/bin/NSC.jar -cmd thcreate -thesaurus nicknames -file java/sample/data/nicknames.csv -local Copyright (c) 2000-2024 Cloud Software Group, Inc. All rights reserved. Cloud Software Group, Inc. Confidential & Proprietary Information TIBCO® Patterns Server Commands (NSC): Version - 6.1.2 >>> nsc start. Thesaurus created >>> nsc end.