Contexts are a way of grouping entities within a configuration. For example, a Weave configuration may include entities from a broad cross section of categories. - It may include reference information (roads, rivers, towns, administrative boundaries, property boundaries etc), plus various categories of information, for example :
a) Land classifications (wetlands, rainforest, grasslands, grazing, cropping, etc.)
b) Tourist information (motels, restaurants, Places of Interest, etc.)
Contexts allow such categories to be grouped and referred to by a context identifier (eg. landType, tourism
); As a consequence, Weave clients may optionally specify categories (ie. "contexts") of entities that they will be working with. For example, the below client config specifies that the Holiday_client will utilise information from the tourism context group.<client:config id='Holiday_client' context='tourism'>
... Hence only entities that include the 'tourism' context will be used by the subject client, in additon to entities that do not have a context specification.
The required context specification per entity, takes the following form :
Code Block |
---|
<entity:entity id='roads' label='Roads'/>
<entity:entity id='rivers' label='Rivers'/>
<entity:entity id='wetlands' label='Wetlands' context='landType' />
<entity:entity id='rainforest' label='Rainforest' context='landType' />
<entity:entity id='restaurants' label='Restaurants' context='tourism'/>
<entity:entity id='motels' label='Motels' context='tourism'/> |
Consequently, for the above defined Holiday_client
, it would subsequently utilise entities :
Roads, Rivers, Restaurants and Motels, without there needing to be an explicit specification of relevant entities, per utilised client configuration item.
The "Context" capability was introduced at Weave 2.6.8. It is a powerful feature that significantly simplifies the process of working with many entities within a Weave configuration, where numerous clients may exist. More discussion and examples are provided below.
Prior to the Advent of Contexts
Before 2.6.8 when a user opens a Weave client all of the entities that are registered with Weave are sent to the browser but if you do not need all of the entities to be available in the client then individual panels and components, if they support it, would each have to be configured to refine which entities that they would display.
Weave 2.6.8 adds the concept of a “context” to Weave that will allow you to group entities, and other configuration items, and then specify that a client should only present the entities that have been assigned to that context, removing the need to apply additional configuration too to all of the panels/componentcomponents. The panels/components can be cleaned up to remove the additional configuration that specifies which entities they should include and switch back to including all entities, since now “all entities” means the entities that were linked to the context specified by the client.
...
Associating a context to an entity also means that other items that are associated with that entity will not display* in the client either, things like searches, reports, data, edits, etc., so if an entity is not part of the context that a client uses, then none of the other items related to that entity will be displayed in the client either, there is no need to set a context for these other items.
Info |
---|
*It should be noted that Contexts are not designed to influence the rendering of entities within a map engine. Thus, the image generated as a consequence of a mapengine configuration, will not be affected by the use of client context specifications. |
It’s likely that just associating contexts to entities will take care of 99% of the requirements to refine what’s available in the client, but it’s also possible to assign contexts to other configuration items.
For example, if there are multiple data sets associated with an entity and you have to multiple client configurations that reference the context for the entity but you don’t want all of the data for that entity available for all clients you can specify an a different context to the data sets and then add that context to the client configuration, along with the entity context. If you’re reading closely you just realised that that means that you can specify multiple context for a client.
...
The example for the client context above show shows one way of defining what contexts should be used in the client, namely as a comma separated list, where an item associated with any of those contexts, plus anything that’s not associated with any context, will be included in the client, but Weave 2.6.9 extends that to make the client context attribute more flexible.
...
Another limitation of this format is that it’s always an “or” decision, with out without the “only” prefix, that is, it always includes items that are in either the tree or finance context, there wasn’t a way to specify that only items that are in both the tree and finance contexts should be included, but in 2.6.9 you can do this with by providing an expression for the context, e.g.
...
In the same way that a client can be include items from multiple contexts, the items themselves can also be associated with multiple contexts, by setting the context attribute for the item to a comma separated list.
...