rdr.core
Class DomainModel

java.lang.Object
  extended by rdr.core.DomainModel
All Implemented Interfaces:
java.io.Serializable

public class DomainModel
extends java.lang.Object
implements java.io.Serializable

DomainModel object. Defined by a set of Attributes. Also manages the set of cases, and classifications.

Author:
Ivan Bindoff
See Also:
Serialized Form

Field Summary
 common.datastructures.MyFastVector<Attribute> attributes
           
 common.datastructures.MyFastVector<Case> cases
           
 common.datastructures.MyFastVector<Classification> classifications
           
 java.lang.String name
           
 java.io.File sourceArff
           
 
Constructor Summary
DomainModel()
          Constructor.
DomainModel(java.io.File file)
          Constructor.
DomainModel(java.io.File file, int numLabels)
          Constructor.
DomainModel(java.lang.String name, weka.core.Instances data, int numLabels)
          Constructor.
DomainModel(java.lang.String modelName, common.datastructures.MyFastVector<Attribute> attrs)
          Constructor.
DomainModel(java.lang.String modelName, common.datastructures.MyFastVector<Attribute> attrs, common.datastructures.MyFastVector<Classification> classifications)
          Constructor.
 
Method Summary
 void addClassification(Classification c)
          Add a classification to this domain model (if it isn't already there)
 Attribute getAttributeFromName(java.lang.String name)
          Find an attribute in the domain model based on name
 common.datastructures.MyFastVector<Attribute> getAttributes()
          gets the attributes which define how a case is made up
 java.lang.String[] getAttributesArray()
          Return an array of strings representing the attributes, for the drop down box of attributes that will be needed in the knowledge acquisition GUI
 java.lang.Object[][] getAttributesTable()
          Returns a 2D array of objects that match the format {{att1, type}, {att2, type}, etc.}
 Case getCase(int i)
          Get a specific case from the domain model.
 common.datastructures.MyFastVector<Case> getCases()
           
 common.datastructures.MyFastVector<Classification> getClassifications()
          Get the set of classifications that have been used in this domain model (so far)
 java.lang.String getModelName()
           
 java.io.File getSourceArff()
           
 common.datastructures.MyFastVector<Case> loadCaseBank()
          Load cases from file.
 common.datastructures.MyFastVector<Case> loadCaseBankArff(java.io.File file)
          Load cases from Arff file.
 common.datastructures.MyFastVector<Case> loadCaseBankArff(weka.core.Instances data)
          Load cases from Arff dataset.
 DomainModel loadDomainModel(java.io.File file)
          Load a domain model from file
 DomainModel loadDomainModelArff(java.io.File file, int numLabels)
          Load a domain model from file The arff reading version.
 DomainModel loadDomainModelArff(weka.core.Instances data, int numLabels)
          Load a domain model from file The arff reading version.
 void saveCaseBank()
          Save cases to file
 void saveDomainModel()
          Save the domain model to file
 void setAttributes(common.datastructures.MyFastVector<Attribute> attrs)
          sets the attributes which define how a case is made up
 void setModelName(java.lang.String modelName)
          sets the model name
 void setSourceArff(java.io.File file)
          Sets the source arff file.
 int size()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

name

public java.lang.String name

attributes

public common.datastructures.MyFastVector<Attribute> attributes

cases

public common.datastructures.MyFastVector<Case> cases

classifications

public common.datastructures.MyFastVector<Classification> classifications

sourceArff

public java.io.File sourceArff
Constructor Detail

DomainModel

public DomainModel()
Constructor. Builds a new domain model, one that hasn't been determined yet. User is building it on the fly using the domain editor


DomainModel

public DomainModel(java.lang.String modelName,
                   common.datastructures.MyFastVector<Attribute> attrs)
Constructor. Builds a new domain model, with a name and a set of attributes with no cases or classifications yet.

Parameters:
modelName - the name of the domain
attrs - the set of attributes that define how a case is made up

DomainModel

public DomainModel(java.lang.String modelName,
                   common.datastructures.MyFastVector<Attribute> attrs,
                   common.datastructures.MyFastVector<Classification> classifications)
Constructor. Builds a new domain model, with a name, set of attributes, and set of classifications.

Parameters:
modelName - the name of the domain
attrs - the set of attributes that define how a case is made up
classifications - the set of classifications that are used in this domain (so far)

DomainModel

public DomainModel(java.io.File file)
Constructor. Builds the domain model from the supplied file.

Parameters:
file - the domain model file to load

DomainModel

public DomainModel(java.io.File file,
                   int numLabels)
Constructor. Builds the domain model from an arff file. The numLabels parameter is needed so that you can strip the classifications off the beginning of the case definitions correctly.

Parameters:
file - the file to load
numLabels - the number of labels (classifications) that are included in the file

DomainModel

public DomainModel(java.lang.String name,
                   weka.core.Instances data,
                   int numLabels)
Constructor. Builds the domain model from a set of weka instances data. The numLabels parameter is needed so that you can strip the classifications off the beginning of the case definitions correctly.

Parameters:
data - the data to convert
numLabels - the number of labels (classifications) that are included in the file
Method Detail

getModelName

public java.lang.String getModelName()
Returns:
this model's name

getSourceArff

public java.io.File getSourceArff()
Returns:
the reference to the source Arff File

setSourceArff

public void setSourceArff(java.io.File file)
Sets the source arff file.

Parameters:
file - the file to set as source arff

setModelName

public void setModelName(java.lang.String modelName)
sets the model name

Parameters:
modelName - the name to set

getAttributes

public common.datastructures.MyFastVector<Attribute> getAttributes()
gets the attributes which define how a case is made up

Returns:
the set of attributes

setAttributes

public void setAttributes(common.datastructures.MyFastVector<Attribute> attrs)
sets the attributes which define how a case is made up

Parameters:
attrs - the set of attributes to use

size

public int size()
Returns:
the number of attributes that make up a case in this domain model

getAttributesArray

public java.lang.String[] getAttributesArray()
Return an array of strings representing the attributes, for the drop down box of attributes that will be needed in the knowledge acquisition GUI

Returns:
array of strings

getAttributeFromName

public Attribute getAttributeFromName(java.lang.String name)
Find an attribute in the domain model based on name

Returns:
the found attribute, or a null attribute if not found

loadDomainModel

public DomainModel loadDomainModel(java.io.File file)
Load a domain model from file

Parameters:
file - the domain model file to load
Returns:
the domain model constructed by the file

loadDomainModelArff

public DomainModel loadDomainModelArff(java.io.File file,
                                       int numLabels)
Load a domain model from file The arff reading version.

Parameters:
file - the domain model file to load
numLabels - the number of labels (classifications) the arff includes
Returns:
the domain model constructed from the file

loadDomainModelArff

public DomainModel loadDomainModelArff(weka.core.Instances data,
                                       int numLabels)
Load a domain model from file The arff reading version.

Parameters:
file - the domain model file to load
numLabels - the number of labels (classifications) the arff includes
Returns:
the domain model constructed from the file

saveCaseBank

public void saveCaseBank()
Save cases to file


loadCaseBank

public common.datastructures.MyFastVector<Case> loadCaseBank()
Load cases from file.

Returns:
a set of cases loaded from file

loadCaseBankArff

public common.datastructures.MyFastVector<Case> loadCaseBankArff(java.io.File file)
Load cases from Arff file.

Parameters:
file - the arff file to load
Returns:
the loaded set of cases

loadCaseBankArff

public common.datastructures.MyFastVector<Case> loadCaseBankArff(weka.core.Instances data)
Load cases from Arff dataset.

Parameters:
data - the Instances dataset to convert
Returns:
the loaded set of cases

saveDomainModel

public void saveDomainModel()
Save the domain model to file


getCases

public common.datastructures.MyFastVector<Case> getCases()
Returns:
the set of cases for this domain model

getCase

public Case getCase(int i)
Get a specific case from the domain model.

Parameters:
i - the index of the case you want to fetch
Returns:
a specific case from the domain model

getClassifications

public common.datastructures.MyFastVector<Classification> getClassifications()
Get the set of classifications that have been used in this domain model (so far)

Returns:
set of classifications

addClassification

public void addClassification(Classification c)
Add a classification to this domain model (if it isn't already there)

Parameters:
c - the classification to add

getAttributesTable

public java.lang.Object[][] getAttributesTable()
Returns a 2D array of objects that match the format {{att1, type}, {att2, type}, etc.}

Returns:
a table ready set of attributes for the domain editor