GhostWording / gw-config-apis

this repo contains static json that can live through apis with github management only
0 stars 7 forks source link

Defining Tags principles #20

Open andreasdieryck opened 6 years ago

andreasdieryck commented 6 years ago

1. Current working principles with a single tag

As defined in issues #10 and #11, Tags is a property that we use to:

a. Attributing a Tag

At the moment, I can allocate a Tag in a file as follows:

{
    "Type": "Node",
    "Id": "MySequence",
    "Tags": ["ResumeActivity"]
    ...
}

In the above instance, I allocate the tag "ResumeActivity" because this file is specifically designed for situations when the user relaunches an app.

b. Calling for a file with a given

Files with tags will be stored in a specific place. When I need a file with the tag "ResumeActivty", I should follow this example:

{
    "Type": "Node",
    "Id": "MySequence2",
     ...
    "LinksToTag": {
        "Tags": ["ResumeActivity"]
    }

Here, at the end of my sequence, another sequence that has the tag "ResumeActivity" will be called (randomly).

2. Issues: Tags inclusivity/exclusivity

a. Issue with tags allocation

The issue that will quickly arise is the following, I can allocate several tags to a file. Example:

{
    "Type": "Node",
    "Id": "MySequence",
    "Tags": ["Joke", "Baguette"]
    ...
}

Doing so can have two meanings:

b. Issue with calling tags

Similarly, when I call for a tag, I can call for several tags at a time. Example:

{
    "Type": "Node",
    "Id": "MySequence2",
     ...
    "LinksToTag": {
        "Tags": ["Joke", "Baguette"]
    }

Again, doing so can have two significations:

3. Solutions?

There are two ways of solving this issue:

  1. We either rule for one way of calling tags, and we rule out the other possibility
  2. We re-adjust the way we call for sequences with certain tags by introducing a system to distinguish exclusive tag associations from inclusive ones

4. A solution: distinguishing between inclusive and exclusive tags

One way to avoid the confusion is to explicitly declare whether we would like an association of tags to be exclusively used as one, or not.

a. Declaring an exclusivity

Example 1: I want my file to be used ONLY when the user comes back on the app AND we want to show him a joke

{
    "Type": "Node",
    "Id": "MySequence",
    "Tags": {"CoupledTags": ["ResumeActivity", "Joke"]}
    ...
}

This sequence should thus only be used when it is called as follows:

{
    "Type": "Node",
    "Id": "MySequence2",
     ...
    "LinksToTag": {
        "CoupledTags": ["ResumeActivity", "Joke"]
    }
b. Allocating tags without a given association

Example 2: I want my file to be used EITHER as a joke OR as a story about baguettes

{
    "Type": "Node",
    "Id": "MySequence",
    "Tags": {"SingleTags": ["Joke", "Baguette"]}
    ...
}

This sequence should thus only be used when it is called as follows:

{
    "Type": "Node",
    "Id": "MySequence2",
     ...
    "LinksToTag": {
        "CoupledTags": ["Baguette", "Joke"]
    }
c. Multiple use cases

Example 3: I want my file to be used in both cases, i.e. it can be used for a given couple of tags or a set of single tags as well

{
    "Type": "Node",
    "Id": "MySequence",
    "Tags": {"CoupledTags": ["French", "Joke"], "SingleTags": ["French", "Joke", "Baguette"]}
    ...
}

What do you think about this guys?

rhwy commented 6 years ago

my opinion: it adds too much complexity and is not really prone to future evolutions.

For now it can see two solutions that have different advantages:

  1. keep it in strings (simpler, good enough for now): we keep an array of strings for tags + strings can have multiple tags inside -> the different strings in the array are OR and the tags within the same string are AND related:

["tag1", "tag2,tag3"]

which means: tag1 OR (tag2 AND tag3)

  1. use an expression engine like the one in sequences condition (but as we have a mapping of list of tags requested to a list of tags in sequence it will be very complicated to find a simple way to implement this in a way that works everywhere).