datomic join query execution and metadata -
in java (through jdbc driver) when execute sql join query t1(a, b) , t2(x, y) output contains joined record j(a, b, x, y). along metadata tells me in joined record j fields "a" , "b" came table t1 , fields "x" , "y" came table t2.
my question is, when run datomic join query in java, kind of metadata information tells me field in joined record belongs input table?
datomic not have tables. triple store. time axis built in.
the triple entity-attribute-value. so, can include matched entities in output, along attributes , values.
for example, in database triples:
[joe :likes :pizza] [joe :favorite-color :gray] [joe :name "joe"] [jane :likes :pizza] [jane :favorite-color :blue] [jane :name "jane"]
joe , jane entities (which things having unique identifier , attach attributes), :likes, :name , :favorite-color attributes , :pizza, :grey , :blue values.
a query find likes pizza , has favorite-color gray
(d/q '[:find ?person :where [?person :likes :pizza] [?person :favorite-color :gray]] db)
the result here list of entities, in case, joe
. entity can navigate attributes (name,likes etc). there's not point in query can return variable, can entity attribute or value.
i'll stop short here datomic has great tutorials along official docs.
Comments
Post a Comment