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);
        }