Skip to content

iwillig/metaobject

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Metaobject

This project is an object catalog system for Datalog database systems. It is designed to help you craft and maintain complex and object focused database schemas.

Sometimes you want to treat a collection of DataLog attributes as a single entity or object. For example, let's say we have a person and email attribute structure. Something like the following,

{:email/address {:db/cardinality :db.cardinality/one, :db/type :db.type/string},
 :email/public-id {:db/type :db.type/uuid, :db/unique :db.unique/value},

 :person/emails {:db/cardinality :db.cardinality/many, :db/type :db.type/ref},
 :person/full-name {:db/cardinality :db.cardinality/one, :db/type :db.type/string},
 :person/name {:db/cardinality :db.cardinality/one, :db/type :db.type/string},
 :person/public-id {:db/type :db.type/uuid, :db/unique :db.unique/value}}

This works, but we don't have a way of talking about the two entity types, email and person, in a plain old DataLog database. With metaobject, you could define those DataLog attributes with the following.

  (metaobj/obj-catalog
   {:obj-types
    [{:name ::person
      :attrs
      [{:name ::name
        :type :db.type/string}
       {:name ::full-name
        :type :db.type/string}
       {:name         ::emails
        :ref-obj-name ::email
        :cardinality  :db.cardinality/many}]}
     {:name ::email
      :attrs
      [{:name ::address
        :type :db.type/string}]}]})

Development notes

Run tests

bb test

Run Linter

bb lint

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published