1.2.0 permalink Arrow_down_16x16
  • (is-safe? rule)
Is the rule safe according to the datalog protocol?

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:46 top

(defn is-safe?
  "Is the rule safe according to the datalog protocol?"
  [rule]
  (let [hv (literal-vars (:head rule))
        bpv (apply union (map positive-vars (:body rule)))
        bnv (apply union (map negative-vars (:body rule)))
        ehv (difference hv bpv)
        env (difference bnv bpv)]
    (when-not (empty? ehv)
      (throwf "Head vars %s not bound in body in rule %s" ehv rule))
    (when-not (empty? env)
      (throwf "Body vars %s not bound in negative positions in rule %s" env rule))
    rule))
Vars in clojure.contrib.datalog.rules/is-safe?: defn empty? let when-not
Used in 0 other vars

Comments top

No comments for is-safe?. Log in to add a comment.