Activity Example – Patterns

Activity Example – Patterns
Example Description
The Patterns example illustrates how the Patterns Query, Patterns Table Operations, Patterns
Record Operations, Patterns Mapper, and Patterns Table Information activities can be used to
send requests and receive responses from the TIBCO® Patterns server. The Patterns example
can be extracted from the PatternsSample.designertemplate contained within the
examples/activities directory under the plugin home directory.
Resources
Folder
File
PatternsSample index.html
Description
Webpage used with the HTTP_PageHandler sample.
PatternsSample style.css
Cascading style sheet used by index.html.
Data
names.csv
Comma separated value file used to load
names into the TIBCO® Patterns server
names table. Used by the “Create names
table and nicknames Thesaurus from csv
files” process.
Data
ComplexQuerySimpleAndCognate Input schema for the “Complex Query of
names table” process.
Data
nicknames.csv
A thesaurus of nicknames used in loading
the nicknames thesaurus table. Used by
the “Create names table and nicknames
Thesaurus from csv files” process.
Data
names extract for batch run.csv
A comma separated value file used as a
batch input within the “Batch Query CSV”
and “Batch Query HTML” processes.
Data
DynamicQueryData
Xml data used by the DynamicQuery
example.
Data
StaticQueryData
Xml data used by the StaticQuery
example.
js
*
Ajax installation required by index.html
Folder
File
Description
Processes
AllInOne
Processes
Batch Query CSV
Processes
Batch Query HTML
Processes
Batch Query Auto Multi CSV
A process which creates an employee table
from the employee.csv file. It incorporates
all of the Patterns activities. The Patterns
Table Operations activity, which is
configured to delete the employee table, is
set aside since the employee table will not
exist when the engine is first started. After
this process is run the first time, or if the
employee table exists, then this activity can
be placed after the start node, and the
process can be run repeatedly. This process
demonstrates setting a field to a specific
type. In this case, HIRE_DATE to date using
“date” as the FieldType, and SALARY to an
integer using “integer” in the FieldType. In
addition, the Patterns Query uses a
Predicate defined in the Advanced tap to
demonstrate filtering based upon the
HIRE_DATE field within the reference table
and a Percentage CutoffType with a
CutoffValue of 90%.
A process used to submit a batch file
containing multiple rows of query data to a
Patterns Query and write the responses to a
CSV file. Uses the Patterns Query activity.
A process used to submit a batch file
containing multiple rows of query data to a
Patterns Query and write the responses to a
HTML file. Uses the Patterns Query activity.
A process used to submit a batch file
containing multiple rows of query data to a
Patterns Query and write the responses to a
CSV file. This is a more generic version of
Batch Query CSV where it can accept input
files with one to eight fields and configure
the query accordingly. Uses the Patterns
Query activity.
Folder
File
Processes
Batch Query Auto Multi HTML
Processes
Call-MatchingEngine
Processes
Complex Query of names table
Processes
Create HR_employee table using
Oracle datasource
Processes
Create names table and
nicknames Thesaurus from csv
files
Processes
DeDup
Processes
Delete names Table
Processes
DynamicQuery
Description
A process used to submit a batch file
containing multiple rows of query data to a
Patterns Query and write the responses to a
HTML file. This is a more generic version of
Batch Query CSV where it can accept input
files with one to eight fields and configure the
query accordingly. Uses the Patterns Query
activity.
A subprocess which is called by the “HTMLPage-Handler” process and accepts a query
string, invokes a Patterns Query, and formats
the response suitable for index.html. Uses
the Patterns Query activity.
A process which accepts an XML document
from the start node and maps it to a Patterns
Query for execution. Data is provided in the
Data directory with a file name of
“ComplexQuerySimpleAndCognate”. Uses the
Patterns Query activity.
A process which loads the HR_employee
table from the HR.employee table. Uses the
Patterns Record Operations activity.
A process which loads the names table and
the nicknames thesaurus from the names.csv
and nicknames.csv files. Uses the Patterns
Table Operations activity.
A process which looks for duplicates within
the “names” table. It is configured to start
looking for duplicates starting at record 1350
for 50 records. Uses the Patterns Record
Operations and Patterns Query activities.
A process which deletes a table from the
TIBCO Patterns server. Uses the Patterns
Table Operations activity.
A process used to demonstrate configuration
and data contained within the input request
document. Uses the Patterns Query activity.
Folder
File
Processes
StaticQuery
Processes
Processes
Process
Process
Process
Process
Results
Results
Schemas
Schemas
Schemas
Schemas
Schemas
Schemas
Description
A process used to demonstrate statically configuring
the Patterns Query activity and accepting only data in
the input request document. This also demonstrates
the Patterns Mapper.
HTML_Page-Handler
This process listens for HTTP requests, accepts a query
string from index.html, calls the Call-MatchingEngine
process, receives its response, and replies back to
index.html with the matching result.
QueryletExample
This process uses QueryleyBuilder, Querylet Combiner,
and QueryletExecuter to demonstrate a more complex
query.
HTTP Connection
HTTP listener address for the Tomcat server used by
HTML_Page-Handler.
Patterns Connection
Shared connection configured for the TIBCO Patterns
server host and port address and is used by all of the
Patterns activities.
JDBC Connection
Oracle XE JDBC connection used by the “Create
HR_employee table using Oracle datasource” process.
The password will need to be changed to run the
database load example.
Simple Query of names A simple query example. Uses the Patterns Query
table
activity.
batchQueryResults.csv Output from the “Batch Query CSV” process.
batchQueryResults.html Output from the “Batch Query HTML” process.
Data Format Batch
Data Format activity used to parse the data from the
testQueries.csv batch file.
Data Format employee Data Format activity used to parse the data from the
employee.csv file for input into Patterns Record
operations. Uses all the Patterns activities.
QueryInputClass
Schema used by the start node of the “Complex Query
of names table” process.
QueryOutputClass
Schema associated with the QueryOutputClass of the
Patterns Query activity.
RecordInputClass
Schema associated with the RecordInputClass of the
Patterns Record Operations activity.
TableInputClass
Schema associated with the TableInputClass of the
Patterns Table Operations activity.
The Patterns Example works as follows:









All of the examples depend upon the Global Variable “ProjectDirectory” being set to the
PatternsSample directory. It is set to
“C:\TIBCO_my\Netrics\BusinessWorks\projects\PatternsSample” by default. Set this
variable to point to your PatternsSample project directory before you begin.
It assumes the TIBCO® Patterns server is running on localhost and listening to port
5051. If this is incorrect, modify the “Patterns Connection” within the “Processes”
directory to your specific environment and if necessary start the TIBCO® Patterns
server.
Load the names table and nicknames thesaurus by using the Designer Tester and Tester
for the “Create names table and nicknames Thesaurus from csv files” process. It expects
no input. Review the output from each activity within the process.
Perform a query using the “Complex Query of names table” process using the Designer
Tester and review the output of each activity. Enter “names” in Table field and “Brown”
in QueryString field, and click OK. You can also load data from project with the Designer
Tester for this query by pointing to the Data\ComplexQuerySimpleandCognate.
The “Delete names Table” process can be used to delete the names table to
demonstrate the deletion of tables. Rerun the “Create names table and nicknames
Thesaurus from csv files” process to recreate the names table.
To simulate batch input to a Patterns Query to create a csv file as output, use the
Designer Tester to run the “Batch Query CSV” process, and review the output file
batchQueryResults.csv contained within the “Results” directory of the PatternsSample
project directory.
To simulate batch input to a Patterns Query to create a HTML file as output, use the
Designer Tester to run the “Batch Query HTML” process, and review the output file
batchQueryResults.html contained within the “Results” directory of the PatternsSample
project directory.
To simulate looking for duplicates within a single table, run the “DeDup” process using
the Designer Tester facility. It expects as input, the starting record number, the ending
record number and the table to be processed. It requires that the TIBCO® Patterns
table have an ascending primary key without gaps between records. The resulting html
file is created in the “Results” directory with a file name of “deDupResults.html”.
To simulate sending an XML document to a process for more complex queries, use the
“Complex Query of names table” process in conjunction with the Designer Tester.
1. Right click on the start node.
2. Select Load from Project, and expand the Data folder.
3. Select QuerySimpleAndCognate, and click OK.
4. Run the process and review the results.






To simulate sending an XML document to a process for more complex queries, use the
“DynamicQuery” process in conjunction with the Designer Tester.
1. Right click on the start node.
2. Select Load from Project, and expand the Data folder.
3. Select DynamicQueryData, and click OK.
4. Run the process and review the results.
To simulate sending an XML document to a process for more complex queries, use the
“StaticQuery” process in conjunction with the Designer Tester.
1. Right click on the start node.
2. Select Load from Project, and expand the Data folder.
3. Select StaticQueryData, and click OK.
4. Run the process and review the results.
To specify a logical operator in building a more complex query using QueryletBuilder,
QueryletCombiner and the QueryletExecuter, use “QueryletExample”.
To simulate creating and loading a table from an Oracle datasource, use the “Create
HR_employee table using Oracle datasource” in conjunction with the Designer Tester.
This will require a review of your existing Oracle configuration. The sample uses the
HR.employee table within the XE Oracle database. The password associated with HR in
the JDBC connection will need to be changed to the password for your database. The
process requires no input. Run the process and review the output associated with each
activity.
To simulate “autocomplete” from an html page (index_multiField.html) use the “CallMatchingEngine” and the “HTML-Page-Handler” processes. Start the HTML-PageHandler process using the Designer Tester and double-click outside of the Designer on
the index_multiField.html file located in the PatternsSample project directory. Then
type in a match string or strings in the Text box displayed within the browser. The
results are displayed.
To exercise all of the Patterns activities, use the “AllInOne” process.