package generic
Type Members
-
trait
GenericAEVT extends AnyRef
AEVT Index.
AEVT Index.
"The AEVT index provides efficient access to all values for a given attribute, comparable to traditional column access style." (from Datomic documentation)
Access the AEVT Index in Molecule by instantiating an AEVT object with one or more arguments and then add generic attributes:
// Create AEVT Index molecule with 1 entity id argument AEVT(":Person/name").e.v.t.get === List( (e1, "Ben", t2), (e2, "Liz", t5) ) // Narrow search with multiple arguments AEVT(":Person/name", e1).e.v.get === List( (e1, "Ben") ) AEVT(":Person/name", e1, "Ben").e.v.get === List( (e1, "Ben") ) AEVT(":Person/name", e1, "Ben", t2).e.v.get === List( (e1, "Ben") )
Index attributes available:
e- Entity id (Long)a- Full attribute name like ":Person/name" (String)v- Value of Datoms (Any)t- Transaction pointer (Long/Int)tx- Transaction entity id (Long)txInstant- Transaction wall clock time (java.util.Date)op- Operation status: assertion (true) / retraction (false)
- Note
The Molecule Index API's don't allow returning the whole Index/the whole database. So omitting arguments constructing the Index object (like
AEVT.a.e.v.t.get) will throw an exception.
Please use Datomics API if you need to return the whole database Index:
conn.db.datoms(datomic.Database.AEVT)
-
trait
GenericAVET extends AnyRef
AVET Index.
AVET Index.
"The AVET index provides efficient access to particular combinations of attribute and value." (from Datomic documentation)
Access the AVET Index in Molecule by instantiating an AVET object with one or more arguments and then add generic attributes:
// Create AVET Index molecule with 1 entity id argument AVET(":Person/age").e.v.t.get === List( (e1, 42, t2), (e2, 37, t5) (e3, 14, t7), ) // Narrow search with multiple arguments AVET(":Person/age", 42).e.t.get === List( (e1, t2) ) AVET(":Person/age", 42, e1).e.v.get === List( (e1, t2) ) AVET(":Person/age", 42, e1, t2).e.v.get === List( (e1, t2) )
The AVET Index can be filtered by a range of values between
from(inclusive) anduntil(exclusive) for an attribute:AVET.range(":Person/age", Some(14), Some(37)).v.e.t.get === List( (14, e4, t7) // 14 is included in value range // 37 not included in value range // 42 outside value range ) // If `from` is None, the range starts from the beginning AVET.range(":Person/age", None, Some(40)).v.e.t.get === List( (14, e3, t7), (37, e2, t5), ) // If `until` is None, the range goes to the end AVET.range(":Person/age", Some(20), None).v.e.t.get === List( (37, e2, t5), (42, e1, t2) )
Index attributes available:
e- Entity id (Long)a- Full attribute name like ":Person/name" (String)v- Value of Datoms (Any)t- Transaction pointer (Long/Int)tx- Transaction entity id (Long)txInstant- Transaction wall clock time (java.util.Date)op- Operation status: assertion (true) / retraction (false)
- Note
The Molecule Index API's don't allow returning the whole Index/the whole database. So omitting arguments constructing the Index object (like
AVET.a.v.e.t.get) will throw an exception.
Please use Datomics API if you need to return the whole database Index:
conn.db.datoms(datomic.Database.AVET)
fromanduntilcannot both be None since Molecule doesn't allow returning all datoms.
-
trait
GenericEAVT extends AnyRef
EAVT Index.
EAVT Index.
"The EAVT index provides efficient access to everything about a given entity. Conceptually this is very similar to row access style in a SQL database, except that entities can possess arbitrary attributes rather then being limited to a predefined set of columns." (from Datomic documentation)
Access the EAVT Index in Molecule by instantiating an EAVT object with one or more arguments and then add generic attributes:
// Create EAVT Index molecule with 1 entity id argument EAVT(e1).e.a.v.t.get === List( (e1, ":Person/name", "Ben", t1), (e1, ":Person/age", 42, t2), (e1, ":Golf/score", 5.7, t2) ) // Narrow search with multiple arguments EAVT(e1, ":Person/age").a.v.get === List( (":Person/age", 42) ) EAVT(e1, ":Person/age", 42).a.v.get === List( (":Person/age", 42) ) EAVT(e1, ":Person/age", 42, t1).a.v.get === List( (":Person/age", 42) )
Index attributes available:
e- Entity id (Long)a- Full attribute name like ":Person/name" (String)v- Value of Datoms (Any)t- Transaction pointer (Long/Int)tx- Transaction entity id (Long)txInstant- Transaction wall clock time (java.util.Date)op- Operation status: assertion (true) / retraction (false)
- Note
The Molecule Index API's don't allow returning the whole Index/the whole database. So omitting arguments constructing the Index object (like
EAVT.e.a.v.t.get) will throw an exception.
Please use Datomics API if you need to return the whole database Index:
conn.db.datoms(datomic.Database.EAVT)
-
trait
GenericLog extends AnyRef
Log interface.
Log interface.
Datomic's database log is a recording of all transaction data in historic order, organized for efficient access by transaction.
Instantiate Log object with tx range arguments betweenfrom(inclusive) anduntil(exclusive), and add Log attributes to be returned as tuples of data:// Data from transaction t1 until t4 (exclusive) Log(Some(t1), Some(t4)).t.e.a.v.op.get === List( (t1, e1, ":Person/name", "Ben", true), (t1, e1, ":Person/age", 41, true), (t2, e2, ":Person/name", "Liz", true), (t2, e2, ":Person/age", 37, true), (t3, e1, ":Person/age", 41, false), (t3, e1, ":Person/age", 42, true) ) // If `from` is None, the range starts from the beginning Log(None, Some(t3)).v.e.t.get === List( (t1, e1, ":Person/name", "Ben", true), (t1, e1, ":Person/age", 41, true), (t2, e2, ":Person/name", "Liz", true), (t2, e2, ":Person/age", 37, true) // t3 not included ) // If `until` is None, the range goes to the end Log(Some(t2), None).v.e.t.get === List( // t1 not included (t2, e2, ":Person/name", "Liz", true), (t2, e2, ":Person/age", 37, true), (t3, e1, ":Person/age", 41, false), (t3, e1, ":Person/age", 42, true) )
Log attributes available:
e- Entity id (Long)a- Full attribute name like ":Person/name" (String)v- Value of Datoms (Any)t- Transaction pointer (Long/Int)tx- Transaction entity id (Long)txInstant- Transaction wall clock time (java.util.Date)op- Operation status: assertion (true) / retraction (false)
- Note
Contrary to the Datomic Log which is map of individual transactions the Molecule Log implementation is flattened to be one continuous list of transaction data. This is to have a transparent unified return type as all other molecules returning data. Data can always be grouped if needed.
-
trait
GenericSchema extends AnyRef
Container for Schema object.
Container for Schema object.
Some Datomic types map to two Scala types:
Datomic/Scala types:
- string - String
- boolean - Boolean
- long - Int, Long
- float - Float
- double - Double
- bigint - BigInt
- bigdec - BigDecimal
- instant - java.util.Date
- uuid - java.util.UUID
- uri - java.net.URI
- ref - Long
-
trait
GenericVAET extends AnyRef
VAET reverse Index.
VAET reverse Index.
"The VAET index contains all and only datoms whose attribute has a :db/valueType of :db.type/ref. This is also known as the reverse index, since it allows efficient navigation of relationships in reverse." (from Datomic documentation)
Access the VAET Index in Molecule by instantiating a VAET object with one or more arguments and then add generic attributes:
// Say we have 3 entities pointing to one entity: Release.e.name.Artists.e.name.get === List( (r1, "Abbey Road", a1, "The Beatles"), (r2, "Magical Mystery Tour", a1, "The Beatles"), (r3, "Let it be", a1, "The Beatles"), ) // .. then we can get the reverse relationships with the VAET Index: VAET(a1).v.a.e.get === List( (a1, ":Release/artists", r1), (a1, ":Release/artists", r2), (a1, ":Release/artists", r3), ) // Narrow search with multiple arguments VAET(a1, ":Release/artist").e.get === List(r1, r2, r3) VAET(a1, ":Release/artist", r2).e.get === List(r2) VAET(a1, ":Release/artist", r2, t7).e.get === List(r2)
Index attributes available:
e- Entity id (Long)a- Full attribute name like ":Person/name" (String)v- Value of Datoms (Any)t- Transaction pointer (Long/Int)tx- Transaction entity id (Long)txInstant- Transaction wall clock time (java.util.Date)op- Operation status: assertion (true) / retraction (false)
- Note
The Molecule Index API's don't allow returning the whole Index/the whole database. So omitting arguments constructing the Index object (like
VAET.v.a.e.t.get) will throw an exception.
Please use Datomics API if you need to return the whole database Index:
conn.db.datoms(datomic.Database.VAET)

Documentation/API for the Molecule library - a meta DSL for the Datomic database.
scalamolecule.org | Github | Forum