Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Share object persists the state of the application when using the Share function.This function is available by clicking the Menu button (Image Removed) in the top left of the map window, and selecting Share. The state of the application (including all dashboard settings, filters, map position, visualizations and much more) is persisted and a link is generated. After clicking this link, anyone with access to the project will be able to recover the saved application state and see the exact view as the creator of the share link. The link looks

How Share MD objects differ from other MD object types

  • Share MD objects can be considered internal i.e. these MD objects themselves are not exposed to the user in any way and are only used internally for computing shared versions of MD objects such as view, dashboards, etc
  • Share MD objects cannot be created, retrieved, modified or deleted using REST API for standard CRUD operations
  • Share MD objects cannot be dumped from a project using CleverMaps Shell

Life cycle of Share metadata objects

Creating shares

This function is available by clicking the Menu button (Image Added) in the top left of the map window, and selecting Share. The state of the application (including all dashboard settings, filters, map position, visualizations and much more) is persisted and a link is generated. After clicking this link, anyone with access to the project will be able to recover the saved application state and see the exact view as the creator of the share link. The link looks like this:

Code Block
languagetext
titleShare link example
https://secure.clevermaps.io/#/yufqzxkbiecj7jot/map/catchment_area_view?shareId=exb9g8wi9606ziyk

It's a link to a specific view in a specific CleverMaps project, followed by the ?shareId={shareId} parameter, which contains the ID of the share - exb9g8wi9606ziyk.

Each shared share link can consist of 5 share objects, which extend these reference multiple Share MD objects with the same shareId. Each of these Share MD objects represents persisted state of a single MD object of one of these MD object types:

Please note that there NOTES:

  • There can be more than one indicator

...

  • and more than one indicator drill. Or there can be no indicator or no dashboard. This depends on the settings of your dashboard

...

Syntax

This is a share object applied on catchment_area_view view of the Retail Solution Demo. The diff array contains these changes:

  1. it adds default values of (histogram) filter at 10th position to 50 and 90
  2. it sets the map window center to 52.42325659892287,-1.9569396972656254 and zoom to level 12
  3. it adds the default visualization setting - areas
  4. it adds the default compare type setting - dominance
  5. it sets the default compare type to dominance
  6. it sets default spatial query to settings
  7. it adds default measure type - isoline
  8. it sets the defaultSelected property to the feature with id "6" from dataset shops

All these properties and paths are described in detail in the Views article.

...

titleShare object syntax

...

  • View MD object is the main MD object from which all subordinate MD objects (which are subjects to sharing) are referenced by (directly or associatively, refer to this article for details of MD objects hierarchy). This relation is used for determining whether share link is still valid; if a Share MD object exists for the view then the share link is valid, otherwise the share link is not valid. Following are the rules for creating and using share links which are the result of this design:
    • When creating a new share link
      • Share MD object must always be created for a View even though there would be no difference between original and shared view
      • Share MD object does not have to be created for MD object types other than View if there would be no difference between original and shared MD object
    • When opening a share link
      • in case of View
        • when Share MD object exists for a View then shared version of given view is returned from REST API
        • when Share MD object does not exist for a View then an error (404) is returned from REST API
      • in case of MD object types other than View
        • when Share MD object exists for MD object then shared version of given MD object is returned from REST API
        • when Share MD object does not exist for MD object then given MD object without any modifications is returned from REST API

Deleting shares

A state of the application persisted using a share link is defined by configuration of View MD object and all subordinate MD objects referenced by it (directly or associatively) except for MD objects of types Dataset and Export, namely:

(Refer to this article for details of MD objects hierarchy.)

That being said a share link must be invalidated and all relevant Share MD objects must be deleted in case of any change (update or delete) of any MD object in the View hierarchy which is of one of MD object types listed above. This happens automatically in MD service when request for updating of deleting for such MD object is made.

Shares REST API

Share MD objects are stored in MD service but cannot be created, retrieved, updated nor deleted directly via REST API. Creating of Share MD objects is done using endpoints for updating individual MD object types while providing shareId request parameter.


Syntax

NOTE: As the first section of this article states Share MD objects are internal MD objects and thus are not exposed to the user in any way. That being said following syntax examples serves only as an illustration of how these MD objects look when being created or used by MD service.

This is a share object applied on catchment_area_view view of the Retail Solution Demo. The diff array contains these changes:

  1. it adds default values of (histogram) filter at index 1 to 100 and 500
  2. it sets the map window center to 52.42325659892287,-1.9569396972656254 and zoom to level 12
  3. it adds the default visualization setting - areas
  4. it adds the default compare type setting - dominance
  5. it sets default spatial query settings
  6. it adds default measure type - isoline
  7. it sets the defaultSelected property to the feature with id "6" from dataset shops

All these properties and paths are described in detail in the Views article.

Code Block
titleShare object syntax
{
    "id": "m1nfjgsglwlcxvlf",
    "name": "catchment_area_view_m1nfjgsglwlcxvlf",
    "type": "share",
    "content": {
          "valueshareId": 900"m1nfjgsglwlcxvlf",
        "objectId": "o31q6691gdtj3vng",
        "itemIdobjectName": "ee2069d8ebd36700690adbf9875111f1catchment_area_view",
            },"diff": [
            {
                "op": "replaceadd",
                "path": "/content/mapOptionsfilterGroup/center1/latdefaultValues",
                "value": 52.42325659892287{
            },        "values": [
   {                    "op": "replace" 100,
                "path": "/content/mapOptions/center/lng",        500
          "value": -1.9569396972656254         ],
   },             {    "nullFiltered": true
           "op": "replace",     }
           "path": "/content/mapOptions/zoom" },
            {
   "value": 12             }"op": "replace",
            {                 "op": "add",
                "path": "/content/defaultVisualization"path": "/content/mapOptions/center/lat",
                "value": "areas"52.42325659892287
            },
            {
                "op": "addreplace",
                "path": "/content/defaultCompareTypemapOptions/center/lng",
                "value": "dominance"-1.9569396972656254
            },
            {
                "op": "addreplace",
                "path": "/content/spatialQuerymapOptions/profilezoom",
                "value": "air"12
            },
            {
                "op": "add",
                "path": "/content/spatialQuery/unitdefaultVisualization",
                "value": "distanceareas"
            },
            {
                "op": "add",
                "path": "/content/spatialQuery/amountdefaultCompareType",
                "value": 500"dominance"
            },
            {
                "op": "add",
                "path": "/content/measure/typespatialQuery",
                "value": "isoline"{
            },        "profile": "air",
   {                 "opunit": "adddistance",
                    "pathamount": "/content/defaultSelected/dataset",500
                }
    "value": "/rest/projects/$projectId/md/datasets?name=shops"             },
            {
                "op": "add",
                "path": "/content/defaultSelected/ids/0measure",
                "value": "6" {
                 }   "type": "isoline"
    ],         "breakingChanges": [],  }
      "forcedRebaseCount": 0     },
}  
Code Block
titleExample of a dumped Share
collapsetrue
{     "url": "/rest/projects/yufqzxkbiecj7jot/md/shares/m1nfjgsglwlcxvlf",     {
          "dumpTime": "2020-12-08T08:06:10Z",     "versionop": "1add",
    "content": {            "idpath": "m1nfjgsglwlcxvlf/content/defaultSelected",
          "name      "value": "catchment_area_view_m1nfjgsglwlcxvlf",{
          "type": "share",         "contentdataset": {"/rest/projects/$projectId/md/datasets?name=shops",
            "shareId": "m1nfjgsglwlcxvlf",             "objectId"ids": "o31q6691gdtj3vng",[
            "objectName": "catchment_area_view",             "diff6":
[                 {   ]
                }
"op": "add",           }
         "path": "/content/filterGroup/10/defaultValues/values/0",]
    }
}

Additional syntax examples

Code Block
titleExample of a share object on indicator drill
collapsetrue
{
    "id": "exb9g8wi9606ziyk",
    "name": "turnover_indicator_drill_on_exb9g8wi9606ziyk",
    "valuetype": 50"share",
    "content":  {
         	"itemIdshareId": "d13d5b44990292a6c1b051c018410053exb9g8wi9606ziyk",
        "objectId": "iir539klh29s9mvo",
        }"objectName": "turnover_indicator_drill_on",
        "diff": [
        {    {
                "op": "add",
                    "path": "/content/filterGroupblocks/10/defaultValues/values/13/visualized",
                    "value": 900,
                	"itemId": "ee2069d8ebd36700690adbf9875111f1"false
                },
                {
                    "op": "replaceadd",
                    "path": "/content/mapOptionsblocks/center3/latdisplayValues",
                    "value": 52.42325659892287 [
                    "Offline"
                ]
    },        },
        {    {
                "op": "replaceadd",
   
                "path": "/content/mapOptionsblocks/center4/lngvisualized",
                    "value": -1.9569396972656254false
                },
   
            {
                    "op": "replaceadd",
                    ""path": "/content/blocks/mapOptions5/zoomvisualized",
                    "value": 12
 false
              },
                {
   
                "op": "add",

                   "path": "/content/defaultVisualizationblocks/6/visualized",
   
                "value": "areas"false
                },
        ]
       {
               }
}

This share object is applied on indicator drill. You can see it contains explicit disabled visalization of drill blocks. But mainly, for block 3 (categories) there is an displayValues setting which means we selected "Offline" category from the block.

Code Block
titleExample of a share object on marker selector
collapsetrue
{
    "opid": "addexb9g8wi9606ziyk",
    "name": "shops_marker_selector_exb9g8wi9606ziyk",
    "type": "share",
        "pathcontent": "/content/defaultCompareType",{
           "shareId": "exb9g8wi9606ziyk",
        "valueobjectId": "dominancenl3porml3fmg4o0a",
        "objectName": "shops_marker_selector",
      },  "diff": [
             {
                    "op": "add",
                    "path"path": "/content/spatialQuery/profilekeepFiltered",
                "value": {
  "value": "air"                  "granularity": }false,
                {    "markers": true
               "op": "add", }
            },
       "path": "/content/spatialQuery/unit",    {
                "valueop": "distanceadd",
                },
  "path": "/content/showIndicatorValuesOnMap",
              {
  "value": false
            },
       "op": "add",    {
                "pathop": "/content/spatialQuery/amountadd",
  
                 "valuepath": 500"/content/clusterMarkers",
                },
"value": false
            }
  {                     "op": "add",
                    "path": "/content/measure/type",
                    "value": "isoline"
                },
                {
                    "op": "add",
                    "path": "/content/defaultSelected/dataset",
                    "value": "/rest/projects/$projectId/md/datasets?name=shops"
                },
                {
                    "op": "add",
                    "path": "/content/defaultSelected/ids/0",
                    "value": "6"
                }
            ],
            "breakingChanges": [],
            "forcedRebaseCount": 0
        },
        "accessInfo": {
            "createdAt": "2020-12-07T15:35:51Z",
            "createdBy": "/rest/accounts/00ubfu7fdyIoFKxXm0h7"
        },
        "links": [
            {
                "rel": "self",
                "href": "/rest/projects/yufqzxkbiecj7jot/md/shares/m1nfjgsglwlcxvlf"
            }
        ]
    }
}

Additional syntax examples

Code Block
titleExample of a share object on indicator drill
collapsetrue
{
    "id": "exb9g8wi9606ziyk",
    "name": "turnover_indicator_drill_on_exb9g8wi9606ziyk",
    "type": "share",
    "content": {
        "shareId": "exb9g8wi9606ziyk",
        "objectId": "iir539klh29s9mvo",
        "objectName": "turnover_indicator_drill_on",
        "diff": [
            {
                "op": "add",
                "path": "/content/blocks/3/visualized",
                "value": false,
                "itemId": "9403698a1ed0cc2e55fcc27762faa1a3"
            },
            {
                "op": "add",
                "path": "/content/blocks/3/displayValues/0/Offline",
                "value": "Offline",
                "itemId": "9403698a1ed0cc2e55fcc27762faa1a3"
            },
            {
                "op": "add",
                "path": "/content/blocks/4/visualized",
                "value": false,
                "itemId": "ccf504abece40ed0bbe992f4931ddae3"
            },
            {
                "op": "add",
                "path": "/content/blocks/5/visualized",
                "value": false,
                "itemId": "d13d5b44990292a6c1b051c018410053"
            },
            {
                "op": "add",
                "path": "/content/blocks/6/visualized",
                "value": false,
                "itemId": "8d053723cb9372574ceeae9bd0c360ba"
            }
        ],
        "breakingChanges": [],
        "forcedRebaseCount": 0
    }
}

This share object is applied on indicator drill. You can see it contains explicit disabled visalization of drill blocks. But mainly, for block 3 (categories) there is an displayValues setting which means we selected "Offline" category from the block.

Code Block
titleExample of a share object on marker selector
collapsetrue
{
    "id": "exb9g8wi9606ziyk",
    "name": "shops_marker_selector_exb9g8wi9606ziyk",
    "type": "share",
    "content": {
        "shareId": "exb9g8wi9606ziyk",
        "objectId": "nl3porml3fmg4o0a",
        "objectName": "shops_marker_selector",
        "diff": [
            {
                "op": "add",
                "path": "/content/keepFiltered/granularity",
                "value": false
            },
            {
                "op": "add",
                "path": "/content/keepFiltered/markers",
                "value": true
            },
            {
                "op": "add",
                "path": "/content/showIndicatorValuesOnMap",
                "value": false
            },
            {
                "op": "add",
                "path": "/content/clusterMarkers",
                "value": false
            }
        ],
        "breakingChanges": [],
        "forcedRebaseCount": 0
    }
}

This share object is applied on marker selector. You can see it contains three marker selector settings -  keepFilteredshowIndicatorValuesOnMap and clusterMarkers set to false.

Key description

content

...

Status
colourRed
titlerequired

...

id of the share (present in share link)

...

Status
colourGreen
titleoptional

...

id of metadata object on which the share is applied

...

Status
colourRed
titlerequired

...

diff

...

Status
colourRed
titlerequired

...

Status
colourGreen
titleoptional

...

Status
colourGreen
titleoptional

...

content.diff

content.breakingChanges

Each diff and breakingChanges array element follows the JSON Patch standard.

]
    }
}

This share object is applied on marker selector. You can see it contains three marker selector settings -  keepFilteredshowIndicatorValuesOnMap and clusterMarkers set to false.

Key description

content

KeyTypeOptionalityDescriptionConstraints
opstring

Status
colourRed
titlerequired

type of the operation

["add", "remove", "replace", "copy", "move"]path
shareIdstring

Status
colourRed
titlerequired

path in the json

id of the share (present in share link)

(a-z0-9)
objectIdstring
Status
colourGreen
titleoptional

id of metadata object on which the

operation

share is applied

(
*
a-z0-9)
value
objectName

string 

integer

number

boolean

string
Status
colour
Green
Red
title
optional

value applied to the path

value is polymorphic - it can be of any type available in the JSON standard

itemIdstring
required
name of metadata object on which the share is applied(a-z0-9_-)

diff

array
Status
colour
Green
Red
title
optional

Generated ID for an item from the most outer array in the path - itemId is used while rebasing share diffs to match existent diffs with corresponding items within master metadata object content which might have been reordered within arrays after metadata object update.

e.g. for path /content/filterGroup/10/defaultValues/values/0 the itemId is generated for the item at path /content/filterGroup/10

There are cases when item for which diff is applied does not exists in master metadata object (only in shared metadata object) - in such cases itemId attribute is not present in share diff as it is not supposed to match anything in the master metadata object.

IMPORTANT: itemId is not supposed to be modified manually via REST API.

NOTE: Mechanism described above does not cover all the cases, for example reordering items within a nested array currently produces breaking changes - the implementation is likely to improve in the future to store item IDs in share diff for items within all arrays in the path (the most outer and nested arrays instead of just the most outer one).

[a-z0-9]{32}
required
list of changes applied on the metadata object

content.diff

Each diff array element follows the JSON Patch standard.

KeyTypeOptionalityDescriptionConstraints
opstring

Status
colourRed
titlerequired

type of the operation

["add", "remove", "replace", "copy", "move"]
pathstring
Status
colourRed
titlerequired
path in the json on which the operation is applied(*)
value

string 

integer

number

boolean

Status
colourGreen
titleoptional

value applied to the path

value is polymorphic - it can be of any type available in the JSON standard


Visual representation

Shares themselves do not have a visual representation in the application. However, the Share function is available in Menu:

...