DataModelFactory
Objects
A factory class that creates and manipulates instances of Column
and
DataModel
.
d.createCollectionType(valueMeasure) : CollectionType
valueMeasure(MeasureType) :
the measure that should be applied to each value in
the list.
Creates a new CollectionType
object. The definition specifies the measurement
associated with individual values in the list. The storage cannot be either
MeasureType.COLLECTION
or MeasureType.GEOSPATIAL
, and should also
be consistent with the storage type associated with the simple values in the list column that this
metadata is to be associated with.
d.createColumn(name, label, storageType, measureType, modelingRole) : Column
name (string)
: the column name
label (string)
: the column label (may be None
)
storageType (StorageType)
: the storage definition
measureType (MeasureType)
: the measure definition (may be
None
)
modelingRole (ModelingRole)
: the model role definition for each column (may be
None
)
Returns a Column with the supplied attributes.
d.createColumn(name, label, extendedStorage) : Column
name (string)
: the column name
label (string)
: the column label (may be None
)
extendedStorage (ExtendedStorage)
: the extended storage definition
Returns a Column
with the supplied attributes. The measure type is set to
MeasureType.TYPELESS
.
d.createColumn(name, label, extendedStorage, extendedMeasure) : Column
name (string)
: the column name
label (string)
: the column label (may be None
)
extendedStorage (ExtendedStorage)
: the extended storage definition
extendedMeasure (ExtendedMeasure)
: the extended measure definition
Returns a Column
with the supplied attributes. The measure type is set to
MeasureType.TYPELESS
.
d.createColumn(name, label, sourceColumn) : Column
name (string)
: the column name
label (string)
: the column label (may be None
)
sourceColumn (Column)
: the source column
Returns a Column
with the specified name and labels but with all other
attributes the same as source column.
Exceptions:
DataModelException
: if the source column was not created by the
DataModelFactory
.
d.createDataModel() : DataModel
Returns an empty DataModel
.
d.createFlagColumn(name, label, storageType, falseValue, trueValue) : Column
name (string)
: the column name
label (string)
: the column label (may be None
)
storageType (StorageType)
: the storage definition
falseValue (object)
: the false value
trueValue (object)
: the true value
Returns a Column
with the supplied attributes.
d.createGeoType(geometryType, coordinates, wellKnownID, coordinateSystemName) : GeoType
geometryType (GeometryType)
: the type of geometry object
coordinates (int)
: a positive integer representing the number
WellKnownID (int)
: the “well-known ID” of the coordinate system or 0 if this is
not known
coordinateSystemName (string)
: the name of the coordinate system or the empty
string if this is not known.
Creates a new GeoType
object. The definition specifies the type of geometry
object, the number of coordinates (typically 2 or 3) required to represent the geometry object, and
the“well-known ID” and/or the coordinate system name.
d.createListStorage(depth, valueType) : ListStorage
depth (int)
: how deeply nested the simple values are in the list
valueType (StorageType)
: the type of the simple values
Creates a new ListStorage
object. The definition specifies the depth of the list
starting at 0 for a list of simple values, and the basic storage of the underlying values. The
storage cannot be either StorageType.UNKNOWN
or
StorageType.LIST
.
d.createModelOutputColumn(prefix, basename, storageType, measureType, modelOutputMetadata) : Column
prefix (string)
: the column prefix (may not contain "-" characters)
basename (string)
: the column base name
storageType (StorageType)
: the storage type
measureType (MeasureType)
: the measure type
modelOutputMetadata (ModelOutputMetadata)
: the model output metadata
Returns a new Column
with the specified type metadata and associated model
output metadata.
Exceptions:
DataModelException
: if the prefix is invalid
d.createModelOutputColumn(prefix, basename, sourceColumn, modelOutputMetadata) : Column
prefix (string)
: the column prefix (may not contain "-" characters)
basename (string)
: the column base name
sourceColumn (Column)
: the source column specifying the column type
modelOutputMetadata (ModelOutputMetadata)
: the model output metadata
Returns a new Column
with the same type metadata as the source column along with
the associated model output metadata.
Exceptions:
DataModelException
: if the source column was not created by the
DataModelFactory
or the prefix is invalid.
d.createModelOutputMetadata(modelFieldRole, targetColumn, value, group, tag) : ModelOutputMetadata
modelFieldRole (ModelFieldRole)
: the mode column role
targetColumn (string)
: the target column (may be None
)
value (object) : the specific value associated with this column (may be None
).
If supplied, this must be an instance of string
, int
, or
float
.
group (List)
: the column group definition (may be None
). If
supplied this must be a list on int
values which are >= 1.
tag (string)
: the tag (may be None
)
Returns a new model output metadata object with the specified attributes.
d.createRangeColumn(name, label, storageType, lowerBound, upperBound) : Column
name (string)
: the column name
label (string)
: the column label (may be None
)
storageType (StorageType)
: the storage definition
lowerBound (object)
: the lower range bound
upperBound (object)
: the upper range bound
Returns a Column
with the supplied attributes.
d.createSetColumn(name, label, storageType, values) : Column
name (string)
: the column name
label (string)
: the column label (may be None
)
storageType (StorageType)
: the storage definition
values (object[])
: the valid values for the column
Returns a Column
with the supplied attributes.
d.dataModelToXML(dataModel) : string
dataModel (DataModel)
: the data model
Returns an XML format string containing the supplied data model in a serializable format. The
data model can be recreated by calling xmlToDataModel
.
Exceptions:
DataModelException
: if the data model XML cannot be created
d.extendDataModel(column, initialDataModel) : DataModel
column (Column)
: the column
initialDataModel (DataModel)
:
Returns a DataModel
consisting of the column appended to the supplied data
model. The supplied array must not contain None
values.
Exceptions:
com.spss.psapi.data.DataModelException
: if the column was not created by the
DataModelFactory
.
d.extendDataModel(addition, initialDataModel) : DataModel
addition (DataModel)
: the data model to be appended
initialDataModel (DataModel)
:
Returns a DataModel
consisting of the initial data model with the additions
appended.
Exceptions:
com.spss.psapi.data.DataModelException
: if the data models were not created by
the DataModelFactory
.
d.extendDataModel(columns, initialDataModel) : DataModel
columns (Column[])
: the columns
initialDataModel (DataModel)
:
Returns a DataModel
consisting of the columns appended to the supplied data
model. The supplied array must not contain None
values.
Exceptions:
com.spss.psapi.data.DataModelException
: if the columns array contains
None
values.
d.extractDataModel(names, initialDataModel) : DataModel
names (string[])
: the column names
initialDataModel (DataModel)
: the source data model
Returns a DataModel
consisting of the named columns extracted from the source
data model. If the source data model does not include a specified column name, that column will be
ignored.
Exceptions:
com.spss.psapi.data.DataModelException
: if the array contains
None
values.
d.extractDataModel(storageTypes, initialDataModel) : DataModel
storageTypes (StorageType[])
: the storage types
initialDataModel (DataModel)
: the source data model
Returns a DataModel
consisting of columns in the source data model that have the
supplied storage type(s).
Exceptions:
com.spss.psapi.data.DataModelException
: if the array contains
None
values.
d.extractDataModel(measureTypes, initialDataModel) : DataModel
measureTypes (MeasureType[])
: the measure types
initialDataModel (DataModel)
: the source data model
Returns a DataModel
consisting of columns in the source data model that have the
supplied measure type(s).
Exceptions:
com.spss.psapi.data.DataModelException
: if the array contains
None
values.
d.extractDataModel(modelingRoles, initialDataModel) : DataModel
modelingRoles (ModelingRole[])
: the modeling roles types
initialDataModel (DataModel)
: the source data model
Returns a DataModel
consisting of columns in the source data model that have the
supplied modeling role(s).
Exceptions:
com.spss.psapi.data.DataModelException
: if the array contains
None
values.
d.modifyColumns(modifiedColumns) : DataModel
modifiedColumns (Collection)
: the columns to be modified
Creates and returns a new data model based on this data model with the specified columns modified. The supplied columns will be used to replace any existing column with the same name meaning that this method cannot be used to change the name of columns in the data model. If a supplied column name does not match an existing column, it will be ignored.
d.removeColumns(columnNames) : DataModel
columnNames (Collection)
:
Creates and returns a new data model based on this data model with the specified columns modified. The supplied columns will be used to replace any existing column with the same name meaning that this method cannot be used to change the name of columns in the data model. If a supplied column does not match an existing column, it will be added to the end of the data model.
Exceptions:
DataModelException
: if the modified columns are invalid
d.removeFromDataModel(names, initialDataModel) : DataModel
names (string[])
: the column names
initialDataModel (DataModel)
: the source data model
Returns a DataModel
consisting of the source data model with the named columns
removed.
Exceptions:
com.spss.psapi.data.DataModelException
: if the array contains
None
values.
d.removeFromDataModel(storageTypes, initialDataModel) : DataModel
storageTypes (StorageType[])
: the storage types
initialDataModel (DataModel)
: the source data model
Returns a DataModel
consisting of the source data model with columns of the
supplied storage type(s) removed.
Exceptions:
com.spss.psapi.data.DataModelException
: if the array contains
None
values.
d.removeFromDataModel(measureTypes, initialDataModel) : DataModel
measureTypes (MeasureType[])
: the measure types
initialDataModel (DataModel)
: the source data model
Returns a DataModel
consisting of the source data model with columns of the
supplied measure type(s) removed.
Exceptions:
com.spss.psapi.data.DataModelException
: if the array contains
None
values.
d.removeFromDataModel(modelingRoles, initialDataModel) : DataModel
modelingRoles (ModelingRole[])
: the modeling roles types
initialDataModel (DataModel)
: the source data model
Returns a DataModel
consisting of the source data model with columns of the
supplied modeling roles(s) removed.
Exceptions:
com.spss.psapi.data.DataModelException
: if the array contains
None
values.
d.renameColumns(modifiedNames) : DataModel
modifiedNames (Map)
: a map containing the original column names as the key and
the new name as the associated value
Creates and returns a new data model based on this data model with the specified columns renamed. If the map contains keys that do not correspond to columns in the data model, the key will be ignored.
Exceptions:
DataModelException
: if the new column names are invalid, for example cause the
data model to have duplicate names.
d.toDataModel(columns) : DataModel
columns (Column[])
: Returns a DataModel
containing the
supplied columns. The columns are inserted in array order.
Exceptions:
DataModelException
: if the source columns are not the system defined
implementation
d.xmlToDataModel(xml) : DataModel
xml (string)
: the data model XML
Returns a DataModel
defined by the supplied XML string. It is assumed the string
was generated by calling dataModelToXML
.
Exceptions:
DataModelException
: if the data model cannot be recreated