(clear) ;; import/export coordination (defmodule A) (deftemplate A::foo (slot x)) (defmodule B (import A ?ALL)) (defrule B::rule1 (foo (x 3)) =>) (clear) (defmodule A (export ?ALL)) (deftemplate A::foo (slot x)) (defmodule B (import A ?ALL)) (defrule B::rule1 (foo (x 3)) =>) (clear) (defmodule A (export deftemplate foo)) (deftemplate A::foo (slot x)) (defmodule B (import A ?ALL)) (defrule B::rule1 (foo (x 3)) =>) (clear) (defmodule A (export deftemplate bar)) (deftemplate A::foo (slot x)) (defmodule B (import A ?ALL)) (defrule B::rule1 (foo (x 3)) =>) (clear) ;; one level of importation (defmodule A (export ?ALL)) (deftemplate A::foo (slot x)) (deftemplate A::bar (slot x)) (defmodule B) (defrule B::rule1 (foo (x 3)) =>) (defrule B::rule2 (bar (x 3)) =>) (defmodule C (import A ?ALL)) (defrule C::rule1 (foo (x 3)) =>) (defrule C::rule2 (bar (x 3)) =>) (defmodule D (import A deftemplate ?ALL)) (defrule D::rule1 (foo (x 3)) =>) (defrule D::rule2 (bar (x 3)) =>) (defmodule E (import A deftemplate foo bar)) (defrule E::rule1 (foo (x 3)) =>) (defrule E::rule2 (bar (x 3)) =>) (defmodule F (import A deftemplate bar)) (defrule F::rule1 (foo (x 3)) =>) (defrule F::rule2 (bar (x 3)) =>) (defmodule G (import A deftemplate foo)) (defrule G::rule1 (foo (x 3)) =>) (defrule G::rule2 (bar (x 3)) =>) (clear) ;; two levels of importation (defmodule A (export ?ALL)) (deftemplate A::foo (slot x)) (deftemplate A::bar (slot x)) (defmodule B1 (export ?ALL)) (defmodule B2 (import B1 ?ALL)) (defrule B2::rule1 (foo (x 3)) =>) (defrule B2::rule2 (bar (x 3)) =>) (defmodule C1 (import A ?ALL) (export ?ALL)) (defmodule C2 (import C1 deftemplate ?ALL)) (defrule C2::rule1 (foo (x 3)) =>) (defrule C2::rule2 (bar (x 3)) =>) (defmodule D1 (import A deftemplate ?ALL) (export ?ALL)) (defmodule D2 (import D1 deftemplate ?NONE)) (defrule D2::rule1 (foo (x 3)) =>) (defrule D2::rule2 (bar (x 3)) =>) (defmodule E1 (import A deftemplate foo bar) (export ?ALL)) (defmodule E2 (import E1 deftemplate foo bar)) (defrule E2::rule1 (foo (x 3)) =>) (defrule E2::rule2 (bar (x 3)) =>) (defmodule F1 (import A deftemplate bar) (export ?ALL)) (defmodule F2 (import F1 deftemplate foo)) (defrule F2::rule1 (foo (x 3)) =>) (defrule F2::rule2 (bar (x 3)) =>) (defmodule G1 (import A deftemplate foo) (export ?ALL)) (defmodule G2 (import G1 deftemplate foo)) (defrule G2::rule1 (foo (x 3)) =>) (defrule G2::rule2 (bar (x 3)) =>) (clear) ;; Redefining module (deftemplate A::a) (defmodule A) (deftemplate A::a) (clear) ;; Bad defmodule name (defmodule) (defmodule ::) (defmodule ::xy) (defmodule zw::) (defmodule qrs::tu) (clear) (defmodule X) (list-defmodules) (clear) ;; Use of imported deftemplates on the LHS (defmodule A (export ?ALL)) (deftemplate A::foo (slot x)) (defmodule B (import A ?ALL)) (deftemplate B::bar (slot y)) (defmodule C (import A ?ALL)) (deftemplate C::yak (slot z)) (defrule C::bad (bar (y 3)) =>) (defrule C::good (foo (x 2)) (yak (z 4)) =>) (defrule B::bad (yak (z 4)) =>) (defrule B::good (foo (x 2)) (bar (y 3)) =>) (defrule A::bad1 (yak (z 4)) =>) (defrule A::bad2 (bar (y 3)) =>) (defrule A::good (foo (x 2)) =>) (clear) ;; Conflicting Definitions (defmodule A (export ?ALL)) (deftemplate A::foo) (defmodule B (export ?ALL)) (deftemplate B::foo) (defmodule C (import A ?ALL) (import B ?ALL)) (defrule C::bar (foo) =>) (clear) (defmodule MAIN (export ?ALL)) (deftemplate MAIN::foo) (defmodule A (import MAIN ?ALL) (export ?ALL)) (defmodule B (import MAIN ?ALL) (export ?ALL)) (defmodule C (import A ?ALL) (import B ?ALL)) (defrule C::bar (foo) =>) (clear) (defmodule A (export ?ALL)) (deftemplate A::foo) (defmodule B (import A ?ALL)) (deftemplate B::foo) (clear) ;; Port items bad syntax (defmodule A) (defmodule B import) (defmodule B (import)) (defmodule B (import C)) (defmodule B (import A)) (ppdefmodule B) (defmodule B (import A C)) (defmodule B (import A) (import MAIN)) (ppdefmodule A) (ppdefmodule B) (clear) ;; auto-focus (defmodule MAIN (export ?ALL)) (defrule MAIN::bar (declare (auto-focus TRUE)) =>) (defmodule A (import MAIN ?ALL)) (defrule A::foo (declare (auto-focus TRUE)) =>) (watch focus) (reset) (unwatch focus)