Formatting a CSV for Constraint Import
To bulk import constraints, the CSV file should be formatted as described in this article.
General Column/Data Requirements
The following column headers must exist and contain data in each row:
- Constraint_Name or Constraint_GUID
- Constraint_Type
The following columns are optional (for example, the Package columns are only there to specify destination if desired):
- Constraint_Description
- Package_Name
- Package_GUID
- LB
- UB
- LB_Inclusive
- UB_Inclusive
- Regex
The order of the columns is not enforced, it does not have to be in the same order as the suggested format above.
Any additional user-made columns will be ignored and will not interfere with import.
Bulk import can currently import Package and Constraint elements.
Column-specific Requirements
Constraint Name, Constraint_GUID
- Either a Constraint Name or Constraint GUID is required. If a Constraint GUID is given, it must be associated with an existing constraint in the model.
Constraint Type
- Must be one of the following values: Integer, String, Real.
Package Name, Package GUID
- Leaving this column blank will default Package to the "Phenom" package.
- Setting this column to an existing Package will default to the first matching Conceptual Package within the model.
- If there is no matching Package, a new Package will be created within the "Phenom" Package.
- If a Package GUID is given, it must reference an existing UoP package in the model.
LB, UB
- Denote the lower and upper bounds for a constraint.
- Must be a number.
LB Inclusive, UB Inclusive
- Must be a boolean: true, false.
Regex
- Does not need to be valid regex.
Additional Requirements
- Data within Package_Name and Constraint_Name must all begin with a letter, and only contain numbers, letters, or underscores. The data must also not match any of the following reserved words:
- IDL Reserved words:
"and", "begin", "break", "case", "common", "compile_opt", "continue", "do", "else", "end", "endcase", "endelse", "endfor", "endforeach", "endif", "endrep", "endswitch", "endwhile", "eq", "for", "foreach", "forward_function", "function", "ge", "goto", "gt", "if", "inherits", "le", "lt", "mod", "ne", "not", "of", "on_ioerror", "or", "pro", "repeat", "switch", "then", "until", "while", "xor"
- OCL Reserved words:
"abstract", "any", "attribute", "boolean", "case", "char", "component", "const", "consumes", "context", "custom", "default", "double", "emits", "enum", "eventtype", "exception", "factory", "false", "finder", "fixed", "float", "getraises", "home", "import", "in", "inout", "interface", "local", "long", "manages", "module", "multiple", "native", "object", "octet", "oneway", "out", "primarykey", "private", "provides", "public", "publishes", "raises", "readonly", "sequence", "setraises", "short", "string", "struct", "supports", "switch", "true", "truncatable", "typedef", "typeid", "typeprefix", "union", "unsigned", "uses", "valuebase", "valuetype", "void", "wchar", "wstring"
- IDL Reserved words:
- If there are any errors during validation of the CSV file, the model import will not be initiated and a list of errors will be returned. They will be labeled by the row they occur on for convenience.
- There is a 2MB limit in place - if a larger file needs to be imported, it needs to be split up into smaller files.
- In the raw CSV (i.e., as observed from notepad), any field with commas must have surrounding quotes (Excel normally handles this).