Service - Media Link: Difference between revisions

From Izara Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
 
(14 intermediate revisions by the same user not shown)
Line 13: Line 13:
=== Configuration tags ===
=== Configuration tags ===


..
<syntaxhighlight lang="JavaScript">
{
configKey: "MediaGraphServiceName"
configTag: "MediaGraphServiceName"
configValue: xxx // eg: "MediaGraph"
}
</syntaxhighlight>
 
<syntaxhighlight lang="JavaScript">
{
configKey: "TranslationGraphServiceName"
configTag: "TranslationGraphServiceName"
configValue: xxx // eg: "TranslationGraph"
}
</syntaxhighlight>


== LogicalResults ==
== LogicalResults ==
Line 37: Line 51:
<syntaxhighlight lang="JavaScript">
<syntaxhighlight lang="JavaScript">
{
{
nodeLabel: "mediaLink",
nodeLabel: "{MediaSharedLib.MEDIALINK_GRAPH_NODE_LABEL}",
schema: {
schema: {
identifier: true,
identifier: true,
Line 44: Line 58:
properties: {
properties: {
mediaLinkId: {
mediaLinkId: {
identifier: true, //(random uuid)
identifier: true, // create unique id from request details
},
},
mediaId: {
mediaId: {
immutable: true,
immutable: true,
},
linkFromId: {
immutable: true, //eg: productId
},
linkFromType: {
immutable: true, //eg: product, should match nodeLabel of linking node
},
},
mediaHandlerServiceNameTag: {
mediaHandlerServiceNameTag: {
Line 65: Line 73:
<syntaxhighlight lang="JavaScript">
<syntaxhighlight lang="JavaScript">
{
{
nodeLabel: "mediaLinkPropertyLabel",
nodeLabel: "{MediaSharedLib.MEDIALINK_GRAPH_NODE_LABEL}PropertyLabel",
schema: {
identifier: true,
restrictProperties: true,
restrictRelationships: true,
properties: {
propertyLabelId: {
identifier: true,
},
},
}
}
}
</syntaxhighlight>
<syntaxhighlight lang="JavaScript">
{
{
nodeLabel: "mediaLinkProperty",
nodeLabel: "{MediaSharedLib.MEDIALINK_GRAPH_NODE_LABEL}Property",
schema: {
identifier: true,
restrictProperties: true,
restrictRelationships: true,
properties: {
propertyId: {
identifier: true, //(random uuid)
},
mediaLinkId: {
immutable: true,
},
},
}
}
}
</syntaxhighlight>
</syntaxhighlight>
* see [[NPM module - Izara Core - Property Node|DataSchemaLib]]


=== Relationships ===
=== Relationships ===
Line 102: Line 85:
<syntaxhighlight lang="JavaScript">
<syntaxhighlight lang="JavaScript">
{
{
relationshipType: "hasMediaLinkProperty",
relationshipType: "has_{MediaSharedLib.MEDIALINK_GRAPH_NODE_LABEL}Property",
schema: {
}
elementCanBeRemoved: true,
{
allPropertiesImmutable: true,
relationshipType: "disabled_{MediaSharedLib.MEDIALINK_GRAPH_NODE_LABEL}Property",
restrictProperties: true,
}
properties: {
{
originTimestamp: //timestamp the request to create/change this relationship was sent
relationshipType: "is_{MediaSharedLib.MEDIALINK_GRAPH_NODE_LABEL}PropertyLabel",
},
}
}
{
relationshipType: "{MediaSharedLib.IS_MEDIA_GRAPH_REL_TYPE}",
}
{
relationshipType: "{MediaSharedLib.HAS_MEDIALINK_GRAPH_REL_TYPE}",
}
}
</syntaxhighlight>
</syntaxhighlight>
* see [[NPM module - Izara Core - Property Node|DataSchemaLib]]
== Basic node schemas ==
Schema comes from [[NPM module - Izara Core - Property Node|BasicNodeSchemaLib]]
# mediaLinkPropertyLabel
#* [[Service - Translations Graph]]
# mediaLinkProperty
#* [[Service - Translations Graph]]
= Complex Filter requests =
<syntaxhighlight lang="JavaScript">
<syntaxhighlight lang="JavaScript">
{
{
relationshipType: "disabledMediaLinkProperty",
filterType: "mediaLink"
schema: {
type: "group",
elementCanBeRemoved: true,
elements:
allPropertiesImmutable: true,
[
restrictProperties: true,
{
properties: {
type: "complexFilter",
originTimestamp: //timestamp the request to create/change this relationship was sent
complexFilter: {
filterType: "mediaLinkProperty",
type: "group",
elements:  
[
{
type: "logical",
logicalTag: "propertyLabelId",
comparison: "equals",
value: "lksdflkfldfgldfkgjldfg"
},
]
}
},
},
}
]
}
}
</syntaxhighlight>
</syntaxhighlight>
* links a MediaLink node to it's Properties
- filterType: "mediaLinkProperty" sends to MediaLink service and returns resultType = "mediaLinkProperty"
- by splitting into a lower level filter_type we can cache results at that level then use translateIds system to change to mediaLinkIds, this could be useful in the future when we want propertyIds to translate to other filterTypes


<syntaxhighlight lang="JavaScript">
<syntaxhighlight lang="JavaScript">
{
{
relationshipType: "isMediaLinkPropertyLabel",
filterType: "mediaLink"
schema: {
type: "group",
elementCanBeRemoved: true,
elements:
allPropertiesImmutable: true,
[
restrictProperties: true,
{
properties: {
type: "complexFilter",
originTimestamp: //timestamp the request to create/change this relationship was sent
complexFilter: {
filterType: "mediaLinkPropertyTranslation"
type: "group",
elements:  
[
{
type: "logical",
logicalTag: "textTag_languageId_text",
resultType: "mediaLinkProperty",
textTag: "mediaLinkPropertyValue",
languageId: "en",
text: "Blue",
subjectIdentifierPropertyName: "propertyId",
caseSensitive: true
},
]
}
},
},
}
...
]
}
}
</syntaxhighlight>
</syntaxhighlight>
* links one MediaLinkProperty to one MediaLinkPropertyLabel
- mediaLinkPropertyTranslation filterType sends logical element directly to Translation service, which recognises logicalTag: "textTag_languageId_text" and caches the subjectIdentifierPropertyName value in its LogicalResults table
 
== Basic node schemas ==
 
mediaLinkPropertyLabel
* [[Service - Translations Graph]]
 
mediaLinkProperty
* [[Service - Translations Graph]]


= Working documents =
= Working documents =

Latest revision as of 09:05, 15 November 2021

Overview

Manages Media Links, links might attach to many subject node types, eg Product, Sell Offer, Product Attribute, Sell Offer Term,..

Repository

https://bitbucket.org/izara-core-media/izara-core-media-media-link/src/master/

DynamoDB tables

Standard Config Table Per Service

Configuration tags

{
	configKey: "MediaGraphServiceName"
	configTag: "MediaGraphServiceName"
	configValue: xxx // eg: "MediaGraph"
}
{
	configKey: "TranslationGraphServiceName"
	configTag: "TranslationGraphServiceName"
	configValue: xxx // eg: "TranslationGraph"
}

LogicalResults

Stores results for any requests to perform logical searches on media links

{
	resultId: xxx // eg: filterMainId for a single logical element
	dataId: xxx // one mediaLinkId
}
  • partition key: resultId
  • sort key: dataId

Graph database

Service - Media Graph

Nodes

{
	nodeLabel: "{MediaSharedLib.MEDIALINK_GRAPH_NODE_LABEL}",
	schema: {
		identifier: true,
		restrictProperties: true,
		restrictRelationships: true,
		properties: {
			mediaLinkId: {
				identifier: true, // create unique id from request details
			},
			mediaId: {
				immutable: true,
			},
			mediaHandlerServiceNameTag: {
				immutable: true,
			},
		},
	}
}
{
	nodeLabel: "{MediaSharedLib.MEDIALINK_GRAPH_NODE_LABEL}PropertyLabel",
}
{
	nodeLabel: "{MediaSharedLib.MEDIALINK_GRAPH_NODE_LABEL}Property",
}

Relationships

{
	relationshipType: "has_{MediaSharedLib.MEDIALINK_GRAPH_NODE_LABEL}Property",
}
{
	relationshipType: "disabled_{MediaSharedLib.MEDIALINK_GRAPH_NODE_LABEL}Property",
}
{
	relationshipType: "is_{MediaSharedLib.MEDIALINK_GRAPH_NODE_LABEL}PropertyLabel",
}
{
	relationshipType: "{MediaSharedLib.IS_MEDIA_GRAPH_REL_TYPE}",
}
{
	relationshipType: "{MediaSharedLib.HAS_MEDIALINK_GRAPH_REL_TYPE}",
}

Basic node schemas

Schema comes from BasicNodeSchemaLib

  1. mediaLinkPropertyLabel
  2. mediaLinkProperty

Complex Filter requests

{
	filterType: "mediaLink"
	type: "group",
	elements:
	[
		{
			type: "complexFilter",
			complexFilter: {
				filterType: "mediaLinkProperty",
				type: "group",
				elements: 
				[
					{
						type: "logical",
						logicalTag: "propertyLabelId",
						comparison: "equals",
						value: "lksdflkfldfgldfkgjldfg"
					},
				]
			}
		},
	]
}

- filterType: "mediaLinkProperty" sends to MediaLink service and returns resultType = "mediaLinkProperty" - by splitting into a lower level filter_type we can cache results at that level then use translateIds system to change to mediaLinkIds, this could be useful in the future when we want propertyIds to translate to other filterTypes

{
	filterType: "mediaLink"
	type: "group",
	elements:
	[
		{
			type: "complexFilter",
			complexFilter: {
				filterType: "mediaLinkPropertyTranslation"
				type: "group",
				elements: 
				[
					{
						type: "logical",
						logicalTag: "textTag_languageId_text",
						resultType: "mediaLinkProperty",
						textTag: "mediaLinkPropertyValue",
						languageId: "en",
						text: "Blue",
						subjectIdentifierPropertyName: "propertyId",
						caseSensitive: true
					},
				]
			}
		},
		...
	]
}

- mediaLinkPropertyTranslation filterType sends logical element directly to Translation service, which recognises logicalTag: "textTag_languageId_text" and caches the subjectIdentifierPropertyName value in its LogicalResults table

Working documents

Media Link