Views

Data is displayed and edited using views of the data in the connected sources. A view shows the possible combinations of values of a set of unknowns that satisfy some constraints.

The view concept in Soda was largely inspired by the SPARQL query language of the World-Wide Web Consortium, though it is not any kind of implementation of the SPARQL standard. It is also very much influenced by the basic concepts of elementary algebra.

To solve a problem using elementary algebra, you give names to the quantities that you do not know (the unknowns), use those names to describe what you do know about those quantities, and deduce the values from those descriptions. For example, your problem is that you have 7 sweets to share with your brother - how can you shere them so that he has one more than you? You let x be the number of sweets that you have, then he will have x+1, so x+x+1=7, and you can deduce that x = 3.

When you define a view, you define a set of unknowns and a set of constraints on those unknowns. Rather than making logical deductions, though, Soda searches the connected sources for data that satisfies the constraints, and displays it. It will only display data that is in the connected sources. It cannot display data that satisfies the constraints but has not been captured.

Example: the Countries View

The countries view shown below has three unknowns: COUNTRY, COUNTRYNAME, and POPULATION. They satisfy the constraints countryHasName and countryHasPopulation. The possible values from all the data in the connected sources are displayed in a table with two columns: Country, which shows the value of COUNTRYNAME, and Population, which shows the value of POPULATION.

Country NamePopulation
Brazil 212
China 1415
Cyprus 1
India 1357
USA 326


It is as though you said, "Let COUNTRY be a country, let COUNTRYNAME be its name, and let POPULATION be its population. Now, we know that COUNTRY has name COUNTRYNAME and COUNTRY has population POPULATION. Display all the combinations of COUNTRYNAME and POPULATION in the connected sources that satisfy these constraints."

Only data that is in the connected sources is displayed. England has a population of 53 Million but, unless the sources contain two triples with the same subject, one of which has verb countryHasName and object "England", and the other of which has verb countryHasPopulation and object 53, the view will not display this information.

Data Display

A view is a view of data in the connected sources. It is not a copy of the data. If the countries view appears twice on a page then both instances show exactly the same data. If you change the data using one of the instances, the results show in both.

A view shows data in all connected sources, treating them as a single data store. Thus, the data shown may change when sources are connected or disconnected.

The data that is shown depends on the user's role. Users working in different roles may see different data. For an item to be displayed to a user in a view, the user must have a role that is superior to the item's read level. Also, when the data in the connected sources is searched to find data that satisfies the constraints of the view, the search only considers items and triples that can be read by the user. This gives the owners of the data strong and precise control over who can see it.

Data Editing

A view can be included in a page in such a way that it can then be used to create, update and delete data in the connected sources.

This is done by specifying a write level for the view on the page. A user whose role is superior to that write level will then see add, edit and delete buttons when the view is displayed, and can use those buttons to add, edit or delete the rows of data displayed in the view.

The same view can be given a write level on one page but not on another, or can be given different write levels on different pages. A single view might be used in many different websites and applications. The website or application designers can define different roles for different purposes, and give them write access to the view. Or a website might display a report that includes a view but does not allow editing, and have a separate set of pages where the data for the report is created.

As well as having write access to a view on a page, a user must also have write access to the data displayed in the view in order to change that data. This may mean that a user can edit some but not all of the rows of data displayed in a view.

Views Defining Data Classes

A view can define a class of data that can be referenced in other views. The countries view defines a Country class with two attributes: name and population. Other views can have unknowns whose values are members of that class. The cities view has four unknowns: CITY, CITYNAME, COUNTRY and ISCAPITAL. They satisfy the constraints cityHasName, cityIsinCountry, and cityIsCapital. The COUNTRY unknown is restricted to values of the Country class defined by the countries view.

City NameCountryCapital
Beijing true
Bengaluru false
New York false
Nicosia true
Rio de Janeiro false
Washington DC true


Views Showing Combinations of Data

A view can show combinations of data created using other views. The capitals view shows combinations of data created using the countries view and the cities view.

Country NamePopulationCapital Name
China 1415 Beijing
Cyprus 1 Nicosia
USA 326 Washington DC


Working With Views

To create a view, you must have write access to a workspace. Go to the workspace and click the edit button at the top of the page. An add button will appear below the list of workspace members. Click it, enter the name of the new workspace member, and select its type as View. Select its read and write access levels, and click the proceed button.

You can change the name and access levels of the view by clicking its settings button on the workspace page. You cannot change its type unless it has no unknowns, constraints, columns, or other attributes. (If you meant to create a page, file, or workspace rather than a view, and have not yet started to define it as a view, you can change the type.) 

You can delete a view by clicking the delete button on the workspace page. Its unknowns, constraints, columns, and other attributes will be deleted also.

To define a view or change its definition, click the edit button at the top of the view's page. You will then see add, edit, move-up, and delete buttons that enable you to edit the view's attributes.