-
-
Save sorenmacbeth/39313f6f35935a2e27a3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defmacro mk-property-tap [property-class property-id property-name] | |
(let [md (thrift-meta-data (str property-class "Value")) | |
taps (for [f (.keySet md)] | |
(let [val-id (.getThriftFieldId f) | |
val-name (.getFieldName f)] | |
`(defn ~(symbol (str property-name "-" val-name "-tap")) [source-dir#] | |
(let [tap# (split-data-tap source-dir# [~property-id ~val-id])] | |
(<- [?id ?property ?pedigree] | |
(tap# _ ?data) | |
(expand-data ?data :> ?pedigree ?du) | |
(expand-property ?du :> ?id ?property))))))] | |
`(do ~@taps))) | |
(defn bootstrap-schema [] | |
(let [md (thrift-meta-data ybot.schema.DataUnit)] | |
(for [f (.keySet md)] | |
(let [id (.getThriftFieldId f) | |
name (.getFieldName f) | |
class-name (-> (.get md f) (.valueMetaData) (.structClass) (.getName))] | |
(mk-property-tap class-name id name))))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment