sdaiCreateModel
Creates a new model in the specified repository in the EDMdatabase. A model is a logical container for entity instances defined by one EXPRESS schema. This schema will be the underlying schema of the new model and this particular schema must exist as a dictionary model in the EDMdatabase before this function can be successfully performed. Only data models can be created by this function. Any number of models of the same EXPRESS schema can exist in an EDMdatabase.
The new model will be closed after creation, hence one of the functions sdaiOpenModel or sdaiOpenModelBN must be performed on the model before any access to it is permitted.
A numeric modelID that uniquely identifies the created model in the EDMdatabase is returned. This modelID should be used in subsequent EDMinterface operations to identify the actual model. The model name qualified with the related repository name will also uniquely identify a model in an EDMdatabase.
The executing EDMuser will be the owner of the new model and the current EDMgroup account of the executing EDMuser will be the owner group of the model. The owner and owner group of a model is relevant for access rights to the model in subsequent sdaiOpenModel and sdaiOpenModelBN operations. The model protection will be set according to the default model protection of the executing EDMuser.
The repository that will hold the new model must be open before this function can be successfully performed.
Related functions: sdaiCreateModelBN , edmiCreateModel ,edmiCreateModelBN , sdaiOpenModel , sdaiOpenModelBN , sdaiDeleteModel , edmiDeleteModel , edmiDeleteModelBN , edmiDeleteOpenModel
Header:
#include "sdai.h"
Prototype:
SdaiModel sdaiCreateModel(SdaiRepository repository,
SdaiString modelName,
SdaiSchema schema);
Arguments:
repository |
A numeric repositoryID that uniquely identifies the repository in the EDMdatabase that will hold the new model. This repository must be open. |
modelName |
Specify the name of the new model. A model name must start with a letter and the rest of the model name can optionally be any mix of any alphanumeric character and the underscore character. Model names are case sensitive. A model name must be unique within the repository that holds the model. |
schema |
A numeric schemaID that uniquely identifies an EXPRESS schema in an EDMdatabase that will be the underlying schema of the new model. This schema defines all possible instance types that can be created in the actual model. This particular EXPRESS schema must exist as a dictionary model in the EDMdatabase before this operation can be successfully performed. The schemaID identifier is returned by the edmiGetSchema function. |
Returns:
A numeric modelID that uniquely identifies the new model in the actual EDMdatabase. This modelID should be used to identify this particular model in subsequent EDMinterface operations.
modelID != 0 : operation successfully performed.
modelID = 0 : operation failed, use sdaiErrorQuery function to get error reason.
Example:
SdaiRepository repository;
SdaiSchema schema;
SdaiModel modelId;
...
modelId = sdaiCreateModel(repository, "Building_AXD67H", schema);
if (! modelId) {
/* Error in operation */
printf("\nError: %s in sdaiCreateModel \n",
edmiGetErrorText(sdaiErrorQuery()));
goto error;
}
. . .