Question

I am trying to find an efficient way to determine if a Datomic attribute is already defined in a database.

I am using the Scala wrapper Datomisca. Here is the best way that I have found so far:

val exists =
  Datomic.q(Query("""
    [:find ?attr
     :in $
     :where [_ :db.install/attribute ?i]
            [?i :db/ident ?part]
    ]"""), Datomic.database).map {
      case DKeyword(keyword) => keyword.toString
    }.contains(":some/attribute")

but I guessing that there is a better way.

I'm running Datomic-pro 0.9.4755 with Datomisca 0.6.

Was it helpful?

Solution

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top