Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 3 Next »

Basic of data handling in Weave

Selections

One important thing to get your head around in Weave is the concept of the separation of searching and reporting.

In way of an example think of how users use search engines like Google where they search for something and get back the results. There's only ever one way to search, type something in the box, and one type of result displayed, a page of top search results.

But with Weave you have a multitude of ways of searching for things and a multitude of ways of displaying the search results. "Searching" could be preformed by drawing a polygon on a map to find all the things that fall within that polygon, or by typing in an address to search a database find the matching properties, or even by having a third party system sending a list of unique identifiers. And "Reporting" could be a simple as displaying a list of the owner names of the found properties, or generating a PDF report describing the history of the property, or sending a list of unique identifiers to another third party system.

Because of this separation and the use of a current selection searching can be combined or split across multiple systems, for example, a user is working in a property management system and has selected a number of properties, they send this selection to Weave (searching by third party system) which updates the current selection for properties, then they perform a spatial intersection operation in Weave to refine the selection of properties to only those that fall within a flood zone (searching via spatial operation), then perform an attribute search to further refine the selected properties to those that are listed in the residents database as being over 65 years old (searching via SQL). Then they display the textual list of owners of the properties (reporting from SQL) to give it a once over before finally generating a flood warning mail merge based on the final list of selected properties (reporting from document) and send those to the residents warning then that evacuating sooner rather than later may be a good idea.

To facilitate this Weave uses the concept of a current selection, where each entity you want to work with in Weave is associated with a list of unique identifiers that represent the entities that the user has searched for and is reporting on. This list of identifiers can come from anywhere and as long as each system Weave connects to uses the same identifiers to represent the same entity then Weave can work with those systems to perform searching and reporting.

So a central principal in Weave is the entity, which is nothing more than an internal id, a user facing label and a list of identifiers that represent the current selection.

Spatial Operation

If you want to be able to work spatially with an entity (select by polygon, zoom to on a map, etc) you need to tell Weave what layer/table in a spatial engine can be used to represent the entity and what column (the key column) in the layer/table can be used to uniquely identify each entity, this is done be creating a spatial mapping item in the configuration file.

Once a spatial mapping is setup for an entity then when you do a select by polygon, a boundary intersection, a buffer operation, etc, it's the key column values that are written to the current selection for the entity, thereby updating the current selection for that entity. Going the other way, if you want to zoom to the extent of the current selection or highlight the selection on the map, then the list of unique identifiers stored in the current selection for the entity is used as the basis for performing a query in the spatial engine for geometry that matches the list of id's.

You don't actually need to specify a spatial mapping to work with an entity in Weave, but you won't be able to display the entities location on the map or select the entities using spatial operations. It's in fact possible to setup an entire Weave client without a map or any spatial entities and have the user work purely with the textual attributes of the entities.

The spatial operation on the client are represented with the "select/reselect/unselect by point/line/polygon/circle/rectangle" tools, along with various buffer and spatial intersection tools and setup using the Spatial Mapper configuration item.

Attribute Display

If you want to display textual attributes for an entity you create data definitions and link those to an entity for display with a data tag (really should come up with a better name for that). Data definitions are a tabular representation of textual data that can come from anywhere, but generally will come from a database and be generated by SQL, they can be used for populating drop down lists, generating content for a BIRT report or most often for direct display of attribute data for the user.

To allow a data definition to be used to display attribute data related to a selected entity the data tag is used to link an entity to a data definition and provide a label for displaying to the user. This way there can me more than one set of attribute data that can be displayed to the user for each entity and the user can choose between which attributes to display be selecting the from list of available data's based on the label.

For database/SQL based data definitions which will be used for displaying textual data relating to an entity for the user the data definition must be configured with a key column. In the same way that the key column in the spatial mapping links the currently selected entity to a row in a table in the spatial engine, the key column in a data definition links the currently selected entity to a row in a table in a data source (as data source is a connection to a database). This way when it comes time to display the attributes for a selected entity to the user an SQL statement can be generated that only selects the rows that match the id's from the current selection.

Basing the generation of the attribute data on the unique identifiers related to an entity means that the attribute data to be displayed to the user can come from a number of different databases, including the database underlying the spatial engine (if it has one), and does not require that the data that's displayed to the user is even in the same database as the spatial layers, let alone is directly attached to the spatial records in the spatial database.

Attribute display on the client is represented using the data grid view and created using the Data Definition configuration items.

As a side note, the spatial identify tool is a short cut between the previous two items, the spatial mapping and the data definitions, that bypasses the updating of the selection tables and simply takes the list of identifiers returned by the select by polygon operation and uses that list to select the record from the data definition to display back to the user.

Attribute Searches

Data definitions take care of generating textual attribute data for displaying to the user, attribute searches provide the reverse. They allow the user to enter text values which are sent to a database, via an SQL statement, to generate a list of unique id's that match the user entered values, which are then uses to update the current selection for the entity that the search is associated with. This is again done by specifying a key column for the search, and it's this column who's values will be extracted and placed into the current selection for the list when a search is performed.

From the above you can see that by ensuring that spatial mappings, data definition and attribute searches all have the same concept of what value represents a given entity it's possible to combine all three, even if the actual source of the values (i.e. A specific column in a database table) isn't the same in all three cases.

Attribute searches are represented on the client using the search view and created using the Search configuration items.

Reports

Beyond the basic data display generating a Report can allow the user to produce a more formatted form of output beyond just the tabular display of the data. The reports can contain data generated by Weave data definitions or can pull in data from any data source available to the BIRT reporting engine.

Virtual Entities

While it's possible to perform joins when working with data definitions and attribute searches, for example to allow you to list all of the animals registered at a selected property, sometimes you want to work with individual entities that don't have a spatial components.

Continuing our animals example if you wanted to select all of the German Shepherds in a given neighbourhood a naive approach would be to create an attribute search that started with the animal registration table (perhaps selecting all the rows containing the animal code for German Shepherds) then join that table to the property table (assuming the animals table has a foreign key into the property table) allowing us to get the unique property id for the property that the animal is located at. Weave then uses those property id's to update the current selection for properties and now we have a list of all the properties that have registered German Shepherds. But, when we then try and display the information related to the dogs we've just searched for using a data definition that does the reverse of when the search did (that is we start with the property table, selecting just those rows that match the property id's in out current selection, then join that table to the animal registration table to get a list of the animals for each property) we see that there are dogs other than German Shepherds listed.

This occurs because what we've done is to select all of the properties that have German Shepherds, we haven't selected all of the German Shepherds which is what we actually wanted to do. So when it come time to display the animal information we're displaying information about all of the animals that are registered at each selected property, which will more than likely include more that just the original German Shepherds.

If you want to work with entities that don't have a spatial representation you have two choices, either the user works with the entities using just attribute searches and data definition and has no way of selecting or viewing the entities via the map display, or you create a spatial view for the non-spatial entity and create a new entity to represent the newly "spatialized" entity. For example with our animals search we create a spatial view in the underlying spatial database that joined the animals registration table to the property spatial table, allowing us to represent each animal record by the property boundary of the property it's registered at and then we create a new animals entity and set up a spatial mapping using the spatial view and setting the key to be the animals registration number rather than the property id.

Then when we create an attribute search to find the German Shepherds the list of id's we end up with are the dogs registration numbers, which are unique for each dog, rather than the property id which isn't unique for each dog. We'd also need to switch out attribute search and data definition so that they now use the animal registration number of the key field rather than the property id. Of course we can also keep the animal property attribute search for time when we do want to locate properties based on the animals that are registered there.

Note that we could also add the newly created animals layer to our map engine as a new layer so that we can display just the animals using their property boundaries on the map, but this isn't necessary.

  • No labels