public void Init(string name) { _name = name; _nameText.text = name; _isStatementTerm = NarseseParser.ContainsStatementCopula(name); _isCompoundTerm = NarseseParser.ContainsTermConnector(name); }
void VisualizeStatement(string statement) { Statement parsedStatement = new Statement(statement); if (parsedStatement.type == Statement.StatementType.Unsupported) { return; } //failed to create statement; unsupported statement SubjectPredicate subjectPredicate = parsedStatement.subjectPredicate; TruthValue truthValue = parsedStatement.truthValue; //visualize subject, predicate as terms QueueVisualizeNewConcept(subjectPredicate._subject); QueueVisualizeNewConcept(subjectPredicate._predicate); string statementKey = ""; //visualize inheritance relation if (parsedStatement.type == Statement.StatementType.Inheritance) { statementKey = GetInheritanceString(subjectPredicate); QueueVisualizeNewConcept(statementKey); if (inheritTable.ContainsKey(statementKey) && inheritTable[statementKey].GetTruthValue().GetHashCode() == truthValue.GetHashCode()) { return; } QueueVisualizeNewInherit(parsedStatement); } else if (parsedStatement.type == Statement.StatementType.Similarity) { statementKey = GetSimilarityString(subjectPredicate); QueueVisualizeNewConcept(statementKey); Statement parsedReverseStatement = NarseseParser.GetReverseStatement(statement); string forwardStatementKey = GetInheritanceString(subjectPredicate); string reverseStatementKey = GetInheritanceString(parsedReverseStatement.subjectPredicate); if (inheritTable.ContainsKey(forwardStatementKey) && inheritTable[forwardStatementKey].GetTruthValue().GetHashCode() == truthValue.GetHashCode()) { return; } QueueVisualizeNewInherit(parsedStatement); if (inheritTable.ContainsKey(reverseStatementKey) && inheritTable[reverseStatementKey].GetTruthValue().GetHashCode() == parsedReverseStatement.truthValue.GetHashCode()) { return; } QueueVisualizeNewInherit(parsedReverseStatement); } else { return; } }