Skip to content

Create RelationDef subtypes for Relation implementations (e.g. SingleRowRelationDef) #118

@srfc

Description

@srfc

Issue

  • Make RelationDef abstract and use subtypes to define specific Relation implementations

Problem Description

  • Currently a RelationDef can be used to define an arbitrary Relation implementation (SingleRowRelation, RowRelation, ColumnRelation, etc.)
  • The semantic of a RelationDef therefore is merely a schema definition
  • This leads to a mix of concerns when defining Dactors because only there it is defined what kind of Relation is actually instantiated from the RelationDef
  • Proposed interface allows for clear definition syntax even when using various Relation types in a Dactor:
// Companion object
object Info extends SingleRowRelationDef("info") {
  // [...]
}
object Cast extends RowRelationDef("cast") { 
  // [...]
}

// Dactor
class Film(id: Int) extends Dactor(id) {
  override protected val relations: Map[RelationDef, MutableRelation] =
    createRelations(Set(Film.Info, Film.Cast)) // a single relation instantiation function!
  override def receive: Receive = Actor.emptyBehavior
}
  • This will also make it easier to develop a DSL for data modelling

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions