Exemplo n.º 1
0
        private static void checkMultiValues(
            ICollection <SignValueStatement> statements,
            ITextContainer result,
            ISemanticNetwork semanticNetwork)
        {
            var clasifications = semanticNetwork.Statements.OfType <IsStatement>().ToList();

            foreach (var concept in semanticNetwork.Concepts)
            {
                var parents = clasifications.GetParentsOneLevel(concept);
                foreach (var sign in HasSignStatement.GetSigns(semanticNetwork.Statements, concept, true))
                {
                    if (statements.FirstOrDefault(sv => sv.Concept == concept && sv.Sign == sign.Sign) == null &&
                        parents.Select(p => SignValueStatement.GetSignValue(semanticNetwork.Statements, p, sign.Sign)).Count(r => r != null) > 1)
                    {
                        result.Append(
                            language => language.GetExtension <ILanguageSetModule>().Statements.Consistency.ErrorMultipleSignValue,
                            new Dictionary <String, IKnowledge>
                        {
                            { Semantics.Localization.Strings.ParamConcept, concept },
                            { Strings.ParamSign, sign.Sign },
                        });
                    }
                }
            }
        }
Exemplo n.º 2
0
 private static void writeSignDifference(ITextContainer result, SignValueStatement diff)
 {
     result.Append(language => language.GetExtension <ILanguageSetModule>().Questions.Answers.IsDescriptionWithSignValue, new Dictionary <String, IKnowledge>
     {
         { Strings.ParamSign, diff.Sign },
         { Strings.ParamValue, diff.Value },
     });
 }
Exemplo n.º 3
0
 private void writeJustClassification(ITextContainer result, IsStatement statement)
 {
     result.Append(language => language.GetExtension <ILanguageSetModule>().Questions.Answers.IsDescription, new Dictionary <String, IKnowledge>
     {
         { Semantics.Localization.Strings.ParamChild, Concept },
         { Semantics.Localization.Strings.ParamParent, statement.Ancestor },
     });
 }
Exemplo n.º 4
0
        private void writeClassificationWithDifference(ITextContainer result, IsStatement statement, List <SignValueStatement> difference)
        {
            result.Append(language => language.GetExtension <ILanguageSetModule>().Questions.Answers.IsDescriptionWithSign, new Dictionary <String, IKnowledge>
            {
                { Semantics.Localization.Strings.ParamChild, Concept },
                { Semantics.Localization.Strings.ParamParent, statement.Ancestor },
            });

            foreach (var diff in difference)
            {
                writeSignDifference(result, diff);
            }
        }
Exemplo n.º 5
0
 private static void checkStatementDuplicates(ISemanticNetwork semanticNetwork, ITextContainer result)
 {
     foreach (var statement in semanticNetwork.Statements)
     {
         if (!statement.CheckUnique(semanticNetwork.Statements))
         {
             result.Append(
                 language => language.Statements.Consistency.ErrorDuplicate,
                 new Dictionary <String, IKnowledge> {
                 { Strings.ParamStatement, statement }
             });
         }
     }
 }
Exemplo n.º 6
0
 private static void checkCyclicParents(
     ICollection <IsStatement> statements,
     ITextContainer result,
     ISemanticNetwork semanticNetwork)
 {
     foreach (var clasification in statements)
     {
         if (!clasification.CheckCyclic(statements))
         {
             result.Append(
                 language => language.GetExtension <ILanguageClassificationModule>().Statements.Consistency.ErrorCyclic,
                 new Dictionary <String, IKnowledge> {
                 { Strings.ParamStatement, clasification }
             });
         }
     }
 }
Exemplo n.º 7
0
 private static void checkValuesWithoutSign(
     ICollection <SignValueStatement> statements,
     ITextContainer result,
     ISemanticNetwork semanticNetwork)
 {
     foreach (var signValue in statements)
     {
         if (!signValue.CheckHasSign(semanticNetwork.Statements))
         {
             result.Append(
                 language => language.GetExtension <ILanguageSetModule>().Statements.Consistency.ErrorSignWithoutValue,
                 new Dictionary <String, IKnowledge> {
                 { Semantics.Localization.Strings.ParamStatement, signValue }
             });
         }
     }
 }
Exemplo n.º 8
0
 private static void checkSelfRelations(
     ICollection <CustomStatement> statements,
     ITextContainer result,
     ISemanticNetwork semanticNetwork)
 {
     foreach (var statement in statements)
     {
         if (statement.Concept1 == statement.Concept2)
         {
             result.Append(
                 language => language.GetExtension <ILanguageCustomModule>().Statements.Consistency.SelfReference,
                 new Dictionary <String, IKnowledge> {
                 { CustomStatement.ParamConcept1, statement.Concept1 }
             });
         }
     }
 }
Exemplo n.º 9
0
 private static void checkProcessSequenceSystems(
     ICollection <ProcessesStatement> statements,
     ITextContainer result,
     ISemanticNetwork semanticNetwork)
 {
     foreach (var contradiction in statements.CheckForContradictions())
     {
         result
         .Append(
             language => language.GetExtension <ILanguageProcessesModule>().Statements.Consistency.ErrorProcessesContradiction,
             new Dictionary <String, IKnowledge>
         {
             { Localization.Strings.ParamProcessA, contradiction.Value1 },
             { Localization.Strings.ParamProcessB, contradiction.Value2 },
         })
         .Append(contradiction.Signs.EnumerateOneLine());
     }
 }
Exemplo n.º 10
0
        protected override void WriteOneLine(ITextContainer text, IConcept sign, IConcept value1, IConcept value2)
        {
            var formatString = value1 != null && value2 != null
                                ? new Func <ILanguage, String>(language => language.GetExtension <ILanguageSetModule>().Questions.Answers.CompareConceptsCommon)
                                : language => language.GetExtension <ILanguageSetModule>().Questions.Answers.CompareConceptsCommonNotSet;

            var parameters = new Dictionary <String, IKnowledge>
            {
                { Strings.ParamSign, sign },
            };

            if (value1 != null)
            {
                parameters[Strings.ParamValue] = value1;
            }

            text.Append(formatString, parameters);
        }
Exemplo n.º 11
0
 private static void checkComparisonValueSystems(
     ICollection <ComparisonStatement> statements,
     ITextContainer result,
     ISemanticNetwork semanticNetwork)
 {
     foreach (var contradiction in statements.CheckForContradictions())
     {
         result
         .Append(
             language => language.GetExtension <ILanguageMathematicsModule>().Statements.Consistency.ErrorComparisonContradiction,
             new Dictionary <String, IKnowledge>
         {
             { Strings.ParamLeftValue, contradiction.Value1 },
             { Strings.ParamRightValue, contradiction.Value2 },
         })
         .Append(contradiction.Signs.EnumerateOneLine());
     }
 }
Exemplo n.º 12
0
        private static void checkSignDuplications(
            ICollection <HasSignStatement> statements,
            ITextContainer result,
            ISemanticNetwork semanticNetwork)
        {
            var clasifications = semanticNetwork.Statements.OfType <IsStatement>().ToList();

            foreach (var hasSign in statements)
            {
                if (!hasSign.CheckSignDuplication(statements, clasifications))
                {
                    result.Append(
                        language => language.GetExtension <ILanguageSetModule>().Statements.Consistency.ErrorMultipleSign,
                        new Dictionary <String, IKnowledge> {
                        { Semantics.Localization.Strings.ParamStatement, hasSign }
                    });
                }
            }
        }
Exemplo n.º 13
0
 protected override void WriteNotEmptyResultWithoutData(ITextContainer text)
 {
     text.Append(language => language.GetExtension <ILanguageSetModule>().Questions.Answers.CompareConceptsNoDifference);
 }