edmiConditionalDeepCopyInstances

EdmiError edmiConditionalDeepCopyInstances(SdaiInstance *sourceInstanceId,
                                            SdaiModel    modelId,
                                            SdaiInteger  options, 
                                            SdaiEntity   *exclude_or_include,
                                            SdaiInstance **newInstancesId);



Copies a selection of application instances either within an edmModel> or between two edmModels. Optionally, this function may copy only the selected instances or their entire instance graphs. An instance graph is the resulting grid of application instances that appear when all referenced application instances are included recursively. Hence, a single application instance may comprise a great number of internally chained instances in its instance graph. The target instances will implicitly be created, hence copying between existing instances cannot be performed by this operation. The edmModel containing the source instance must be open for read access and the target edmModel must be open for write access before this operation can be successfully performed.

Arguments


TypeNameComment
SdaiInstance

*sourceInstanceId

A null-terminated buffer containing the instanceIDs of all the application instances to be copied.

SdaiModel

modelId

The numeric modelID that uniquely identifies the edmModel in which to create the target instances.
The target and source models must be a populations of the same express schema.

SdaiInteger

options

See detailed descriptions of the available options below.
The options can be specified as a bitwise OR between the actual options to enable. All option names are defined on the header file sdai.h.

SdaiEntity

*exclude_or_include

An optional null-terminated buffer containing either application instanceIds or instance types (entityIds). The interpretation of the buffer contents and the actions taken depends on the value of the <options> argument.

SdaiInstance

**newInstancesId

A pointer variable that will receive the address of an allocated buffer containing all the instanceIds created in the target model. Use edmiFree to release the allocated memory.

Return Value


Error rendering macro 'excerpt-include' : User 'null' does not have permission to view the page 'US:_r_EDMInterface'.

 

Options


OptionComment

INCLUDE_TYPES

Only instance types (represented by their entityIds) listed in the <exclude_or_include> buffer argument will be copied. Add the SUBTYPES option to include all subtypes of the types listed in the <exclude_or_include> buffer. The option values INCLUDE_TYPES , EXCLUDE_TYPES and EXCLUDE_INSTANCES are mutually exclusive.

EXCLUDE_TYPES

Only instance types (represented by their entityIds) that are not listed in the <exclude_or_include> buffer argument will be copied. Add the SUBTYPES option to exclude all subtypes of the types listed in the <exclude_or_include> buffer. The option values INCLUDE_TYPES , EXCLUDE_TYPES and EXCLUDE_INSTANCES are mutually exclusive.

SUBTYPES

This option extends the INCLUDE_TYPES and EXCLUDE_TYPES options. When used, the list of entityIds in the <exclude_or_include> buffer will be extended with the entityIds of any subtype of the instance types listed therein.

EXCLUDE_INSTANCES

The instances contained in the <exclude_or_include> buffer will not be copied to the target model. The option values INCLUDE_TYPES , EXCLUDE_TYPES and EXCLUDE_INSTANCES are mutually exclusive.

COPY_SHALLOW

Only the application instances explicitely listed in the <sourceInstanceId> buffer will be copied. This option prevents recursive copying of all the referenced instances that constitute the instance graph. When the source model and the target model are the same, the instance references in the source instance will be copied to the target instance.

EXCLUDE_ALL_INSTANCES

Only the application instances explicitly listed in the <sourceInstanceId> buffer will be copied. The copying will be shallow, i.e this option prevents recursive copying of all the referenced instances that constitute the instance graph. When the source model and the target model are the same, the instance references in the source instance will not be copied to the target instance. Only attributes of primitive data types, including aggregates of primitive data types, will be copied.

  

 

Example


 

 EdmiError rstat;
 SdaiRepository repId;
 SdaiModel srcModelId;
 SdaiModel tarModelId;
 SdaiInstance friends[NBUFF+1];
 SdaiInteger index = 0, nHits = NBUFF;
 SdaiEntity exclude[2];
 SdaiInstance *myFemaleFriends;
  
 rstat = edmiOpenRepositoryBN("DataRepository", sdaiRW, &repId);
 srcModelId = sdaiOpenModelBN(repId, "MyFriends", sdaiRO);
 tarModelId = sdaiOpenModelBN(repId, "MyNorwegianFemaleFriends", sdaiRW);
  
 rstat = edmiSelectInstancesBN(srcModelId, "PERSON",
 "NATIONALITY = 'NOR'", SUBTYPES, NBUFF, 
 &index, &nHits, &friends[0]); 
 friends[NBUFF] = 0;
 exclude[0] = sdaiGetEntity(srcModelId, "MALE");
 exclude[1] = 0;
  
 if (rstat = edmiConditionalDeepCopyInstances(friends, tarModelId,
 EXCLUDE_TYPES, exclude, 
 &myFemaleFriends)) { 
 printf("\nError %d in edmiConditionalDeepCopyInstances: %s", rstat, 
 edmiGetErrorText(rstat)); 
 goto err; 
 }
 . . .

 

See also

Filter by label

There are no items with the selected labels at this time.