Service - Comment: Difference between revisions

From Izara Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 1: Line 1:
= Overview =
= Overview =


A single comment made by a user. A comment can be part of a conversation thread (or perhaps many), or perhaps standalone or connected to any object in the project.
Individual comments within a conversation/forum/communication, comments interconnect together to create conversations and can connect to other project object types.


= Repository =
= Repository =


* not yet made:
https://bitbucket.org/izara-conversations/izara-conversations-comment
https://bitbucket.org/izara-conversations/izara-conversations-comment


= DynamoDB tables =
= Use cases =


== LogicalResults ==
* community forum
* conversations between members
* comments and feedback for products or orders


[[Standard LogicalResults Per Service]]
= Conversation structure =


= Graph database =
A conversation begins when a comment is made that is not in reply to another comment.


== Nodes ==
An initial comment can be attached to another object, eg a user for user-to-user communication, to a product as a product question, to an order as a message to order participants, or to a forum topic.
 
Comments can then be in reply to another comment, and can only reply to a single comment.
 
= Object Schemas =
; Additional Information: [[Per Service Schemas]]
 
== objType ==
 
=== comment ===


<syntaxhighlight lang="JavaScript">
<syntaxhighlight lang="JavaScript">
{
{
nodeLabel: "{CommentLib.COMMENT_GRAPH_NODE_LABEL}", // "comment"
objectType: "comment",
schema: {
canDelete: false,
identifier: true,
storageResources: {
restrictProperties: true,
myGraph: {
restrictRelationships: true,
storageType: "graph",
properties: {
graphServerTag: "GraphHandler"
commentId: {
}
identifier: true, // create unique id from request params and uniqueMessageId
    },
},
    fieldNames: {
},
commentId: {
}
type: "string",
randomOnCreate: true,
canUpdate: false,
storageResourceTags: ['myGraph']
}
commentBody: {
type: "string",
canUpdate: false,
storageResourceTags: ['myGraph']
}
    },
    identifiers: [
{
type: "identifier",
fieldName: "commentId"
}
    ]
}
}
</syntaxhighlight>
</syntaxhighlight>
== Object Relationships ==
=== inReplyTo ===


<syntaxhighlight lang="JavaScript">
<syntaxhighlight lang="JavaScript">
{
{
nodeLabel: "{CommentLib.COMMENT_LINK_GRAPH_NODE_LABEL}", // "commentLink"
"inReplyTo": {
schema: {
fieldNames: {
identifier: true,
},
restrictProperties: true,
storageResources: {
restrictRelationships: true,
myGraph: {
properties: {
storageType: "graph",
commentLinkId: {
graphServerTag: "GraphHandler"
identifier: true, // create unique id from request params and uniqueMessageId
}
},
},
},
links: [
{
storageResourceTags: ["myGraph"],
from: {
objType: {
serviceTag: "comment",
objectType: "comment"
},
linkType: "many",
handler: true
},
to: {
objType: {
serviceTag: "comment",
objectType: "comment"
},
linkType: "one"
}
}
]
}
}
}
}
</syntaxhighlight>
</syntaxhighlight>
* Is a node in between a comment and another object, eg replying to a comment
* Set as it's own node so can create relationships to the links (eg when a user traverses the link, so we can create weights for links)


== Relationships ==
* Connects as a reply to another comment. One comment can only reply to one other comment, but one comment can have many replies.
 
=== quotesComment ===


<syntaxhighlight lang="JavaScript">
<syntaxhighlight lang="JavaScript">
{
{
relationshipType: "{CommentLib.IN_REPLY_TO_GRAPH_REL_TYPE}", // "inReplyTo_Comment"
"quotesComment": {
schema: {
fieldNames: {
immutable: true,
"startChar": {
restrictProperties: true,
  type: "integer",
properties: {
  requiredOnCreate: true,
originTimestamp: //timestamp the request to create/change this relationship was sent
  canUpdate: false,
},
"endChar": {
  type: "integer",
  requiredOnCreate: true,
  canUpdate: false,
},
},
},
storageResources: {
myGraph: {
storageType: "graph",
graphServerTag: "GraphHandler"
}
},
links: [
{
storageResourceTags: ["myGraph"],
from: {
objType: {
serviceTag: "comment",
objectType: "comment"
},
linkType: "many",
handler: true
},
to: {
objType: {
serviceTag: "comment",
objectType: "comment"
},
linkType: "many"
}
}
]
}
}
}
}
</syntaxhighlight>
</syntaxhighlight>
* Quotes another comment, will need a property that specifies which characters are quoted, and perhaps where in the new comment the quotes should be shown.
* One comment can quote many other comments or quote another comment multiple times.
=== hasPrimarySubject ===


<syntaxhighlight lang="JavaScript">
<syntaxhighlight lang="JavaScript">
{
{
relationshipType: "{CommentLib.COMMENT_HAS_REFERENCE_GRAPH_REL_TYPE}", // "commentHas_Reference"
"hasPrimarySubject": {
schema: {
fieldNames: {
immutable: true,
restrictProperties: true,
properties: {
originTimestamp: //timestamp the request to create/change this relationship was sent
},
},
}
storageResources: {
}
myGraph: {
</syntaxhighlight>
storageType: "graph",
<syntaxhighlight lang="JavaScript">
graphServerTag: "GraphHandler"
{
}
relationshipType: "{CommentLib.COMMENT_HAS_REPLY_GRAPH_REL_TYPE}", // "commentHas_Reply"
schema: {
immutable: true,
restrictProperties: true,
properties: {
originTimestamp: //timestamp the request to create/change this relationship was sent
},
},
links: [
{
storageResourceTags: ["myGraph"],
from: {
objType: {
serviceTag: "comment",
objectType: "comment"
},
linkType: "many",
handler: true
},
to: {
objType: {
// every objType
},
linkType: "many"
}
}
]
}
}
}
}
</syntaxhighlight>
</syntaxhighlight>
=== hasPrimarySubject ===
<syntaxhighlight lang="JavaScript">
<syntaxhighlight lang="JavaScript">
{
{
relationshipType: "{CommentLib.COMMENT_HAS_NEXT_COMMENT_GRAPH_REL_TYPE}", // "commentHas_NextComment"
"hasPrimarySubject": {
schema: {
fieldNames: {
immutable: true,
restrictProperties: true,
properties: {
originTimestamp: //timestamp the request to create/change this relationship was sent
},
},
}
storageResources: {
}
myGraph: {
</syntaxhighlight>
storageType: "graph",
<syntaxhighlight lang="JavaScript">
graphServerTag: "GraphHandler"
{
}
relationshipType: "{CommentLib.COMMENT_HAS_REPLY_GRAPH_REL_TYPE}", // "commentHas_Quote"
schema: {
immutable: true,
restrictProperties: true,
properties: {
originTimestamp: //timestamp the request to create/change this relationship was sent
startChar: ##, // when the quote starts in the comment
endChar: ##, // when the quote ends in the comment
},
},
links: [
{
storageResourceTags: ["myGraph"],
from: {
objType: {
serviceTag: "comment",
objectType: "comment"
},
linkType: "many",
handler: true
},
to: {
objType: {
// every objType
},
linkType: "many"
}
}
]
}
}
}
}
</syntaxhighlight>
</syntaxhighlight>
* Connect to commentLinks, which in turn connect to other objects
 
* Cannect to any other object, is a strong link that identifies the primary topic of the comment. For comments that have no inReplyTo relationship this forms the initial connection with an object, such as user messaging or topic in community forum.
 
=== hasReference ===


<syntaxhighlight lang="JavaScript">
<syntaxhighlight lang="JavaScript">
{
{
relationshipType: "{CommentLib.COMMENTLINKTO_OBJECT_GRAPH_REL_TYPE}", // "commentLinkTo_Object"
"hasReference": {
schema: {
fieldNames: {
immutable: true,
restrictProperties: true,
properties: {
originTimestamp: //timestamp the request to create/change this relationship was sent
},
},
storageResources: {
myGraph: {
storageType: "graph",
graphServerTag: "GraphHandler"
}
},
links: [
{
storageResourceTags: ["myGraph"],
from: {
objType: {
serviceTag: "comment",
objectType: "comment"
},
linkType: "many",
handler: true
},
to: {
objType: {
// every objType
},
linkType: "many"
}
}
]
}
}
}
}
</syntaxhighlight>
</syntaxhighlight>
* Connects a commentLink to an object
 
* Cannect to any other object, is a soft refence link.
 
=== amendsComment ===


<syntaxhighlight lang="JavaScript">
<syntaxhighlight lang="JavaScript">
{
{
relationshipType: "{CommentLib.COMMENTVIEWED_BY_USER_GRAPH_REL_TYPE}", // "commentViewedBy_User"
"amendsComment": {
schema: {
fieldNames: {
immutable: true,
},
restrictProperties: true,
storageResources: {
properties: {
myGraph: {
originTimestamp: //timestamp the request to create/change this relationship was sent
storageType: "graph",
viewSource: "xx" // "directView"|"replyLink"|"chronologicalLink" how the user came to view this comment, maybe also add identifier for eg replyLink
graphServerTag: "GraphHandler"
}
},
},
links: [
{
storageResourceTags: ["myGraph"],
from: {
objType: {
serviceTag: "comment",
objectType: "comment"
},
linkType: "one",
handler: true
},
to: {
objType: {
serviceTag: "comment",
objectType: "comment"
},
linkType: "one"
}
}
// not sure need to add reverse direction here?
]
}
}
}
}
</syntaxhighlight>
</syntaxhighlight>
* Each time a user views a comment add a link
 
* Could add other metrics like view time
* Method of editing or updating a comment, the original comment remains but amendments can be applied for the final ui presentation. Links to previous versions of a comment can remain, other comments that quote an out of date amended comment show the original comment quote.


= Working documents =
= Working documents =

Revision as of 02:03, 25 March 2025

Overview

Individual comments within a conversation/forum/communication, comments interconnect together to create conversations and can connect to other project object types.

Repository

https://bitbucket.org/izara-conversations/izara-conversations-comment

Use cases

  • community forum
  • conversations between members
  • comments and feedback for products or orders

Conversation structure

A conversation begins when a comment is made that is not in reply to another comment.

An initial comment can be attached to another object, eg a user for user-to-user communication, to a product as a product question, to an order as a message to order participants, or to a forum topic.

Comments can then be in reply to another comment, and can only reply to a single comment.

Object Schemas

Additional Information
Per Service Schemas

objType

comment

{
	objectType: "comment",
	canDelete: false,
	storageResources: {
		myGraph: {
			storageType: "graph",
			graphServerTag: "GraphHandler"
		}
    },
    fieldNames: {
		commentId: {
			type: "string",
			randomOnCreate: true,
			canUpdate: false,
			storageResourceTags: ['myGraph']
		}
		commentBody: {
			type: "string",
			canUpdate: false,
			storageResourceTags: ['myGraph']
		}
    },
    identifiers: [
		{
			type: "identifier",
			fieldName: "commentId"
		}
    ]
}

Object Relationships

inReplyTo

{
	"inReplyTo": {
		fieldNames: {
		},
		storageResources: {
			myGraph: {
				storageType: "graph",
				graphServerTag: "GraphHandler"			
			}
		},
		links: [
			{
				storageResourceTags: ["myGraph"],
				from: {
					objType: {
						serviceTag: "comment",					
						objectType: "comment"
					},
					linkType: "many",
					handler: true					
				},
				to: {
					objType: {
						serviceTag: "comment",				
						objectType: "comment"					
					},				
					linkType: "one"
				}
			}
		]
	}
}
  • Connects as a reply to another comment. One comment can only reply to one other comment, but one comment can have many replies.

quotesComment

{
	"quotesComment": {
		fieldNames: {
			"startChar": {
			  type: "integer",
			  requiredOnCreate: true,
			  canUpdate: false,
			},
			"endChar": {
			  type: "integer",
			  requiredOnCreate: true,
			  canUpdate: false,
			},
		},
		storageResources: {
			myGraph: {
				storageType: "graph",
				graphServerTag: "GraphHandler"			
			}
		},
		links: [
			{
				storageResourceTags: ["myGraph"],
				from: {
					objType: {
						serviceTag: "comment",					
						objectType: "comment"
					},
					linkType: "many",
					handler: true					
				},
				to: {
					objType: {
						serviceTag: "comment",				
						objectType: "comment"					
					},				
					linkType: "many"
				}
			}
		]
	}
}
  • Quotes another comment, will need a property that specifies which characters are quoted, and perhaps where in the new comment the quotes should be shown.
  • One comment can quote many other comments or quote another comment multiple times.

hasPrimarySubject

{
	"hasPrimarySubject": {
		fieldNames: {
		},
		storageResources: {
			myGraph: {
				storageType: "graph",
				graphServerTag: "GraphHandler"			
			}
		},
		links: [
			{
				storageResourceTags: ["myGraph"],
				from: {
					objType: {
						serviceTag: "comment",					
						objectType: "comment"
					},
					linkType: "many",
					handler: true					
				},
				to: {
					objType: {
						// every objType
					},				
					linkType: "many"
				}
			}
		]
	}
}

hasPrimarySubject

{
	"hasPrimarySubject": {
		fieldNames: {
		},
		storageResources: {
			myGraph: {
				storageType: "graph",
				graphServerTag: "GraphHandler"			
			}
		},
		links: [
			{
				storageResourceTags: ["myGraph"],
				from: {
					objType: {
						serviceTag: "comment",					
						objectType: "comment"
					},
					linkType: "many",
					handler: true					
				},
				to: {
					objType: {
						// every objType
					},				
					linkType: "many"
				}
			}
		]
	}
}
  • Cannect to any other object, is a strong link that identifies the primary topic of the comment. For comments that have no inReplyTo relationship this forms the initial connection with an object, such as user messaging or topic in community forum.

hasReference

{
	"hasReference": {
		fieldNames: {
		},
		storageResources: {
			myGraph: {
				storageType: "graph",
				graphServerTag: "GraphHandler"			
			}
		},
		links: [
			{
				storageResourceTags: ["myGraph"],
				from: {
					objType: {
						serviceTag: "comment",					
						objectType: "comment"
					},
					linkType: "many",
					handler: true					
				},
				to: {
					objType: {
						// every objType
					},				
					linkType: "many"
				}
			}
		]
	}
}
  • Cannect to any other object, is a soft refence link.

amendsComment

{
	"amendsComment": {
		fieldNames: {
		},
		storageResources: {
			myGraph: {
				storageType: "graph",
				graphServerTag: "GraphHandler"			
			}
		},
		links: [
			{
				storageResourceTags: ["myGraph"],
				from: {
					objType: {
						serviceTag: "comment",					
						objectType: "comment"
					},
					linkType: "one",
					handler: true					
				},
				to: {
					objType: {
						serviceTag: "comment",				
						objectType: "comment"					
					},				
					linkType: "one"
				}
			}
			// not sure need to add reverse direction here?
		]
	}
}
  • Method of editing or updating a comment, the original comment remains but amendments can be applied for the final ui presentation. Links to previous versions of a comment can remain, other comments that quote an out of date amended comment show the original comment quote.

Working documents

Comment