com.spss.psapi.data

Interface DataModelFactory



  • public interface DataModelFactory
    A factory class that creates and manipulates instances of Column and DataModel.
    Since:
    PSAPI 2.0
    Author:
    Julian Clinton
    See Also:
    Column, DataModel
    • Method Detail

      • createDataModel

        DataModel createDataModel()
        Returns an empty DataModel.
        Returns:
        an empty data model
      • toDataModel

        DataModel toDataModel(Column[] columns)
                              throws DataModelException
        Returns a DataModel containing the supplied columns. The columns are inserted in array order.
        Returns:
        a data model
        Throws:
        DataModelException - if the source columns are not the system defined implementation
      • createColumn

        Column createColumn(java.lang.String name,
                          java.lang.String label,
                          StorageType storageType,
                          MeasureType measureType,
                          ModelingRole modelingRole)
        Returns a Column with the supplied attributes.
        Parameters:
        name - the column name
        label - the column label (may be null)
        storageType - the storage definition
        measureType - the measure definition (may be null)
        modelingRole - the model role definition for each column (may be null)
        Returns:
        a Column representing the column
      • createColumn

        Column createColumn(java.lang.String name,
                          java.lang.String label,
                          ExtendedStorage extendedStorage)
        Returns a Column with the supplied attributes. The measure type is set to MeasureType.TYPELESS.
        Parameters:
        name - the column name
        label - the column label (may be null)
        extendedStorage - the extended storage definition
        Returns:
        a Column representing the column
        Since:
        PSAPI 17.0
        See Also:
        createListStorage(int, StorageType)
      • createColumn

        Column createColumn(java.lang.String name,
                          java.lang.String label,
                          Column sourceColumn)
                            throws DataModelException
        Returns a Column with the specified name and labels but with all other attributes the same as source column.
        Parameters:
        name - the column name
        label - the column label (may be null)
        sourceColumn - the source column
        Returns:
        a Column representing the column
        Throws:
        DataModelException - if the source column was not created by the DataModelFactory
      • createSetColumn

        Column createSetColumn(java.lang.String name,
                             java.lang.String label,
                             StorageType storageType,
                             java.lang.Object[] values)
        Returns a Column with the supplied attributes.
        Parameters:
        name - the column name
        label - the column label (may be null)
        storageType - the storage definition
        values - the valid values for the column
        Returns:
        a Column representing the column
      • createFlagColumn

        Column createFlagColumn(java.lang.String name,
                              java.lang.String label,
                              StorageType storageType,
                              java.lang.Object falseValue,
                              java.lang.Object trueValue)
        Returns a Column with the supplied attributes.
        Parameters:
        name - the column name
        label - the column label (may be null)
        storageType - the storage definition
        falseValue - the false value
        trueValue - the true value
        Returns:
        a Column representing the column
      • createRangeColumn

        Column createRangeColumn(java.lang.String name,
                               java.lang.String label,
                               StorageType storageType,
                               java.lang.Object lowerBound,
                               java.lang.Object upperBound)
        Returns a Column with the supplied attributes.
        Parameters:
        name - the column name
        label - the column label (may be null)
        storageType - the storage definition
        lowerBound - the lower range bound
        upperBound - the upper range bound
        Returns:
        a Column representing the column
      • createModelOutputMetadata

        ModelOutputMetadata createModelOutputMetadata(ModelFieldRole modelFieldRole,
                                                    java.lang.String targetColumn,
                                                    java.lang.Object value,
                                                    java.util.List group,
                                                    java.lang.String tag)
        Returns a new model output metadata object with the specified attributes.
        Parameters:
        modelFieldRole - the mode column role
        targetColumn - the target column (may be null)
        value - the specific value associated with this column (may be null). If supplied, this must be an instance of String, Integer, or Double.
        group - the column group definition (may be null). If supplied this must be a list on Integer values which are >= 1.
        tag - the tag (may be null)
        Returns:
        a model output metadata object
      • createModelOutputColumn

        Column createModelOutputColumn(java.lang.String prefix,
                                     java.lang.String basename,
                                     StorageType storageType,
                                     MeasureType measureType,
                                     ModelOutputMetadata modelOutputMetadata)
                                       throws DataModelException
        Returns a new Column with the specified type metadata and associated model output metadata.
        Parameters:
        prefix - the column prefix (may not contain "-" characters)
        basename - the column base name
        storageType - the storage type
        measureType - the measure type
        modelOutputMetadata - the model output metadata
        Returns:
        a new column with the specified model output metatdata
        Throws:
        DataModelException - if the prefix is invalid
      • createModelOutputColumn

        Column createModelOutputColumn(java.lang.String prefix,
                                     java.lang.String basename,
                                     Column sourceColumn,
                                     ModelOutputMetadata modelOutputMetadata)
                                       throws DataModelException
        Returns a new Column with the same type metadata as the source column along with the associated model output metadata.
        Parameters:
        prefix - the column prefix (may not contain "-" characters)
        basename - the column base name
        sourceColumn - the source column specifying the column type
        modelOutputMetadata - the model output metadata
        Returns:
        a new column with the specified model output metatdata
        Throws:
        DataModelException - if the source column was not created by the DataModelFactory or the prefix is invalid
      • extendDataModel

        DataModel extendDataModel(Column column,
                                DataModel initialDataModel)
                                  throws DataModelException
        Returns a DataModel consisting of the column appended to the supplied data model. The supplied array must not contain null values.
        Parameters:
        column - the column
        Returns:
        a DataModel containing the supplied columns
        Throws:
        DataModelException - if the column was not created by the DataModelFactory
      • extendDataModel

        DataModel extendDataModel(DataModel addition,
                                DataModel initialDataModel)
                                  throws DataModelException
        Returns a DataModel consisting of the initial data model with the additions appended.
        Parameters:
        addition - the data model to be appended
        Returns:
        a DataModel containing the supplied columns
        Throws:
        DataModelException - if the data models were not created by the DataModelFactory
      • extendDataModel

        DataModel extendDataModel(Column[] columns,
                                DataModel initialDataModel)
                                  throws DataModelException
        Returns a DataModel consisting of the columns appended to the supplied data model. The supplied array must not contain null values.
        Parameters:
        columns - the columns
        Returns:
        a DataModel containing the supplied columns
        Throws:
        DataModelException - if the columns array contains null values.
      • extractDataModel

        DataModel extractDataModel(java.lang.String[] names,
                                 DataModel initialDataModel)
                                   throws DataModelException
        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.
        Parameters:
        names - the column names
        initialDataModel - the source data model
        Returns:
        a DataModel containing the supplied columns
        Throws:
        DataModelException - if the array contains null values.
      • extractDataModel

        DataModel extractDataModel(StorageType[] storageTypes,
                                 DataModel initialDataModel)
                                   throws DataModelException
        Returns a DataModel consisting of columns in the source data model that have the supplied storage type(s).
        Parameters:
        storageTypes - the storage types
        initialDataModel - the source data model
        Returns:
        a DataModel containing the supplied columns
        Throws:
        DataModelException - if the array contains null values.
      • extractDataModel

        DataModel extractDataModel(MeasureType[] measureTypes,
                                 DataModel initialDataModel)
                                   throws DataModelException
        Returns a DataModel consisting of columns in the source data model that have the supplied measure type(s).
        Parameters:
        measureTypes - the measure types
        initialDataModel - the source data model
        Returns:
        a DataModel containing the supplied columns
        Throws:
        DataModelException - if the array contains null values.
      • extractDataModel

        DataModel extractDataModel(ModelingRole[] modelingRoles,
                                 DataModel initialDataModel)
                                   throws DataModelException
        Returns a DataModel consisting of columns in the source data model that have the supplied modeling role(s).
        Parameters:
        modelingRoles - the modeling roles types
        initialDataModel - the source data model
        Returns:
        a DataModel containing the supplied columns
        Throws:
        DataModelException - if the array contains null values.
      • removeFromDataModel

        DataModel removeFromDataModel(java.lang.String[] names,
                                    DataModel initialDataModel)
                                      throws DataModelException
        Returns a DataModel consisting of the source data model with the named columns removed.
        Parameters:
        names - the column names
        initialDataModel - the source data model
        Returns:
        a DataModel containing the supplied columns
        Throws:
        DataModelException - if the array contains null values.
      • removeFromDataModel

        DataModel removeFromDataModel(StorageType[] storageTypes,
                                    DataModel initialDataModel)
                                      throws DataModelException
        Returns a DataModel consisting of the source data model with columns of the supplied storage type(s) removed.
        Parameters:
        storageTypes - the storage types
        initialDataModel - the source data model
        Returns:
        a DataModel containing the supplied columns
        Throws:
        DataModelException - if the array contains null values.
      • removeFromDataModel

        DataModel removeFromDataModel(MeasureType[] measureTypes,
                                    DataModel initialDataModel)
                                      throws DataModelException
        Returns a DataModel consisting of the source data model with columns of the supplied measure type(s) removed.
        Parameters:
        measureTypes - the measure types
        initialDataModel - the source data model
        Returns:
        a DataModel containing the supplied columns
        Throws:
        DataModelException - if the array contains null values.
      • removeFromDataModel

        DataModel removeFromDataModel(ModelingRole[] modelingRoles,
                                    DataModel initialDataModel)
                                      throws DataModelException
        Returns a DataModel consisting of the source data model with columns of the supplied modeling roles(s) removed.
        Parameters:
        modelingRoles - the modeling roles types
        initialDataModel - the source data model
        Returns:
        a DataModel containing the supplied columns
        Throws:
        DataModelException - if the array contains null values.
      • createListStorage

        ListStorage createListStorage(int depth,
                                    StorageType valueType)
        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.
        Parameters:
        depth - how deeply nested the simple values are in the list
        valueType - the type of the simple values
        Returns:
        a new extended storage object
        Since:
        PSAPI 17.0
        See Also:
        createCollectionType(MeasureType), createGeoType(GeometryType, int, int, String)
      • createCollectionType

        CollectionType createCollectionType(MeasureType valueMeasure)
        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.
        Parameters:
        valueMeasure - the measure that should be applied to each value in the list.
        Returns:
        a new extended measure object
        Since:
        PSAPI 17.0
        See Also:
        createListStorage(int, StorageType), createGeoType(GeometryType, int, int, String)
      • createGeoType

        GeoType createGeoType(GeometryType geometryType,
                            int coordinates,
                            int wellKnownID,
                            java.lang.String coordinateSystemName)
        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.
        Parameters:
        geometryType - the type of geometry object
        coordinates - a positive integer representing the number
        wellKnownID - the “well-known ID” of the coordinate system or 0 if this is not known
        coordinateSystemName - the name of the coordinate system or the empty string if this is not known.
        Returns:
        a new extended measure object
        Since:
        PSAPI 17.0
        See Also:
        createListStorage(int, StorageType), createCollectionType(MeasureType)
      • xmlToDataModel

        DataModel xmlToDataModel(java.lang.String xml)
                                 throws DataModelException
        Returns a DataModel defined by the supplied XML string. It is assumed the string was generated by calling dataModelToXML.
        Parameters:
        xml - the data model XML
        Returns:
        a data model
        Throws:
        DataModelException - if the data model cannot be recreated
        Since:
        PSAPI 17.0
        See Also:
        dataModelToXML(DataModel)
      • dataModelToXML

        java.lang.String dataModelToXML(DataModel dataModel)
                                        throws DataModelException
        Returns an XML format string containing the supplied data model in a serializable format. The data model can be recreated by calling xmlToDataModel.
        Parameters:
        dataModel - the data model
        Returns:
        a string containing an XML representation of the data model
        Throws:
        DataModelException - if the data model XML cannot be created
        Since:
        PSAPI 17.0
        See Also:
        xmlToDataModel(String)

Copyright © 2014 Integral Solutions Ltd. All Rights Reserved.