// Someone's name concept Name { S name; } // A person (human or computer) concept Person {} // link a person to a name concept Person2Name { new Ref person; new Ref name; bool usable = true; } // our user Person > User {} // myself Person > Me {} // A line typed by user or bot concept Line { S text; new Ref author; new Ref idea; // the interpretation we settled on *() {} *(Person a, S *text) { author.set(a); } *(S *text, LineIdea idea) { this.idea.set(idea); } *(S *text, Class idea) { this.idea.set(uniq(idea)); } } // A line interpretation concept LineIdea {} // Bot error LineIdea > LError { S stackTrace; *() {} *(Throwable e) { stackTrace = getStackTrace(e); change(); } } // "test" LineIdea > LTest {} // repeating another line LineIdea > LRepeating {} // A greeting ("hello X") LineIdea > LGreet { new Ref name; *() {} *(Person2Name n) { name.set(n); } } // base class for questions LineIdea > LQuestion {} // "What is your name?" LQuestion > LWhatsYourName {} // "I don't understand" LineIdea > LIDontUnderstand {} // I have nothing to say LineIdea > LLalala {} // "My name is X" LineIdea > LMyNameIs { new Ref name; } // A specific question/answer pair concept QA_WhatsYourName_MyNameIs { new Ref q; new Ref a; } LineIdea > LAskMeSomething {} // Wrap a bug during processing of user input LineIdea > LBug { S stackTrace; *() {} *(Throwable e) { stackTrace = getStackTrace(e); change(); } } // We couldn't interpret a line yet LineIdea > LUnknown {} LineIdea > LIDontKnowWhatToAskYou {} LineIdea > LGreetMe {} LineIdea > LISee {} concept Dialog { new RefL lines; } static Dialog dialog() { ret unique(Dialog); } static User user() { ret uniq(User); } static Me me() { ret uniq(Me); } static L usableNames(Person p) { ret list(Person2Name, "usable", true, "person", p); }