9.1.6 Creating data files
This section explains the specification format for and provides specification examples of CSV files (data files) that are to be imported using the jamimport command.
When creating data files, make sure that data conformity is achieved in related information and control information such as IDs.
- Organization of this subsection
(1) Data file creation units
Create one data file for each class to be imported.
For association classes, you need to create data files only when object classes are to be associated with each other by different key information. There is no need to import association classes when the same key information is used to associate object classes.
For details about the association between object classes, see 10.1.3 Types of associations.
(2) Data file specification format
The following figure shows the data file specification format.
This section describes the following items:
-
Item title line
-
Operation code
-
Key data
-
Data
(a) Item title line
The item title line always begins with OP (operation code).
Following OP, specify a property name as the title of each item. On the item title line, make sure that the key property of the class to be imported is specified.
For an association class, specify the item title line in the format class-name.property-name. Make sure the object class name is separated from the property name by a period (.). For details about the class and property names, see Chapter 20. Management Information Details.
If the imported class contains a property that is not specified in the item title line, the null data is set as the value of that property.
(b) Operation code
Specify one character indicating the type of change to the table (addition, change, deletion, no change). If more than one character is specified, only the first character is recognized.
The following table lists the characters that can be used as operation codes and their meanings.
Operation code |
Meaning |
Description |
---|---|---|
A |
Addition |
Adds the data specified in the data file. If no value is specified for a class property, the null data is added for that property. |
C |
Change |
Replaces existing data with data specified in the data file. All properties specified in the item title line are subject to this change. If no value is specified for a class property, the null data is added for that property. |
D |
Deletion |
Deletes the classes specified in the data file and the values of the properties related to those classes. |
N |
No change |
Does not import data with operation code N, treating it as being unchanged. |
R |
Comment |
Does not import the data, treating it as a comment line. |
When importing association classes, you can use only A (addition) and D (deletion). To make changes, specify data to be deleted in the data file and then add new data.
(c) Key data
Specify the key data used to determine the object of processing and the class. Make sure a value is specified.
For an object class, specify key data in the format property-name. For an association class, specify it in the format object-class-name.property-name.
Whether the data is to be changed or deleted is determined by the key data. Therefore, if you import data that had been exported and then modified, do not change its key data.
(d) Data
Specify the property value of the class to be imported.
For an object class, specify data in the format property-name. For an association class, specify it in the format object-class-name.property-name.
For data, there is no need to specify all properties in the object class. Specify only those data items that are needed as asset data. Specify the value of each property according to the specification format and limitations. For details about the specification format and limitations for each property, see Chapter 20. Management Information Details.
When there are no more property values to be set, you can omit values by placing a linefeed code immediately after the last property value. In such a case, the null data is imported for all properties following the linefeed code.
- Notes on specifying property values
-
Some property values use a code, as is the case with the asset information Asset type. For details about the properties that require specification of a code and details about the code, see 20.2 Lists of properties for object classes.
(3) Specification example of data file (object class)
This section describes an example of specifying a data file for importing an object class.
The figure below shows an example of importing data for the AssetInfo (asset information) object class, where the key for AssetInfo is AssetID (asset ID).
This example updates the asset management database as follows:
-
The device with asset ID 1 is added with the property value specified in the item title line.
-
All information about the device with asset ID 2 is changed by the property values specified in the item title line.
-
All information about the device with asset ID 3 is deleted.
All information, such as hardware and network information, that has weak association with the device with asset ID 3 is also deleted.
(4) Specification example of data file (association class)
To add or delete an association class, use operation code A (addition) or D (deletion) in the data file. You cannot use operation code C (change).
The figure below shows an example of a data file for importing data for the association class ContractMaintenanceLink (maintenance contract link). The keys for ContractMaintenanceLink are AssetID (asset ID) and ContractID (contract ID).
This example specifies the key data AssetID for the associated object class AssetInfo (asset information). On the same line, it also specifies the key data ContractID for another object class Contract (contract information).
This example updates the asset information as follows:
-
The asset with asset ID 1 is added to the target of contract ID 123456.
-
The target contract ID for the asset with asset ID 2 is changed from 000123 to 123456.