KnowledgeBase.KB.AskProperty C# (CSharp) Method

AskProperty() public method

public AskProperty ( Name property, Name perspective ) : Name
property Name
perspective Name
return Name
        public Name AskProperty(Name property, Name perspective)
        {
            if (!property.IsGrounded)
                throw new ArgumentException("The given Well Formed Name must be grounded",nameof(property));

            var results = AskPossibleProperties(property, perspective, null).Select(p => p.Item1).ToArray();
            if (results.Length==0)
                return null;
            if (results.Length == 1)
                return results[0];

            throw new Exception("More the 1 property found");
        }

Same methods

KB::AskProperty ( Name property ) : Name

Usage Example

Example #1
0
 public void Test_AskProperty_Self()
 {
     var kb = new KB((Name)"John");
     var value = Name.BuildName(kb.AskProperty(Name.SELF_SYMBOL).ToString());
     Assert.AreEqual(value, kb.Perspective);
 }
All Usage Examples Of KnowledgeBase.KB::AskProperty