1.2.0 permalink Arrow_down_16x16
  • (compute-sip bindings i-preds rule)
Given a set of bound column names, return an adorned sip for this
rule. A set of intensional predicates should be provided to
determine what should be adorned.

0 Examples top

Log in to add / edit an example.

See Also top

Log in to add a see also.

Plus_12x12 Minus_12x12 Source clojure/contrib/datalog/rules.clj:99 top

(defn compute-sip
  "Given a set of bound column names, return an adorned sip for this
   rule.  A set of intensional predicates should be provided to
   determine what should be adorned."
  [bindings i-preds rule]
  (let [next-lit (fn [bv body]
                   (or (first (drop-while
                               #(not (literal-appropriate? bv %))
                               body))
                       (first (drop-while (complement positive?) body))))
        adorn (fn [lit bvs]
                (if (i-preds (literal-predicate lit))
                  (let [bnds (union (get-cs-from-vs lit bvs)
                                    (get-self-bound-cs lit))]
                    (adorned-literal lit bnds))
                  lit))
        new-h (adorned-literal (:head rule) bindings)]
    (loop [bound-vars (get-vs-from-cs (:head rule) bindings)
           body (:body rule)
           sip []]
      (if-let [next (next-lit bound-vars body)]
        (recur (union bound-vars (literal-vars next))
               (remove #(= % next) body)
               (conj sip (adorn next bound-vars)))
        (build-rule new-h (concat sip body))))))
Vars in clojure.contrib.datalog.rules/compute-sip: = concat conj defn if-let let loop next remove
Used in 0 other vars

Comments top

No comments for compute-sip. Log in to add a comment.