module ExampleCT2 where import Sequenic.CTy.Types ct :: CTree ct = [age,gender,studentType,nationality,pc,os,height,weight,occupation,status] where age :: Category age = Cat "Age" [Leaf "<18", Leaf "18-40", Leaf ">40"] gender :: Category gender = Cat "Gender" [Leaf "Male",Leaf "Female"] studentType :: Category studentType = Cat "sType" [master,Leaf "Bachelor",Leaf "PhD"] where master :: Partition master = Node "Master" [Leaf "fullMaster", Leaf "Mixed"] nationality :: Category nationality = Cat "Nationality" [foreign, Leaf "Dutch"] where foreign :: Partition foreign = Node "Foreign" [Leaf "EU",Leaf "non-EU"] pc :: Category pc = Cat "PC" [laptop,Leaf "DeskPC"] where laptop :: Partition laptop = Node "Laptop" [macLaptop,winLaptop] macLaptop :: Partition macLaptop = Node "macLaptop" [Leaf "MacBook", Leaf "Powerbook"] winLaptop :: Partition winLaptop = Node "winLaptop" [Leaf "Asus", Leaf "HP", Leaf "Toshiba"] os :: Category os = Cat "OS" [linux,windows,Leaf "MacOS"] where linux :: Partition linux = Node "Linux" [Leaf "Ubuntu", Leaf "Debian", Leaf "RedHat"] windows :: Partition windows = Node "Windows" [Leaf "WinXP", Leaf "WinVista", Leaf "Win7"] height :: Category height = Cat "Height" [Leaf "<1,60", Leaf "1,60-1,74", Leaf "1,75-1,90", Leaf ">1,90"] weight :: Category weight = Cat "Weight" [Leaf "<60", Leaf "60-74", Leaf "75-90", Leaf ">90"] occupation :: Category occupation = Cat "Occupation" [Leaf "Just Student", Leaf "Part-Time Worker", Leaf "Full-time Worker"] status :: Category status = Cat "Status" [Leaf "Single", Leaf "Married", Leaf "Divorced", Leaf "Widow"] r1 :: Rule r1 = rule_ . incl_ $ ["winLaptop"] r2 :: Rule r2 = rule_ (incl_ ["18-40"] `and_` ((incl_ ["Foreign"] `imp_` incl_ ["Mixed"]) `andm` incl_ ["Male"])) r2b = rule_ (all_ "Age" `and_` all_ "Nationality" `and_` all_ "sType" `andm` all_ "Gender") r3 :: Rule r3 = rule_ ((incl_ ["Laptop"] `or_` incl_ ["Windows"]) `andm` (incl_ [">90"] `nor_` incl_ [">1,90"])) r4 :: Rule r4 = rule_ ((incl_ ["Laptop"] `or_` incl_ ["Windows"]) `andm` (incl_ [">90"] `nor_` incl_ [">1,90"])) `suchthat` rule_ (incl_ ["Laptop"] `or_` incl_ ["MacOS"]) r5 :: Rule r5 = rule_ (incl_ ["Windows"] `imp_` incl_ ["winLaptop"]) r6 :: Rule r6 = rule_ (incl_ ["<18",">40"] `and_` incl_ ["Just Student"]) rules :: [Rule] rules = [r1,r2,r2b,r3,r4,r5,r6]