Return Maps

Note

Because Datomic Cloud is free, it is no longer distributed via AWS Marketplace. Use CloudFormation instead; see Datomic Cloud Setup.

Most Datomic queries return tuples, but sometimes you just want maps. Today’s release of the Datomic Cloud client library adds return maps to Datomic datalog. For example, the following query uses the new :keys clause to request maps with :artist and :release keys:

[:find ?artist-name ?release-name
 :keys artist release
 :where [?release :release/name ?release-name]
 [?release :release/artists ?artist]
 [?artist :artist/name ?artist-name]]

Running against the mbrainz-sample database, this query returns:

#{{:artist "George Jones" :release "With Love"}
 {:artist "Shocking Blue" :release "Hello Darkness / Pickin' Tomatoes"}
 {:artist "Junipher Greene" :release "Friendship"}
 ...}

To try return maps, you can


← Previous post HTTP Direct for Datomic Cloud Next post → Tuples and Database Predicates