Packages

case class Relation(name: String, colName: Seq[String], col: Vector[Vec], key: Int = 0, domain: String = null, fKeys: Seq[(String, String, Int)] = null) extends Table with Error with Product with Serializable

The Relation class stores and operates on vectors. The vectors form the columns of the columnar relational datastore. Columns may have any of the following types:

C - Complex - VectorC - 128 bit complex number a + bi D - Double - VectorD - 64 bit double precision floating point number I - Int - VectorI - 32 bit integer L - Long - VectorL - 64 bit long integer Q - Rational - VectorQ - 128 bit ratio of two long integers R - Real - VectorR - 128 bit quad precision floating point number S - StrNum - VectorS - variable length numeric string


name

the name of the relation

colName

the names of columns

col

the Scala Vector of columns making up the columnar relation

key

the column number for the primary key (< 0 => no primary key)

domain

an optional string indicating domains for columns (e.g., 'SD' = 'StrNum', 'Double')

fKeys

an optional sequence of foreign keys - Seq (column name, ref table name, ref column position)

Linear Supertypes
Serializable, Serializable, Product, Equals, Error, Table, AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. Relation
  2. Serializable
  3. Serializable
  4. Product
  5. Equals
  6. Error
  7. Table
  8. AnyRef
  9. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Instance Constructors

  1. new Relation(name: String, colName: Seq[String], col: Vector[Vec], key: Int = 0, domain: String = null, fKeys: Seq[(String, String, Int)] = null)

    name

    the name of the relation

    colName

    the names of columns

    col

    the Scala Vector of columns making up the columnar relation

    key

    the column number for the primary key (< 0 => no primary key)

    domain

    an optional string indicating domains for columns (e.g., 'SD' = 'StrNum', 'Double')

    fKeys

    an optional sequence of foreign keys - Seq (column name, ref table name, ref column position)

Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int
    Definition Classes
    AnyRef → Any
  3. def -(_r2: Table): Relation

    Take the difference of 'this' relation and 'r2' ('this - r2').

    Take the difference of 'this' relation and 'r2' ('this - r2'). Check that the two relations are compatible.

    Definition Classes
    RelationTable
  4. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  5. def ><(_r2: Table): Relation

    Join 'this' relation and 'r2 by performing a "natural-join".

    Join 'this' relation and 'r2 by performing a "natural-join". Rows from both relations are compared requiring agreement on common attributes (column names).

    Definition Classes
    RelationTable
  6. def add(tuple: Row): Unit

    Add 'tuple' to 'this' relation as a new row.

    Add 'tuple' to 'this' relation as a new row. FIX: want an efficient, covariant, mutable data structure, but Array is invariant.

    tuple

    an aggregation of columns values (new row)

    Definition Classes
    RelationTable
  7. def add_2(tuple: Row): Unit

    Add 'tuple' to 'this' relation as a new row.

    Add 'tuple' to 'this' relation as a new row. Type is determined by sampling values for columns

    tuple

    an aggregation of columns values (new row)

  8. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  9. def clone(): AnyRef
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  10. var col: Vector[Vec]
  11. val colName: Seq[String]
  12. def cols: Int

    Return the size in terms of number of columns in the relation.

    Return the size in terms of number of columns in the relation.

    Definition Classes
    RelationTable
  13. def contains(tuple: Row): Boolean

    Determine whether 'this' relation contains a row matching the given 'tuple'.

    Determine whether 'this' relation contains a row matching the given 'tuple'.

    tuple

    an aggregation of columns values (potential row)

    Definition Classes
    RelationTable
  14. def disambiguate(cn1: Seq[String], cn2: Seq[String]): Seq[String]

    Combine two sequences of column names and disambiguate any repeated names by appending "2".

    Combine two sequences of column names and disambiguate any repeated names by appending "2".

    cn1

    the first sequence of column names

    cn2

    the second sequence of column names

    Definition Classes
    Table
  15. val domain: String
  16. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  17. var fKeys: Seq[(String, String, Int)]
  18. def finalize(): Unit
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  19. final def flaw(method: String, message: String): Unit

    Show the flaw by printing the error message.

    Show the flaw by printing the error message.

    method

    the method where the error occurred

    message

    the error message

    Definition Classes
    Error
  20. final def getClass(): Class[_]
    Definition Classes
    AnyRef → Any
  21. def incompatible(_r2: Table): Boolean

    Determine whether 'this' relation and 'r2' are incompatible by having differing numbers of columns or differing domain strings.

    Determine whether 'this' relation and 'r2' are incompatible by having differing numbers of columns or differing domain strings.

    Definition Classes
    RelationTable
  22. def indices: Range

    Return the range of index values for the relation.

    Return the range of index values for the relation.

    Definition Classes
    Table
  23. def intersect(_r2: Table): Relation

    Intersect 'this' relation and 'r2'.

    Intersect 'this' relation and 'r2'. Check that the two relations are compatible.

    Definition Classes
    RelationTable
  24. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  25. def join(cName: Seq[String], _r2: Table): Relation

    Join 'this' relation and 'r2 by performing a "natural-join".

    Join 'this' relation and 'r2 by performing a "natural-join". Rows from both relations are compared requiring 'cName' values to be equal.

    cName

    the common join column names for both relation

    Definition Classes
    RelationTable
  26. def join(cName1: String, cName2: String, r2: Table): Relation

    Join 'this' relation and 'r2 by performing an "equi-join".

    Join 'this' relation and 'r2 by performing an "equi-join". Rows from both relations are compared requiring 'cName1' values to equal 'cName2' values. Disambiguate column names by appending "2" to the end of any duplicate column name.

    cName1

    the string of join column names of this relation (e.g., the Foreign Key)

    cName2

    the string of join column names of relation r2 (e.g., the Primary Key)

    r2

    the rhs relation in the join operation

    Definition Classes
    RelationTable
  27. def join(cName1: Seq[String], cName2: Seq[String], _r2: Table): Relation

    Join 'this' relation and 'r2 by performing an "equi-join".

    Join 'this' relation and 'r2 by performing an "equi-join". Rows from both relations are compared requiring 'cName1' values to equal 'cName2' values. Disambiguate column names by appending "2" to the end of any duplicate column name.

    cName1

    the join column names of this relation (e.g., the Foreign Key)

    cName2

    the join column names of relation r2 (e.g., the Primary Key)

    Definition Classes
    RelationTable
  28. val key: Int
  29. val name: String
  30. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  31. final def notify(): Unit
    Definition Classes
    AnyRef
  32. final def notifyAll(): Unit
    Definition Classes
    AnyRef
  33. def pi(cPos: Seq[Int], cName: Seq[String] = null): Relation

    Project onto the columns with the given column positions.

    Project onto the columns with the given column positions.

    cPos

    the column positions to project onto

    cName

    the optional new names for the columns to project onto

    Definition Classes
    RelationTable
  34. def pi(cName: String*): Relation

    Project onto the columns with the given column names.

    Project onto the columns with the given column names.

    cName

    the names of the columns to project onto

    Definition Classes
    RelationTable
  35. def pisigmaC(cName: String, p: (Complex) ⇒ Boolean): Relation

    Select elements from column 'cName' in 'this' relation that satisfy the predicate 'p' and project onto that column.

    Select elements from column 'cName' in 'this' relation that satisfy the predicate 'p' and project onto that column.

    cName

    the name of the column used for selection

    p

    the predicate (Boolean function) to be satisfied

    Definition Classes
    RelationTable
  36. def pisigmaD(cName: String, p: (Double) ⇒ Boolean): Relation
    Definition Classes
    RelationTable
  37. def pisigmaI(cName: String, p: (Int) ⇒ Boolean): Relation
    Definition Classes
    RelationTable
  38. def pisigmaL(cName: String, p: (Long) ⇒ Boolean): Relation
    Definition Classes
    RelationTable
  39. def pisigmaQ(cName: String, p: (Rational) ⇒ Boolean): Relation
    Definition Classes
    RelationTable
  40. def pisigmaR(cName: String, p: (Real) ⇒ Boolean): Relation
    Definition Classes
    RelationTable
  41. def pisigmaS(cName: String, p: (StrNum) ⇒ Boolean): Relation
    Definition Classes
    RelationTable
  42. def row(i: Int): Row

    Create a row by pulling values from all columns at position 'i'.

    Create a row by pulling values from all columns at position 'i'.

    i

    the 'i'th position

    Definition Classes
    RelationTable
  43. def row(sos: Seq[String], _typ: String): Row

    Create a row by pulling values from an array of strings and converting elements to their appropriate types.

    Create a row by pulling values from an array of strings and converting elements to their appropriate types.

    sos

    the sequence of strings holding the values

    _typ

    the string of corresponding types, e.g., 'SDI'

    Definition Classes
    Table
  44. def rows: Int

    Return the size in terms of number of rows in the relation.

    Return the size in terms of number of rows in the relation.

    Definition Classes
    RelationTable
  45. def save(): Unit

    Save 'this' relation in a file using serialization.

    Save 'this' relation in a file using serialization.

    Definition Classes
    RelationTable
  46. def selectAt(pos: Seq[Int]): Relation

    Select across all columns at the specified column positions.

    Select across all columns at the specified column positions.

    pos

    the specified column positions

    Definition Classes
    RelationTable
  47. def selectC(cName: String, p: (Complex) ⇒ Boolean): Seq[Int]

    Select the positions of elements from columns in 'cName' in 'this' relation that satisfy the predicate 'p'.

    Select the positions of elements from columns in 'cName' in 'this' relation that satisfy the predicate 'p'.

    cName

    the name of the column used for selection

    p

    the predicate (Boolean function) to be satisfied

    Definition Classes
    RelationTable
  48. def selectD(cName: String, p: (Double) ⇒ Boolean): Seq[Int]
    Definition Classes
    RelationTable
  49. def selectI(cName: String, p: (Int) ⇒ Boolean): Seq[Int]
    Definition Classes
    RelationTable
  50. def selectL(cName: String, p: (Long) ⇒ Boolean): Seq[Int]
    Definition Classes
    RelationTable
  51. def selectQ(cName: String, p: (Rational) ⇒ Boolean): Seq[Int]
    Definition Classes
    RelationTable
  52. def selectR(cName: String, p: (Real) ⇒ Boolean): Seq[Int]
    Definition Classes
    RelationTable
  53. def selectS(cName: String, p: (StrNum) ⇒ Boolean): Seq[Int]
    Definition Classes
    RelationTable
  54. def show(): Unit

    Show 'this' relation row by row.

    Show 'this' relation row by row.

    Definition Classes
    RelationTable
  55. def showFk(): Unit

    Show 'this' relation's foreign keys.

  56. def sigma[T](cName: String, p: (T) ⇒ Boolean): Relation

    Select elements from columns in 'cName' in 'this' relation that satisfy the predicate 'p'.

    Select elements from columns in 'cName' in 'this' relation that satisfy the predicate 'p'.

    cName

    the name of the column used for selection

    p

    the predicate (Boolean function) to be satisfied

    Definition Classes
    RelationTable
  57. def sigmaC(cName: String, p: (Complex) ⇒ Boolean): Relation

    Select elements from columns in 'cName' in 'this' relation that satisfy the predicate 'p'.

    Select elements from columns in 'cName' in 'this' relation that satisfy the predicate 'p'.

    cName

    the name of the column used for selection

    p

    the predicate (Boolean function) to be satisfied

    Definition Classes
    RelationTable
  58. def sigmaD(cName: String, p: (Double) ⇒ Boolean): Relation
    Definition Classes
    RelationTable
  59. def sigmaI(cName: String, p: (Int) ⇒ Boolean): Relation
    Definition Classes
    RelationTable
  60. def sigmaL(cName: String, p: (Long) ⇒ Boolean): Relation
    Definition Classes
    RelationTable
  61. def sigmaQ(cName: String, p: (Rational) ⇒ Boolean): Relation
    Definition Classes
    RelationTable
  62. def sigmaR(cName: String, p: (Real) ⇒ Boolean): Relation
    Definition Classes
    RelationTable
  63. def sigmaS(cName: String, p: (StrNum) ⇒ Boolean): Relation
    Definition Classes
    RelationTable
  64. final def synchronized[T0](arg0: ⇒ T0): T0
    Definition Classes
    AnyRef
  65. def toMap(keyColName: Seq[String], valColName: String): Map[Seq[Any], Any]

    Convert the given columns within 'this' relation to a map: 'keyColName' -> 'valColName'.

    Convert the given columns within 'this' relation to a map: 'keyColName' -> 'valColName'.

    keyColName

    the key column names

  66. def toMap(keyColPos: Seq[Int], valColPos: Int): Map[Seq[Any], Any]

    Convert the given columns within 'this' relation to a map: 'keyColPos' -> 'valColPos'.

    Convert the given columns within 'this' relation to a map: 'keyColPos' -> 'valColPos'.

    keyColPos

    the key column positions

    valColPos

    the value column positions

  67. def toMatriD(colPos: Seq[Int], kind: MatrixKind = DENSE): MatriD

    Convert 'this' relation into a matrix of doubles, e.g.,

    Convert 'this' relation into a matrix of doubles, e.g.,

    in the regression equation: 'xb = y' create matrix 'xy'

    colPos

    the column positions to use for the matrix

    kind

    the kind of matrix to create

  68. def toMatriDD(colPos: Seq[Int], colPosV: Int, kind: MatrixKind = DENSE): (MatriD, VectorD)

    Convert 'this' relation into a matrix of doubles and a vector of doubles.

    Convert 'this' relation into a matrix of doubles and a vector of doubles.

    in the regression equation: 'xb = y' create matrix 'x' and vector 'y'

    colPos

    the column positions to use for the matrix

    colPosV

    the column position to use for the vector

    kind

    the kind of matrix to create

  69. def toMatriDI(colPos: Seq[Int], colPosV: Int, kind: MatrixKind = DENSE): (MatriD, VectorI)

    Convert 'this' relation into a matrix of doubles and a vector of integers.

    Convert 'this' relation into a matrix of doubles and a vector of integers.

    in the regression equation: 'xb = y' create matrix 'x' and vector 'y'

    colPos

    the column positions to use for the matrix

    colPosV

    the column position to use for the vector

    kind

    the kind of matrix to create

  70. def toMatriI(colPos: Seq[Int], kind: MatrixKind = DENSE): MatriI

    Convert 'this' relation into a matrix of integers.

    Convert 'this' relation into a matrix of integers.

    in the regression equation: 'xb = y' create matrix 'xy'

    colPos

    the column positions to use for the matrix

    kind

    the kind of matrix to create

  71. def toMatriI2(colPos: Seq[Int] = null, kind: MatrixKind = DENSE): MatriI

    Convert 'this' relation into a matrix of integers.

    Convert 'this' relation into a matrix of integers. It will convert doubles and strings to integers.

    in the regression equation: 'xb = y' create matrix 'xy'

    colPos

    the column positions to use for the matrix

    kind

    the kind of matrix to create

  72. def toMatriII(colPos: Seq[Int], colPosV: Int, kind: MatrixKind = DENSE): (MatriI, VectorI)

    Convert 'this' relation into a matrix of integers and a vector of integers.

    Convert 'this' relation into a matrix of integers and a vector of integers.

    in the regression equation: 'xb = y' create matrix 'x' and vector 'y'

    colPos

    the column positions to use for the matrix

    colPosV

    the column position to use for the vector

    kind

    the kind of matrix to create

  73. def toString(): String

    Convert 'this' relation into a string column by column.

    Convert 'this' relation into a string column by column.

    Definition Classes
    Relation → AnyRef → Any
  74. def toVectorD(colName: String): VectorD

    Convert the 'colName' column of 'this' relation into a vector of doubles.

    Convert the 'colName' column of 'this' relation into a vector of doubles.

    colName

    the column name to use for the vector

  75. def toVectorD(colPos: Int): VectorD

    Convert the 'colPos' column of 'this' relation into a vector of doubles.

    Convert the 'colPos' column of 'this' relation into a vector of doubles.

    colPos

    the column position to use for the vector

  76. def toVectorI(colName: String): VectorI

    Convert the 'colName' column of 'this' relation into a vector of integers.

    Convert the 'colName' column of 'this' relation into a vector of integers.

    colName

    the column name to use for the vector

  77. def toVectorI(colPos: Int): VectorI

    Convert the 'colPos' column of 'this' relation into a vector of integers.

    Convert the 'colPos' column of 'this' relation into a vector of integers.

    colPos

    the column position to use for the vector

  78. def toVectorS(colName: String): VectorS

    Convert the 'colName' column of 'this' relation into a vector of integers.

    Convert the 'colName' column of 'this' relation into a vector of integers.

    colName

    the column name to use for the vector

  79. def toVectorS(colPos: Int): VectorS

    Convert the 'colPos' column of 'this' relation into a vector of integers.

    Convert the 'colPos' column of 'this' relation into a vector of integers.

    colPos

    the column position to use for the vector

  80. def union(_r2: Table): Relation

    Union 'this' relation and 'r2'.

    Union 'this' relation and 'r2'. Check that the two relations are compatible.

    Definition Classes
    RelationTable
  81. def uniq_union(cn1: Seq[String], cn2: Seq[String]): Seq[String]

    Combine two sequences of column names, keeping all names from 'cn1' and only those in 'cn2' that are not repeats (i.e., not already in 'cn1').

    Combine two sequences of column names, keeping all names from 'cn1' and only those in 'cn2' that are not repeats (i.e., not already in 'cn1').

    cn1

    the first sequence of column names

    cn2

    the second sequence of column names

    Definition Classes
    Table
  82. def update[T](cName: String, func: () ⇒ String, matchStr: String): Unit

    Update the column named 'cName' using function 'func' for elements with value 'matchStr'.

    Update the column named 'cName' using function 'func' for elements with value 'matchStr'.

    cName

    the name of the column to be updated

    func

    the function used to assign updated values

    matchStr

    the string to be matched to elements

  83. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  84. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  85. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  86. def writeCSV(fileName: String): Unit

    Write 'this' relation into a CSV file with each row written to a line.

    Write 'this' relation into a CSV file with each row written to a line.

    fileName

    the file name of the data file

    Definition Classes
    RelationTable
  87. def writeJSON(fileName: String): Unit

    Write 'this' relation into a JSON file.

    Write 'this' relation into a JSON file.

    fileName

    the file name of the data file

    Definition Classes
    RelationTable
  88. def π(cName: String*): Relation

    Project onto the columns with the given column names.

    Project onto the columns with the given column names.

    cName

    the names of the columns to project onto

    Definition Classes
    RelationTable
  89. def σ[T](cName: String, p: (T) ⇒ Boolean): Relation

    Select elements from columns in 'cName' in 'this' relation that satisfy the predicate 'p'.

    Select elements from columns in 'cName' in 'this' relation that satisfy the predicate 'p'.

    cName

    the name of the column used for selection

    p

    the predicate (Boolean function) to be satisfied

    Definition Classes
    RelationTable
  90. def (r2: Table): Relation

    Intersect 'this' relation and 'r2'.

    Intersect 'this' relation and 'r2'. Check that the two relations are compatible.

    r2

    the other relation

    Definition Classes
    RelationTable
  91. def (r2: Table): Relation

    Union 'this' relation and 'r2'.

    Union 'this' relation and 'r2'. Check that the two relations are compatible.

    r2

    the other relation

    Definition Classes
    RelationTable
  92. def (r2: Table): Relation

    Join 'this' relation and 'r2 by performing a "natural-join".

    Join 'this' relation and 'r2 by performing a "natural-join". Rows from both relations are compared requiring agreement on common attributes (column names).

    r2

    the rhs relation in the join operation

    Definition Classes
    RelationTable

Inherited from Serializable

Inherited from Serializable

Inherited from Product

Inherited from Equals

Inherited from Error

Inherited from Table

Inherited from AnyRef

Inherited from Any

Ungrouped