uprtcl / js-uprtcl

Libraries, tools and modules to create _Prtcl web apps
http://www.uprtcl.io/
Other
43 stars 13 forks source link

Perspective Ecosystem #195

Closed pepoospina closed 4 years ago

pepoospina commented 4 years ago

Perspective Ecosystem

The perspective ecosystem is the set of all the descendants of a perspective plus the perspective itself. The descendants include the children of the perspective, as long as the children of the children.

The figure below shows a tree of perspectives and highlight the ecosystem of some of them.

img

In order to keep the links from the perspective ot its ecosystem, an edge (and its reverse) must be kept from the perspective from each element in the ecosystem. These edges are derived from the children of the perspective and can change every time the perspective updates.

As you can see, one perspective can be in the ecosystem of many other perspectives contemporary.

Derive the perspective children

To derive the children of a perspective, it's data object must be processed. However, we want to store different data structures and, thus, it is not possible to get the children of an object directly from it.

For example, the children of a TextNode are under the "links" property, however, the children of a Wiki object are derived from its pages property.

In general, the children of an object will be identifiers to other objects and can be found anywhere inside that object, they don't need to be grouped on a single array.

We use Cortex Patterns to derive the children of an object without knowing in advance what that object is. This means that we will, for the first time, use frontend libraries in the backend.

In order to use Cortex patterns, we need to

So, what we need to do is to add logic to the updatePerspective() method of the uprtcl.service, so that it keeps an array of ecosystem edges from the perspective to all its descendants and itself, and to add logic that will keep updated these edges every time the perspective content is updated.

This means:

Subtasks are then:

pepoospina commented 4 years ago

To start, just patch the Pattern recognizer with a hardcoded if on the data object structure

    if (data.links !== undefined) {
      children = data.links;
    } else if (data.pages !== undefined) {
      children = data.pages;
    }
sotous commented 4 years ago

Hi there!, already finished the perspective ecosystem feature, if you guys want to catch up with it. https://github.com/uprtcl/js-uprtcl-server/pull/25