Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
srfc opened this issue Sep 13, 2018 · 0 comments

Comments

@srfc
Copy link
Collaborator

srfc commented Sep 13, 2018

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant