ToString function converts a Tuple object to a string format.
(tup *base.Tuple)
| 85 | |
| 86 | // ToString function converts a Tuple object to a string format. |
| 87 | func ToString(tup *base.Tuple) string { |
| 88 | // Retrieve the individual elements of the tuple |
| 89 | entity := tup.GetEntity() |
| 90 | relation := tup.GetRelation() |
| 91 | subject := tup.GetSubject() |
| 92 | |
| 93 | // Convert the elements to strings |
| 94 | strEntity := EntityToString(entity) |
| 95 | strRelation := relation |
| 96 | strSubject := SubjectToString(subject) |
| 97 | |
| 98 | // Combine the strings with proper formatting |
| 99 | result := fmt.Sprintf("%s#%s@%s", strEntity, strRelation, strSubject) |
| 100 | |
| 101 | // Return the formatted string |
| 102 | return result |
| 103 | } |
| 104 | |
| 105 | // IsEntityAndSubjectEquals checks if the entity and subject of a Tuple object are equal |
| 106 | func IsEntityAndSubjectEquals(t *base.Tuple) bool { |