Determines whether a specified instance type is a subtype of another specified instance type. This operation will return sdaiTRUE if the instance type specified by the <subtypeEntity> argument is the same or a subtype of the instance type specified by the <supertypeEntity> argument, else sdaiFALSE will be returned.
Related function: edmiRemoteIsSubtypeOfBN
Header:
#include "sdai.h"
Prototype:
EdmiError edmiRemoteIsSubtypeOf(SdaiServerContext serverContextId,
SdaiEntity subtypeEntityId,
SdaiEntity supertypeEntityId,
SdaiBoolean *isSubtypeOf,
SdaiInvocationId *edmiInvocationId);
Arguments:
serverContextId |
Context identification, from edmiDefineServerContext |
subtypeEntityId |
The numeric entityID that uniquely identifies the assumed entity subtype within the the remote _EDMdatabase{_}. |
supertypeEntityId |
The numeric entityID that uniquely identifies the assumed entity supertype within the the remote _EDMdatabase{_}. |
isSubtypeOf |
A variable that will receive sdaiTRUE if the entity <subtypeEntityId> is a subtype of the entity <supertypeEntityId>. |
edmiInvocationId |
Currently not used. |
Returns:
A completion code of datatype EdmiError is the returned function value. The completion code has the following values:
Completion code = 0 : Operation successfully performed.
Completion code != 0: Error in operation. Completion code is an _EDMinterface_ error code. Use edmiGetErrorText to get the error text corresponding to the error code.
Example:
/*
SCHEMA Relations
ENTITY Person;
PID : INTEGER;
Name : STRING;
END_ENTITY;
ENTITY Man SUBTYPE OF Person;
. . .
HasBeard : BOOLEAN;
. . .
END_ENTITY;
ENTITY Woman SUBTYPE OF Person;
. . .
HasGivenBirth : BOOLEAN;
. . .
END_ENTITY;
END_SCHEMA;
*/
EdmiError rstat;
SdaiInteger nWrn, nErr;
SdaiServerContext myContext;
SdaiEntity manEID, personEID;
SdaiBoolean isSubType;
SdaiModel modelId;
/* Define Remote Server Context */
rstat = edmiDefineServerContext("MyRemoteServerContext",
"Johnny", "Supervisor", "cf37ftr",
"TCP", "9090", "MyServerHost",
NULL, NULL, NULL, NULL, NULL, &myContext);
/* Compile the schema */
rstat = edmiRemoteDefineSchema(myContext, EXPRESS_SCHEMA_TYPE,
"c:/data/Relations.exp", "c:/tmp/Relations.dia",
"Relations", 0, &nWrn, &nErr, NULL);
/* Create the MyRelations model */
rstat = edmiRemoteCreateModel(myContext, "JohnnysRepository",
"MyRelations", "Relations", 0, NULL);
/* Get the model Id */
rstat = edmiRemoteGetModelBN(myContext, "JohnnysRepository",
"MyRelations", &modelId, NULL);
/* Get Man entity Id */
rstat = edmiRemoteGetEntity(myContext, modelId,
"Man", &manEID, NULL);
/* Get Person entity Id */
rstat = edmiRemoteGetEntity(myContext, modelId,
"Person", &personEID, NULL);
/* Is man subtype of person? */
rstat = edmiRemoteIsSubtypeOf(myContext,
manEID, personEID, &isSubType, NULL);
printf("\nMan is%s subtype of person",
isSubType ? "" : "n't");
. . .