Exemplo n.º 1
0
        private static SocialImportanceAsset BuildAsset()
        {
            var ea = new EmotionalAppraisalAsset("Matt");

            #region Set KB

            ea.Kb.Tell((Name)"IsPerson(Matt)", true, Name.UNIVERSAL_SYMBOL);
            ea.Kb.Tell((Name)"IsPerson(Mary)", true, Name.UNIVERSAL_SYMBOL);
            ea.Kb.Tell((Name)"IsPerson(Diego)", true, Name.UNIVERSAL_SYMBOL);
            ea.Kb.Tell((Name)"IsPerson(Thomas)", true, Name.UNIVERSAL_SYMBOL);
            ea.Kb.Tell((Name)"IsPerson(Robot)", true, (Name)"Diego");
            ea.Kb.Tell((Name)"IsOutsider(Diego)", true, Name.UNIVERSAL_SYMBOL);
            ea.Kb.Tell((Name)"IsOutsider(Diego)", false, (Name)"Robot");
            ea.Kb.Tell((Name)"AreFriends(Self,Mary)", true, Name.SELF_SYMBOL);
            ea.Kb.Tell((Name)"AreFriends(Self,Matt)", true, (Name)"Mary");
            ea.Kb.Tell((Name)"AreFriends(Self,Thomas)", true, Name.SELF_SYMBOL);

            #endregion
            #region SI DTO especification
            var siDTO = new SocialImportanceDTO
            {
                AttributionRules = new[]
                {
                    new AttributionRuleDTO()
                    {
                        Target     = "[target]",
                        Value      = 20,
                        Conditions = new ConditionSetDTO()
                        {
                            Set = new []
                            {
                                new ConditionDTO()
                                {
                                    Condition = "IsPerson([target]) = true"
                                },
                                new ConditionDTO()
                                {
                                    Condition = "[target] != Self"
                                }
                            }
                        }
                    },
                    new AttributionRuleDTO()
                    {
                        Target     = "[target]",
                        Value      = -1,
                        Conditions = new ConditionSetDTO()
                        {
                            Set = new []
                            {
                                new ConditionDTO()
                                {
                                    Condition = "IsOutsider([target]) = true"
                                },
                                new ConditionDTO()
                                {
                                    Condition = "[target] != Self"
                                }
                            }
                        }
                    },
                    new AttributionRuleDTO()
                    {
                        Target     = "[target]",
                        Value      = 15,
                        Conditions = new ConditionSetDTO()
                        {
                            Set = new []
                            {
                                new ConditionDTO()
                                {
                                    Condition = "AreFriends(Self,[target]) = true"
                                }
                            }
                        }
                    },
                    new AttributionRuleDTO()
                    {
                        Target     = "[target]",
                        Value      = 10,
                        Conditions = new ConditionSetDTO()
                        {
                            Set = new []
                            {
                                new ConditionDTO()
                                {
                                    Condition = "IsClient([target]) = true"
                                },
                                new ConditionDTO()
                                {
                                    Condition = "IsBartender(Self) = true"
                                },
                                new ConditionDTO()
                                {
                                    Condition = "[target] != Self"
                                }
                            }
                        }
                    },
                    new AttributionRuleDTO()
                    {
                        Target     = "[target]",
                        Value      = 1,
                        Conditions = new ConditionSetDTO()
                        {
                            Set = new []
                            {
                                new ConditionDTO()
                                {
                                    Condition = "IsElder([target]) = true"
                                },
                                new ConditionDTO()
                                {
                                    Condition = "IsElder(Self) = false"
                                }
                            }
                        }
                    },
                    new AttributionRuleDTO()
                    {
                        Target     = "[target]",
                        Value      = -1,
                        Conditions = new ConditionSetDTO()
                        {
                            Set = new []
                            {
                                new ConditionDTO()
                                {
                                    Condition = "IsElder([target]) = false"
                                },
                                new ConditionDTO()
                                {
                                    Condition = "IsElder(Self) = true"
                                }
                            }
                        }
                    }
                }
            };
            #endregion
            var si = new SocialImportanceAsset();
            si.LoadFromDTO(siDTO);

            si.RegisterEmotionalAppraisalAsset(ea);
            return(si);
        }
Exemplo n.º 2
0
        private static SocialImportanceAsset BuildAsset()
        {
            var ea = new EmotionalAppraisalAsset("Matt");
            #region Set KB

            ea.AddOrUpdateBelief(new BeliefDTO()
            {
                Name = "IsPerson(Matt)",
                Perspective = "*",
                Value = "true"
            });
            ea.AddOrUpdateBelief(new BeliefDTO()
            {
                Name = "IsPerson(Mary)",
                Perspective = "*",
                Value = "true"
            });
            ea.AddOrUpdateBelief(new BeliefDTO()
            {
                Name = "IsPerson(Diego)",
                Perspective = "*",
                Value = "true"
            });
            ea.AddOrUpdateBelief(new BeliefDTO()
            {
                Name = "IsPerson(Thomas)",
                Perspective = "*",
                Value = "true"
            });
            ea.AddOrUpdateBelief(new BeliefDTO()
            {
                Name = "IsPerson(Robot)",
                Perspective = "Diego",
                Value = "true"
            });
            ea.AddOrUpdateBelief(new BeliefDTO()
            {
                Name = "IsOutsider(Diego)",
                Perspective = "*",
                Value = "true"
            });
            ea.AddOrUpdateBelief(new BeliefDTO()
            {
                Name = "IsOutsider(Diego)",
                Perspective = "Robot",
                Value = "false"
            });
            ea.AddOrUpdateBelief(new BeliefDTO()
            {
                Name = "AreFriends(Self,Mary)",
                Perspective = "Self",
                Value = "true"
            });
            ea.AddOrUpdateBelief(new BeliefDTO()
            {
                Name = "AreFriends(Self,Matt)",
                Perspective = "Mary",
                Value = "true"
            });
            ea.AddOrUpdateBelief(new BeliefDTO()
            {
                Name = "AreFriends(Self,Thomas)",
                Perspective = "Self",
                Value = "true"
            });
            ea.AddOrUpdateBelief(new BeliefDTO()
            {
                Name = "IsBartender(Matt)",
                Perspective = "*",
                Value = "true"
            });

            #endregion

            #region SI DTO especification
            var siDTO = new SocialImportanceDTO
            {
                AttributionRules = new[]
                {
                    new AttributionRuleDTO()
                    {
                        Target = "[target]",
                        Value = 20,
                        Conditions = new ConditionSetDTO()
                        {
                            ConditionSet = new []
                            {
                                "IsPerson([target]) = true",
                                "[target] != Self"
                            }
                        }
                    },
                    new AttributionRuleDTO()
                    {
                        Target = "[target]",
                        Value = -1,
                        Conditions = new ConditionSetDTO()
                        {
                            ConditionSet = new []
                            {
                                "IsOutsider([target]) = true",
                                "[target] != Self"
                            }
                        }
                    },
                    new AttributionRuleDTO()
                    {
                        Target = "[target]",
                        Value = 15,
                        Conditions = new ConditionSetDTO()
                        {
                            ConditionSet = new []
                            {
                                "AreFriends(Self,[target]) = true"
                            }
                        }
                    },
                    new AttributionRuleDTO()
                    {
                        Target = "[target]",
                        Value = 10,
                        Conditions = new ConditionSetDTO()
                        {
                            ConditionSet = new []
                            {
                                "IsClient([target]) = true",
                                "IsBartender(Self) = true",
                                "[target] != Self"
                            }
                        }
                    },
                    new AttributionRuleDTO()
                    {
                        Target = "[target]",
                        Value = 1,
                        Conditions = new ConditionSetDTO()
                        {
                            ConditionSet = new []
                            {
                                "IsElder([target]) = true",
                                "IsElder(Self) = false"
                            }
                        }
                    },
                    new AttributionRuleDTO()
                    {
                        Target = "[target]",
                        Value = -1,
                        Conditions = new ConditionSetDTO()
                        {
                            ConditionSet = new []
                            {
                                "IsElder([target]) = false",
                                "IsElder(Self) = true"
                            }
                        }
                    }
                },
                Conferral = new[]
                {
                    new ConferralDTO()
                    {
                        Action = "Give(Drink)",
                        ConferralSI = 10,
                        Target = "[x]",
                        Conditions = new ConditionSetDTO()
                        {
                            ConditionSet = new []
                            {
                                "AskedDrink([x])=true"
                            }
                        }
                    },
                    new ConferralDTO()
                    {
                        Action = "Give(Best-Drink)",
                        ConferralSI = 23,
                        Target = "[x]",
                        Conditions = new ConditionSetDTO()
                        {
                            ConditionSet = new []
                            {
                                "AskedDrink([x])=true"
                            }
                        }
                    }
                }
            };
            #endregion
            var si = new SocialImportanceAsset();
            si.LoadFromDTO(siDTO);

            si.BindEmotionalAppraisalAsset(ea);
            return si;
        }
Exemplo n.º 3
0
        private static SocialImportanceAsset BuildAsset()
        {
            var kb = new KB((Name)"Matt");

            #region Set KB
            kb.Tell((Name)"IsPerson(Matt)", (Name)"true", (Name)"*");
            kb.Tell((Name)"IsPerson(Mary)", (Name)"true", (Name)"*");
            kb.Tell((Name)"IsPerson(Thomas)", (Name)"true", (Name)"*");
            kb.Tell((Name)"IsPerson(Diego)", (Name)"true", (Name)"*");
            kb.Tell((Name)"IsPerson(Robot)", (Name)"true", (Name)"Diego");
            kb.Tell((Name)"IsOutsider(Diego)", (Name)"true", (Name)"*");
            kb.Tell((Name)"IsOutsider(Diego)", (Name)"false", (Name)"Robot");
            kb.Tell((Name)"AreFriends(SELF,Mary)", (Name)"true", (Name)"SELF");
            kb.Tell((Name)"AreFriends(SELF,Matt)", (Name)"true", (Name)"Mary");
            kb.Tell((Name)"AreFriends(SELF,Thomas)", (Name)"true", (Name)"SELF");
            kb.Tell((Name)"IsBartender(Matt)", (Name)"true", (Name)"*");

            #endregion

            #region SI DTO especification
            var siDTO = new SocialImportanceDTO
            {
                AttributionRules = new[]
                {
                    new AttributionRuleDTO()
                    {
                        Target     = (Name)"[target]",
                        Value      = (Name)"[v]",
                        Conditions = new ConditionSetDTO()
                        {
                            ConditionSet = new []
                            {
                                "IsPerson([target]) = true",
                                "[target] != Self",
                                "[v] = 20"
                            }
                        }
                    },
                    new AttributionRuleDTO()
                    {
                        Target     = (Name)"[target]",
                        Value      = (Name)"-1",
                        Conditions = new ConditionSetDTO()
                        {
                            ConditionSet = new []
                            {
                                "IsOutsider([target]) = true",
                                "[target] != Self"
                            }
                        }
                    },
                    new AttributionRuleDTO()
                    {
                        Target     = (Name)"[target]",
                        Value      = (Name)"15",
                        Conditions = new ConditionSetDTO()
                        {
                            ConditionSet = new []
                            {
                                "AreFriends(Self,[target]) = true"
                            }
                        }
                    },
                    new AttributionRuleDTO()
                    {
                        Target     = (Name)"[target]",
                        Value      = (Name)"10",
                        Conditions = new ConditionSetDTO()
                        {
                            ConditionSet = new []
                            {
                                "IsClient([target]) = true",
                                "IsBartender(Self) = true",
                                "[target] != Self"
                            }
                        }
                    },
                    new AttributionRuleDTO()
                    {
                        Target     = (Name)"[target]",
                        Value      = (Name)"1",
                        Conditions = new ConditionSetDTO()
                        {
                            ConditionSet = new []
                            {
                                "IsElder([target]) = true",
                                "IsElder(Self) = false"
                            }
                        }
                    }
                }
            };
            #endregion
            var si = new SocialImportanceAsset();
            si.LoadFromDTO(siDTO);
            si.RegisterKnowledgeBase(kb);
            return(si);
        }