dlite-mapping#
Map instances of one metadata to another.
Mappings are used to map one or more instances of certain metadata to an instance of another metadata.
Mappings can be registered as plugins and invoked transparently by DLite. For this to work, DLite search all paths listed in the DLITE_MAPPING_PLUGIN_DIRS environment variable for plugins.
Typedefs
-
typedef struct _DLiteMapping DLiteMapping#
Struct describing mapping.
For each input, either the corresponding element in
inputs_maps
(if the element is the result of a sub-mapping) orinput_uris
(if the input is a provided input instance) is not NULL.
Functions
-
DLiteInstance *dlite_mapping(const char *output_uri, const DLiteInstance **instances, int n)#
Returns a new instance of metadata
output_uri
by mapping then
input instances in the arrayinstances
.This is the main function in the mapping api.
-
DLiteMapping *dlite_mapping_create(const char *ouput_uri, const char **input_uris, int n)#
Returns a new nested mapping structure describing how
n
input instances of metadatainput_uris
can be mapped tooutput_uri
.Note
In the trivial case where one of the input URIs equals
output_uri
, will the “output_uri” field in the returned mapping point tooutput_uri
. Hence, do not freeoutput_uri
as long as the returned mapping is in use.
-
void dlite_mapping_free(DLiteMapping *m)#
Free’s a mapping created with mapping_create().
-
char *dlite_mapping_string(const DLiteMapping *m)#
Returns a malloc’ed string displaying mapping
m
.
-
DLiteInstance *dlite_mapping_map(const DLiteMapping *m, const DLiteInstance **instances, int n)#
Applies the mapping
m
oninstances
(array of lengthn
of instance pointers) and returns a new instance.
-
struct _DLiteMapping#
- #include <dlite-mapping.h>
Struct describing mapping.
For each input, either the corresponding element in
inputs_maps
(if the element is the result of a sub-mapping) orinput_uris
(if the input is a provided input instance) is not NULL.Public Members
-
const char *name#
Name of mapping. NULL corresponds to the trivial case where one of the input URIs is
output_uri
.
-
const char *output_uri#
Output metadata URI
-
int ninput#
Number of inputs
-
const struct _DLiteMapping **input_maps#
Array of input sub-trees. Length: ninput
-
const char **input_uris#
Array of input metadata URIs. Length: ninput
-
DLiteMappingPlugin *api#
Mapping that performs this mapping.
-
int cost#
The total cost of this mapping.
-
const char *name#