Packages

  • package root

    Documentation/API for the Molecule library - a meta DSL for the Datomic database.

    scalamolecule.org | Github | Forum

    Definition Classes
    root
  • package molecule

    Molecule library - a Scala meta-DSL for the Datomic database.

    Molecule library - a Scala meta-DSL for the Datomic database.

    Definition Classes
    root
  • package core
    Definition Classes
    molecule
  • package api
    Definition Classes
    core
  • package exception
    Definition Classes
    api
  • package getAsyncObj

    Asynchronous getter methods to retrieve data as objects.

    Asynchronous getter methods to retrieve data as objects.

    For convenience, all synchronous getter methods from the get package are here wrapped in Futures.

    The Datomic On-Prem(ises) server model provides a Peer that returns data synchronously. The Peer which lives in application memory caches data aggressively and for data fitting in memory, latency can be extremely low and queries return very fast. And even when access to disk is needed, clever branching is used. Memcached is also an option.

    The Datomic Cloud model data returns data asynchronously. If Datomic creates a Java API for the Cloud model, Molecule could relatively easy adapt to this model too. In the meanwhile, Future-wrapped methods in this package can be used.

    Molecule has 4 groups of asynchronous getters for objects, each returning Futures of data in various formats:

    • GetAsyncObjArray - fastest retrieved typed data set. Can be traversed with a fast while loop
    • GetAsyncObjIterable - for lazily traversing row by row
    • GetAsyncObjList - default getter returning Lists of objects. Convenient typed data, suitable for smaller data sets
    • GetAsyncRaw - fastest retrieved raw un-typed data from Datomic

    Getters in each of the 4 groups come with 5 time-dependent variations:

    • getAsync [current data]
    • getAsyncAsOf
    • getAsyncSince
    • getAsyncWith
    • getAsyncHistory

    Each time variation has various overloads taking different parameters (see each group for more info).

    Definition Classes
    api
    See also

    equivalent synchronous getters in the getTpl package.

  • package getAsyncTpl

    Asynchronous getter methods to retrieve tuples of data.

    Asynchronous getter methods to retrieve tuples of data.

    For convenience, all synchronous getter methods from the get package are here wrapped in Futures.

    The Datomic On-Prem(ises) server model provides a Peer that returns data synchronously. The Peer which lives in application memory caches data aggressively and for data fitting in memory, latency can be extremely low and queries return very fast. And even when access to disk is needed, clever branching is used. Memcached is also an option.

    The Datomic Cloud model data returns data asynchronously. If Datomic creates a Java API for the Cloud model, Molecule could relatively easy adapt to this model too. In the meanwhile, Future-wrapped methods in this package can be used.

    Molecule has 4 groups of asynchronous getters for tuples, each returning Futures of data in various formats:

    • GetAsyncTplArray - fastest retrieved typed data set. Can be traversed with a fast while loop
    • GetAsyncTplIterable - for lazily traversing row by row
    • GetAsyncTplList - default getter returning Lists of tuples. Convenient typed data, suitable for smaller data sets
    • GetAsyncRaw - fastest retrieved raw un-typed data from Datomic

    Getters in each of the 4 groups come with 5 time-dependent variations:

    • getAsync [current data]
    • getAsyncAsOf
    • getAsyncSince
    • getAsyncWith
    • getAsyncHistory

    Each time variation has various overloads taking different parameters (see each group for more info).

    Definition Classes
    api
    See also

    equivalent synchronous getters in the getTpl package.

  • package getObj

    Synchronous getter methods to retrieve data as objects.

    Synchronous getter methods to retrieve data as objects.

    The Datomic On-Prem(ises) server model provides a Peer that returns data synchronously. The Peer which lives in application memory caches data aggressively and for data fitting in memory latency can be extremely low and queries return very fast. And even when access to disk is needed, clever branching is used. Memcached is also an option.

    The Datomic Cloud model data returns data asynchronously. If Datomic creates a Java API for the Cloud model, Molecule could relatively easy adapt to this model too. In the meanwhile, Future-wrapped methods in this package can be used.

    Molecule has 3 groups of synchronous object getters, each returning data in various formats:

    • GetObjArray - fastest retrieved typed data set. Can be traversed with a fast while loop
    • GetObjIterable - for lazily traversing row by row
    • GetObjList - default getter returning Lists of objects. Convenient typed data, suitable for smaller data sets

    Getters in each of the 5 groups come with 5 time-dependent variations:

    • get [current data]
    • getAsOf
    • getSince
    • getWith
    • getHistory

    Each time variation has various overloads taking different parameters (see each group for more info).

    Definition Classes
    api
    See also

    equivalent asynchronous getters in the getAsyncTpl package.

  • package getTpl

    Synchronous getter methods to retrieve data as tuples.

    Synchronous getter methods to retrieve data as tuples.

    The Datomic On-Prem(ises) server model provides a Peer that returns data synchronously. The Peer which lives in application memory caches data aggressively and for data fitting in memory latency can be extremely low and queries return very fast. And even when access to disk is needed, clever branching is used. Memcached is also an option.

    Molecule has 4 groups of synchronous tuple getters, each returning data in various formats:

    • GetTplArray - fastest retrieved typed data set. Can be traversed with a fast while loop
    • GetTplIterable - for lazily traversing row by row
    • GetTplList - default getter returning Lists of tuples. Convenient typed data, suitable for smaller data sets
    • GetRaw - fastest retrieved raw un-typed data from Datomic

    Getters in each of the 4 groups come with 5 time-dependent variations:

    • get [current data]
    • getAsOf
    • getSince
    • getWith
    • getHistory

    Each time variation has various overloads taking different parameters (see each group for more info).

    Definition Classes
    api
    See also

    equivalent asynchronous getters in the getAsyncTpl package.

  • GetAsyncRaw
  • GetRaw
  • InputMolecule
  • Keywords
  • Molecule_0
  • Molecule_1
  • Molecule_2
  • Molecule_3
  • OptionalMapOps
  • TxBundles
  • TxFunctions

trait Molecule_2[Obj, I1, I2] extends InputMolecule

Shared interfaces of input molecules awaiting 2 inputs.

// Sample data set
Person.name.profession.age insert List(
  ("Ann", "doctor", 37),
  ("Ben", "teacher", 37),
  ("Joe", "teacher", 32),
  ("Liz", "teacher", 28)
)

// Input molecule awaiting 2 inputs for `profession` and `age`
val profAge = m(Person.name.profession_(?).age_(?))


// A. Pairs of input .................................

// One pair as params
profAge("doctor", 37).get === List("Ann")

// One or more pairs
profAge(("doctor", 37)).get === List("Ann")
profAge(("doctor", 37), ("teacher", 37)).get.sorted === List("Ann", "Ben")

// One or more logical pairs
// [pair-expression] or [pair-expression] or ...
profAge(("doctor" and 37) or ("teacher" and 32)).get.sorted === List("Ann", "Joe")
profAge(Seq(("doctor", 37), ("teacher", 37))).get.sorted === List("Ann", "Ben")

// List of pairs
profAge(Seq(("doctor", 37))).get === List("Ann")


// B. 2 groups of input, one for each input attribute .................................

// Two expressions
// [profession-expression] and [age-expression]
profAge("doctor" and 37).get === List("Ann")
profAge(("doctor" or "teacher") and 37).get.sorted === List("Ann", "Ben")
profAge(("doctor" or "teacher") and (32 or 28)).get.sorted === List("Joe", "Liz")

// Two Lists
profAge(Seq("doctor"), Seq(37)).get === List("Ann")
profAge(Seq("doctor", "teacher"), Seq(37)).get.sorted === List("Ann", "Ben")
profAge(Seq("teacher"), Seq(37, 32)).get.sorted === List("Ben", "Joe")
profAge(Seq("doctor", "teacher"), Seq(37, 32)).get.sorted === List("Ann", "Ben", "Joe")
I1

Type of input matching first attribute with ? marker (profession: String)

I2

Type of input matching second attribute with ? marker (age: Int)

Source
Molecule_2.scala
Linear Supertypes
InputMolecule, Molecule, AnyRef, Any
Ordering
  1. Grouped
  2. Alphabetic
  3. By Inheritance
Inherited
  1. Molecule_2
  2. InputMolecule
  3. Molecule
  4. AnyRef
  5. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Abstract Value Members

  1. abstract val _model: Model

    Internal Model representation of molecule.

    Internal Model representation of molecule.

    Molecule transforms custom boilerplate DSL constructs to Datomic queries in 3 steps:

    Custom DSL molecule --> Model --> Query --> Datomic query string

    Definition Classes
    Molecule
  2. abstract val _nestedQuery: Option[Query]

    Internal optional Query representation of nested molecule with added entity search for each level.

    Internal optional Query representation of nested molecule with added entity search for each level.

    Molecule transforms custom boilerplate DSL constructs to Datomic queries in 3 steps:

    Custom DSL molecule --> Model --> Query --> Datomic query string

    Definition Classes
    Molecule
  3. abstract val _query: Query

    Internal Query representation of molecule.

    Internal Query representation of molecule.

    Molecule transforms custom boilerplate DSL constructs to Datomic queries in 3 steps:

    Custom DSL molecule --> Model --> Query --> Datomic query string

    Definition Classes
    Molecule
  4. abstract val _rawNestedQuery: Option[Query]

    Internal un-optimized optional Query representation of nested molecule with added entity search for each level.

    Internal un-optimized optional Query representation of nested molecule with added entity search for each level.

    Molecule transforms custom boilerplate DSL constructs to Datomic queries in 3 steps:

    Custom DSL molecule --> Model --> Query --> Datomic query string

    Definition Classes
    Molecule
  5. abstract val _rawQuery: Query

    Internal un-optimized Query representation molecule.

    Internal un-optimized Query representation molecule.

    Molecule transforms custom boilerplate DSL constructs to Datomic queries in 3 steps:

    Custom DSL molecule --> Model --> Query --> Datomic query string

    Definition Classes
    Molecule
  6. abstract def apply(in1: Seq[I1], in2: Seq[I2])(implicit conn: Conn): Molecule

    Resolve input molecule by applying 2 Seq of values, one for each input attribute

    Resolve input molecule by applying 2 Seq of values, one for each input attribute

    // Sample data set
    Person.name.profession.age insert List(
      ("Ann", "doctor", 37),
      ("Ben", "teacher", 37),
      ("Joe", "teacher", 32),
      ("Liz", "teacher", 28)
    )
    
    // Input molecule awaiting 2 inputs for profession and age
    val profAge = m(Person.name.profession_(?).age_(?))
    
    // Apply 2 Seq of values, each matching one of the input attributes
    profAge(Seq("doctor"), Seq(37)).get === List("Ann")
    profAge(Seq("doctor", "teacher"), Seq(37, 32)).get.sorted === List("Ann", "Ben", "Joe")
    
    // Number of arguments in each Seq don't have to match but can be asymmetric
    profAge(Seq("doctor", "teacher"), Seq(37)).get.sorted === List("Ann", "Ben")
    profAge(Seq("teacher"), Seq(37, 32)).get.sorted === List("Ben", "Joe")
    in1

    Seq of values matching first input attribute (professions: Seq[String])

    in2

    Seq of values matching second input attribute (ages: Seq[Int])

    conn

    Implicit Conn in scope

    returns

    Resolved molecule that can be queried

  7. abstract def apply(and: And2[I1, I2])(implicit conn: Conn): Molecule

    Resolve input molecule by applying 2 expressions, one for each input attribute

    Resolve input molecule by applying 2 expressions, one for each input attribute

    // Sample data set
    Person.name.profession.age insert List(
      ("Ann", "doctor", 37),
      ("Ben", "teacher", 37),
      ("Joe", "teacher", 32),
      ("Liz", "teacher", 28)
    )
    
    // Input molecule awaiting 2 inputs for `profession` and `age`
    val profAge = m(Person.name.profession_(?).age_(?))
    
    // Apply 2 expressions, one for each input attribute
    // [profession-expression] and [age-expression]
    profAge("doctor" and 37).get === List("Ann")
    profAge(("doctor" or "teacher") and 37).get.sorted === List("Ann", "Ben")
    profAge(("doctor" or "teacher") and (32 or 28)).get.sorted === List("Joe", "Liz")
    and

    First input expr and second input expr

    conn

    Implicit Conn in scope

    returns

    Resolved molecule that can be queried

  8. abstract def apply(ins: Seq[(I1, I2)])(implicit conn: Conn): Molecule

    Resolve input molecule by applying Seq of value pairs

    Resolve input molecule by applying Seq of value pairs

    // Sample data set
    Person.name.profession.age insert List(
      ("Ann", "doctor", 37),
      ("Ben", "teacher", 37),
      ("Joe", "teacher", 32),
      ("Liz", "teacher", 28)
    )
    
    // Input molecule awaiting 2 inputs for `profession` and `age`
    val profAge = m(Person.name.profession_(?).age_(?))
    
    // Apply Seq of one or more value pairs, each matching both input attributes
    profAge(Seq(("doctor", 37))).get === List("Ann")
    profAge(Seq(("doctor", 37), ("teacher", 37))).get.sorted === List("Ann", "Ben")
    ins

    Seq of value pairs, each matching both input attributes

    conn

    Implicit Conn in scope

    returns

    Resolved molecule that can be queried

  9. abstract def apply(tpl: (I1, I2), tpls: (I1, I2)*)(implicit conn: Conn): Molecule

    Resolve input molecule by applying one or more value pairs

    Resolve input molecule by applying one or more value pairs

    // Sample data set
    Person.name.profession.age insert List(
      ("Ann", "doctor", 37),
      ("Ben", "teacher", 37),
      ("Joe", "teacher", 32),
      ("Liz", "teacher", 28)
    )
    
    // Input molecule awaiting 2 inputs for `profession` and `age`
    val profAge = m(Person.name.profession_(?).age_(?))
    
    // Apply one or more value pairs, each matching both input attributes
    profAge(("doctor", 37)).get === List("Ann")
    profAge(("doctor", 37), ("teacher", 37)).get.sorted === List("Ann", "Ben")
    tpl

    First pair of values matching both input attributes

    tpls

    Optional more pairs of values matching both input attributes

    conn

    Implicit Conn in scope

    returns

    Resolved molecule that can be queried

  10. abstract def apply(or: Or2[I1, I2])(implicit conn: Conn): Molecule

    Resolve input molecule by applying one or more pairs of expressions, each matching both input attributes

    Resolve input molecule by applying one or more pairs of expressions, each matching both input attributes

    // Sample data set
    Person.name.profession.age insert List(
      ("Ann", "doctor", 37),
      ("Ben", "teacher", 37),
      ("Joe", "teacher", 32),
      ("Liz", "teacher", 28)
    )
    
    // Input molecule awaiting 2 inputs for `profession` and `age`
    val profAge = m(Person.name.profession_(?).age_(?))
    
    // Apply two or more pair expressions, each matching both input attributes
    // [profession/age-expression] or [profession/age-expression] or ...
    profAge("doctor" and 37).get.sorted === List("Ann")
    profAge(("doctor" and 37) or ("teacher" and 32)).get.sorted === List("Ann", "Joe")
    or

    Two or more pair-wise expressions separated by or

    conn

    Implicit Conn in scope

    returns

    Resolved molecule that can be queried

  11. abstract def apply(i1: I1, i2: I2)(implicit conn: Conn): Molecule

    Resolve input molecule by applying 2 input values as individual args

    Resolve input molecule by applying 2 input values as individual args

    // Sample data set
    Person.name.profession.age insert List(
      ("Ann", "doctor", 37),
      ("Ben", "teacher", 37),
      ("Joe", "teacher", 32),
      ("Liz", "teacher", 28)
    )
    
    // Input molecule awaiting 2 inputs for `profession` and `age`
    val profAge = m(Person.name.profession_(?).age_(?))
    
    // Apply 2 input values
    profAge("doctor", 37).get === List("Ann")
    i1

    Input value matching first input attribute (profession: String)

    i2

    Input value matching second input attribute (age: Int)

    conn

    Implicit Conn in scope

    returns

    Resolved molecule that can be queried

Concrete Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  4. def addNilClause(clauses: Seq[Clause], e: Var, kw: KW, v0: Var): Seq[Clause]
    Attributes
    protected
    Definition Classes
    InputMolecule
  5. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  6. def bindSeqs(query: Query, inputRaw1: Seq[I1], inputRaw2: Seq[I2]): Query
    Attributes
    protected
  7. def bindValues(query: Query, inputTuples: Seq[(I1, I2)]): Query
    Attributes
    protected
  8. def cardinality(nsFull: String, attr: String): Int
    Attributes
    protected
    Definition Classes
    InputMolecule
  9. def clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... ) @native()
  10. def dataClause(e: String, kw: KW, enumPrefix: Option[String], arg: Any, i: Int): Seq[Clause]
    Attributes
    protected
    Definition Classes
    InputMolecule
  11. def deepNil(args: Seq[Any]): Boolean
    Attributes
    protected
    Definition Classes
    InputMolecule
  12. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  13. def equals(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  14. def finalize(): Unit
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  15. final def getClass(): Class[_]
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  16. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  17. def isExpression(nsFull: String, attr: String): Boolean
    Attributes
    protected
    Definition Classes
    InputMolecule
  18. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  19. def isTacit(nsFull: String, attr: String): Boolean
    Attributes
    protected
    Definition Classes
    InputMolecule
  20. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  21. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  22. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  23. def resolveAnd2(and2: And2[I1, I2]): (Seq[I1], Seq[I2])
    Attributes
    protected
  24. def resolveInput[T](query: Query, ph: Placeholder, inputs: Seq[T], ruleName: String = "rule1", unifyRule: Boolean = false): Query
    Attributes
    protected
    Definition Classes
    InputMolecule
  25. def resolveOr[I1](or: Or[I1]): Seq[I1]
    Attributes
    protected
    Definition Classes
    InputMolecule
  26. def resolveOr2(or: Or2[I1, I2]): Seq[(I1, I2)]
    Attributes
    protected
  27. final def synchronized[T0](arg0: ⇒ T0): T0
    Definition Classes
    AnyRef
  28. def toString(): String
    Definition Classes
    AnyRef → Any
  29. def valueClauses[TT](e: String, kw: KW, enumPrefix: Option[String], args: TT): Seq[Clause]
    Attributes
    protected
    Definition Classes
    InputMolecule
  30. def varsAndPrefixes(query: Query): Seq[(Var, String)]
    Attributes
    protected
    Definition Classes
    InputMolecule
  31. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  32. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  33. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... ) @native()

Inherited from InputMolecule

Inherited from Molecule

Inherited from AnyRef

Inherited from Any

internal

Ungrouped