Catalog Modeler |
Using QueryUsing CATICatalogQuery,CATICatalogQueryResult |
|
Use Case |
AbstractThis use case shows how to filter a chapter to retrieve specific descriptions. |
Users often need a way of storing and classifying the many objects they have at their disposal, whether they be screws, ball bearings or computer parts. These objects may number tens of thousands, each with its own specific characteristics such as shape, color, size, diameter, length, etc. To facilitate fast and easy retrieval of such objects thus objects avoiding time-wasting redesign Version 5 offers the possibility of creating catalogs.
The catalog is made up of chapters. The chapters contains keywords to enhance the classification. The goal of this article is to show the usage of two interfaces:
This interface is implemented by the chapter and enables to filter its descriptions.
This interface is implemented by an object which is the result of the query applied to the chapter. On this object you retrieve the filtered descriptions.
Before getting to the use case itself, it is important to already be familiar with the basic notions of Catalog. See the referenced article [1] for a detailed overview.
[Top]
CAACciCatalogQuery is a use case of the CAAComponentsCatalogs.edu framework that illustrates ComponentsCatalogsInterfaces framework capabilities.
[Top]
The "Creating a Catalog" use case [2] explains the creation of the CAATool
catalog.
This catalog contains the Nuts
chapter which has the SideNumber
keyword
This use case makes a query to filter the descriptions whose the "SideNumber
"
keyword value is equal to 6.
[Top]
To launch CAACciCatalogQuery , you will need to set up the build time environment, then compile the CAACciCatalogQuery module along with its prerequisites, set up the run time environment, and then execute the use case [3].
mkrun -c CAACciCatalogQuery InputPath
Where:
InputPath : The path of theCAATool.catalog
fileYou can use
those located in CAA
ComponentsCatalogs
.edu/InputData
InstallRootDirectory/CAA
ComponentsCatalogs
.edu/InputData
InstallRootDirectory\CAA
ComponentsCatalogs
.edu\InputData
where InstallRootDirectory
is the directory where the CAA
CD-ROM is installed.
[Top]
The CAACciCatalogQuery use case is made of a file, CAACciCatalogQueryMain.cpp, located in the CAACciCatalogQuery.m module of the CAAComponentsCatalogs.edu framework:
depending on operating system you find them :
Windows | InstallRootDirectory\CAA ComponentsCatalogs .edu\CAACciCatalogQuery.m\ |
Unix | InstallRootDirectory/CAA ComponentsCatalogs .edu/CAACciCatalogQuery.m/ |
where InstallRootDirectory
is the directory where the CAA CD-ROM
is installed.
[Top]
In the CAACciCatalogQueryMain.cpp file you have two mains steps
[Top]
The CAATool
catalog contains the Nuts
Chapter [Fig
1].
The FindChapter
method retrieves it because it is not an external
chapter.
... CATUnicodeString NutsChapter = "Nuts" ; CATICatalogChapter * piNutsChapter = NULL ; rc = pICatalogChapterFactory->FindChapter(NutsChapter,piNutsChapter); ... |
Where pICatalogChapterFactory
is the CATICatalogChapterFactory
interface pointer on the root container of the CAATool
catalog. The
use case "Creating a Catalog" [2] explains
how to retrieve this pointer.
A filtering on a chapter is done thanks to the CATICatalogQuery interface .
... CATICatalogQuery * piCatalogQueryOnNutsChapter = NULL ; rc = piNutsChapter->QueryInterface(IID_CATICatalogQuery, (void **) &piCatalogQueryOnNutsChapter); ... |
piCatalogQueryOnNutsChapter is the CATICatalogQuery
interface pointer on the Nuts
Chapter.
The expression of the filter has a knowledgeware syntax:
... CATUnicodeString Expression = "(x.SideNumber==6)"; ... |
The other available operators are
In applying the Query
method with the knowledgeware filter (Expression
)
the result is a QueryResult object. This object implements the CATICatalogQueryResult
interface.
Advice: the Query
method is not recursive. The research is done
on the descriptions of the chapter. It means that if descriptions have links
towards sub-chapters, the descriptions of those chapters are not explored.
... CATICatalogQueryResult * pIQueryResult = NULL; rc = piCatalogQueryOnNutsChapter->Query(pIQueryResult,Expression); ... |
The list of descriptions filtered by the expression is retrieved by the AsAList
method.
... CATListValCATICatalogDescription_var * pListDescription = NULL; rc = pIQueryResult->AsAList(pListDescription); ... |
[Top]
This use case illustrates the usage of the CATICatalogQuery and CATICatalogQueryResult interface.
[Top]
[1] | Catalog Overview |
[2] | Creating a Catalog |
[3] | Building and Launching a CAA V5 Use Case |
[Top] |
Version: 1 [Jul 2002] | Document created |
[Top] |
Copyright © 2002, Dassault Systèmes. All rights reserved.