edmiSelectInstancesBN
EdmiError edmiSelectInstancesBN(SdaiModel modelId, SdaiString entityName, SdaiString condition, SdaiInteger options, SdaiInteger maxBufferSize, SdaiInteger *index, SdaiInteger *numberOfHits, SdaiInstance *resultBuffer);
Search in the specified model for instances of the specified type that match the specified condition. Optionally all subtype instances of the specified type will be search as well. The condition is specified as any legal symbolic Express-X logical expression. All instances of the specified type in the specified model will match an empty condition, i.e. the <condition> argument set to NULL. Each matching instance is identified by a numeric instanceID that uniquely identifies an instance in the EDMdatabase All possible matching instances will be collected in a temporarily aggregate, hence this aggregate will be queried for matching instances. The index of the first aggregate element to test for an instance that match the specified condition, and the maximum number of matching instances to return, are specified as input arguments to the function. The actual number of matching instances returned and the "index of the last returned matching instance in the aggregate" are returned from the operation. This makes it convenient to query the aggregate by the edmiSelectInstancesBN function in an incremental way. The <condition> argument will be compiled by the EDMexpressXCompiler. The specified query will fully be executed by the EDMexpressVM. The actual model to query must be open before this operation can be successfully performed. When the input arguments <maxBufferSize> == 0 & <resultBuffer> == NULL no instanceId or elementNumber will be returned. Only the number of matching instances/elements will be returned. The total number of hits will be returned in the <numberOfHits> argument. The argument <index> is not updated.
Arguments
Type | Name | Comment |
SdaiModel | modelId | A numeric modelID that uniquely identifies the data model of interest in the EDMdatabase . The modelID is returned from the functions: sdaiCreateModel , sdaiCreateModelBN , sdaiOpenModelBN , edmiGetModel , edmiGetModelBN , sdaiGetInstanceModel |
SdaiString | entityName | Specifies the name of the entity that defines the actual instance type to query. Entity names are case insensitive. |
SdaiString | condition | Specifies the condition the target instances should match. All instances in the specified aggregate match an empty condition, i.e., <condition> = NULL. All legal symbolic Express-X logical expressions are a legal <condition> value. This <condition> argument will be compiled by the EDMexpressXCompiler |
SdaiInteger | options | Specifies the options to be used in the invocation of the edmiSelectInstancesBN function. The <options> value can be specified as a bitwise OR between the actual options to enable. All option names are defined on the header file sdai.h . See detailed descriptions of the available options below. |
SdaiInteger | maxBufferSize | Specifies the size (in number of bytes) of the buffer to receive the instanceID of the matching instances. The actual number of returned matching instances will never be greater than the number of instanceID that can be placed in a buffer of the size specified by this argument. |
SdaiInteger | index |
|
SdaiInteger | numberOfHits |
|
SdaiInstance | resultBuffer | Address of a buffer in the calling application that will receive the instanceID of each returned matching instance. This buffer is mapped to a SdaiInstance array when the instanceID of each returned matching instance is stored. The <maxBufferSize> argument should prevent the function to write past buffer. |
Return Value
Options
Option | Comment |
---|---|
SUBTYPES | Specifies that in addition to all instances of the type specified by the <entityName> argument, all subtype instances of the specified type should be queried as well. |
Example
SdaiModel modelId; SdaiInteger index, numberOfHits; int i; SdaiInstance resultBuffer[MAX_ELEMENTS]; . . . index = 0; numberOfHits = MAX_ELEMENTS; if (rstat = edmiSelectInstancesBN( modelId, "Person", "(Exists(children)) AND (SizeOf(Query(c <* children | c.sex = MALE)) > 2)", SUBTYPES, sizeof(resultBuffer), &index, &numberOfHits, resultBuffer)) { /* Error in operation */ printf("\nError: %s in edmiSelectInstancesBN\n", edmiGetErrorText(rstat)); goto error; } /* Print instanceId of matching instances */ for (i = 0; i < numberOfHits; i++) { printf("\ninstanceId: %lu", resultBuffer[i]); } ...
See also
Filter by label
There are no items with the selected labels at this time.