Introduction

In the previous article of this series we examined the association construct from the perspective of Entity-Relationship data model. In this post we demonstrate how Topic Map data model represents associations. In order to link the two we continue with another SQL query from our relational database

SELECT suppliers.sid,
       suppliers.sname,
       suppliers.scountry,
       catalog.catcost,
       catalog.catqnt,
       parts.pid,
       parts.pname,
       parts.pcolor
FROM   suppliers
       INNER JOIN (parts
                   INNER JOIN [catalog]
                           ON parts.pid = catalog.catpid)
               ON suppliers.sid = catalog.catsid
WHERE  (( ( parts.pid ) = 998 ))
ORDER  BY catalog.catcost;

This will fetch all the rows of a result set where we are looking for the minimum catalogue price of a Red Fire Hydrant Cap and who is the supplier that manufactures this part. The reader will notice that apart from the deficiensy of the nested JOINs, (see here), we had to formalize our search in SQL language in order to get back our result. Wouldn’t be nice if we could engage the user in a codeless style of search, independent of the business case. Let us see the difference with the Topic Map data model first.

Associations in Topic Map Data Model

Perhaps there is not a better software tool out there to introduce you to Topic Maps than Wandora information management application, see how.

Tuples to Associations

Our first step is to build a Topic Map data model from the SQL result set above. With Wandora this is easy thanks to its powerful set of extractors. Here we use an Excel adjacency list extractor to convert each spreadsheet row of this Excel file to a Topic Map Association.

Tuples of a Relation - Wandora Associations

In the right panel of the screen capture, you may see that we have four associations of type Tuple. They are all sorted by the catcost column. This is the role that cells of this column play in the Tuple association. In our example each Tuple is an instance of the Excel class with a maximum of 8 members and each member plays a role in the association. You may agree that this Topic Map model view of data looks already very familiar to the user that is accustomed with tables.

But behind the scenes Topic Map associations are notably different from the n-ary tuples of the relational model. In the left panel of our screen capture you can see all the data that are extracted from the spreadsheet. Notice that no data value is repeated. Each association is constructed from single instance values and this also means that associations are sharing values among them. We can visualize the network of associations by switching to Wandora’s Graph topic panel. From the left panel, we select the minimum price of the part, which is 11.7 and then we expand this node on the Graph topic panel. This way the first association will be drawn that includes as members all the other values that this cell is associated with. One of them is USA and plays the scountry role. We can right click on the value and expand again the nodes (associated members). Two associations are displayed now on the graph that share four common values between them.

Two Associations in the Graph Topic Panel of Wandora. Brown labels indicate the type (Tuple) of association and the role (sname) of one of its members

SQL to Topic Map Filtering

Another important observation we should make at this point is that instead of writing any query to fetch those suppliers that are located in USA we simply filtered the table based on this value. We are able to do this, because Topic Map data model works with single instance values that are linked bidirectionally. Accordingly, data is always normalized and the main operations of the relational algebra such as set operations, selection and projection, can be performed. For instance, filtering associations that have USA member is equivalent to selecting rows from SQL. Moreover, the user can traverse interactively the graph starting from any value without writing a single line of code.

Topic Map Serialization

To understand better the underlying structure of data in the previous example, we have serialized a Topic Map in LTM format. Dropping this LTM file into an empty topic panel, we invoke the import function of Wandora. Then we expand the topic tree and double click on the 998 cell. The following screen capture looks pretty much the same as the one we have generated from extracting the Excel spreadsheet above. The main difference is that now we have two association types, one for Catalogue tuples and another for Part tuples. Part 998 participates in five associations (tuples) in total, four of them are from Catalogue table and one from Part table. We have also taken a minimum number of members, i.e. fields (columns), for our associations to keep it simple.


/* 1 Association of catalog part no 998 with "Red" and "Fire Hydrant Cap" */
Prt( prtName08:pname, prtID08:pid, prtColorRed:pcolor )

/* 4 Associations of catalog part no 998 with supplier Ids and catalog prices */
Cat( prtID08:catpid, supPrice18:catcost, supID18:catsid )
Cat( prtID08:catpid, supPrice14:catcost, supID14:catsid )
Cat( prtID08:catpid, supPrice16:catcost, supID16:catsid )
Cat( prtID08:catpid, supPrice12:catcost, supID12:catsid )

Associations of part no. 998

Because of the single instance feature of Topic Maps, If we switch to Wandora’s Graph topic panel we can visualize these associations.

Associations of part no. 998

R3DM Type System in Wandora

We expand our previous example with tuples from three tables and a rich type system, also known as Ontology or database schema.

Associations of part no. 998, Supplier Associations and Symmetric Binary Predicates

We start again our exploration from the data item with the value 998. There is one association, labeled Part8, representing a tuple from Part table (998, “Fire Hydrant Cap”, Red, 7.2, lb) and four of them, labeled Cat08, Cat12, Cat13, Cat17, representing tuples from the Catalogue table (see result set above). Further on, USA suppliers are expanded with two more associations, labeled Supplier1 and Supplier2. The two previous graphs are combined in a single one. We can also observe other associations with only two members, we call these symmetric binary predicates (SBP). SBPs are used to define a prototype for our R3DM type system. For example, the member value 7.2 of association Part8 is of type Part Weight (Instantiation Predicate) and Part Weight is hyponym of Weight (HyperHypo Predicate). The reader may compare this graph with this Entity-Relationship diagram and realize that we have both instances (values) and classes, i.e. Entities and Attribues, on the same graphics diagram. Not only that, but most important our type system is generic and we are able to merge and classify data from multiple datasets. Alternatively, Wandora’s Topics tree panel on the left part of the image displays a hierarchical structure for types and instances. Those that are expanded can also be seen on the graph panel.

This is a good place to introduce our R3DM type system. It is presented here for the first time and it will be fully analyzed in a forthcoming post of this series. In the next graph we have expanded several nodes of our hierarchical type system. For instance, Catalogue, Catalogue Part, Catalog Supplier are represented as groups (Grouping Predicate) of Wandora class which is the Root of the Topic Tree. Each of these groups is also a type (Instantiation Predicate) for a set of instances that represent associations. We have Cat01-16 for Catalogue associations, Part1-9 for Part associations, and Supplier1-4 for Supplier associations.

R3DM Type System in Wandora

We have defined six SBPs in total, these are grouped under the Symmetric Binary Predicates group. Five of them have been configured with special symbols to be used in Wandora’s Topic tree. Each one of them is expanded on Wandora’s graph panel to show the pair of its association members. The Holonomy-Meronomy Predicate has been used to connect association members to association type.

Wandora class has also five group members, we have already seen four of them. The fifth one is a Variable Type group and it has four sub-categories, Categorical Variable Types, Meta Variable Types, Numeric Variable Types and Time Variable Types. Each of these specialized types has instances and each instance can be further specialized. For example, starting from bottom to top :

gr isInstanceOf Part Unit isHyponymOf Unit isInstanceOf Categorical Variable Type isHyponymOf Variable Type isMemberOf Wandora class

In this way all values are single instances of some type and they are hyperlinked to build associations (hyperedges). Each association is also an instance of some type.

Summary

We conclude our discussion of Association in Topic Map data model. Topic map data model is profound and at the same time powerful and simple to start building higher constructs to model real things. Association in Topic Map is a first class citizen. Here is a list of interesting features we discussed in this post :

  1. We can define single instance Topics (and/or values) and then associate them.

  2. Association is a bidirectional n-ary relation with Type and Roles embedded.

  3. Because of 1. and 2. we can traverse the graph from any point to any other point simply by filtering nodes and edges.

  4. We can display both Topic/Association types and instances on the same graph

  5. Data from multiple data sets cab be merged with R3DM type system that is based on symmetric binary associations.

There are other powerful features of Topic Maps related to associations such as merging and information resources that are attached to topics, i.e. occurrences, we reserve time and space to highlight them in a forthcoming article.

We will continue our demonstration with the Catalogue-Part-Supplier example. This time we will examine how associations can be represented on the Graph Model of OrientDB DBMS.

Click on the image to continue reading our next article on this series.

Cross-References

R3DM Project Posts

2017

Associative Semiotic Hypergraph API in Mathematica for Next-Generation BI Systems
European Wolfram Technology Conference 19-20 June 2017 in Amsterdam
My speech at European Wolfram Technology Conference 2017 about a new data modeling framework R3DM/S3DM that is implemented on top of OrientDB graph database and coded in Wolfram Mathematica

Are our old data model standards out of shape ?
An overview of critical points to consider when modeling with R3DM/S3DM
Both Topic Maps and RDF/OWL exhibit signs of aging. These signs do not indicate maturity levels but on the contrary they signal a re-examination of the data modeling, information representation problem

The three dimensions of AI and a fourth one as the key to unlock them
Comments on a review of AI by John Launchbury, special assistant to DIRO, DARPA
Although there has been significant progress with first and second generation AI systems in reasoning, learning and perceiving, abstraction has not been part of the game. The mechanism of abstraction can unify these other three processes.

Associative Data Modelling Demystified: Part 6/6
R3DM/S3DM: Build Powerful, Meaningful, Cohesive Relationships Easily
Demonstration of a new data model framework that transforms OrientDB into a HyperGraph Database

Data Modelling Topologies of a Graph Database
Definition and Classification of Graph Databases into Three Categories
The associative data graph database model is still a heavy hitter, stacking up well against property graphs and triples/quadruples. Expect a comeback.

A Quick Guide on How to Prevail in the Graph Database Arena
A brief discussion on criteria to meet a differentiation strategy for graph databases
A swift introduction to the key factors that influence the performance and unification character of graph databases

Associative Data Modeling Demystified: Part 5/6
Qlik Associative Model
Qlik's competitive advantage over other BI tools is that it manages associations in memory at the engine level and not at the application level. Every data point in every field of a table is associated with every other data point anywhere in the entire schema.

2016

Associative Data Modeling Demystified: Part 4/6
Association in RDF Data Model
In this article we will see how we can define an association in RDF and what are the differences with other data models that we analyzed in previous posts of our series

Do you Understand Many-to-Many Relationships ?
Associative entities are represented differently in various data models
It is 2016 and in my opinion the situation with associative entities has become darn confusing. Edges of a Property Graph data model are bidirectional but RDF links are unidirectional.

Associative Data Modeling Demystified: Part 3/6
Association in Property Graph Data Model
In this article, we continue our investigation with the Property Graph Data model. We discuss how a many-to-many relationship is represented and compare its structure in other data models

Associative Data Modeling Demystified: Part 2/6
Association in Topic Map Data Model
In this post, we demonstrate how Topic Map data model represents associations. In order to link the two, we continue with another SQL query from our relational database

Associative Data Modeling Demystified: Part 1/6
Relation, Relationship and Association
In this article, we introduce the concept of association from the perspective of Entity-Relationship (ER) data model and illustrate it with the modeling of a toy dataset

2015

Towards a New Data Modelling Architecture
Part 2: Atomic Information Resource (AIR)
We introduce the Atomic Information Resource (AIR) unit of R3DM conceptual framework

Towards a New Data Modelling Architecture
Part1 - Relational/ER Constructs in Wolfram Language
We start with terms and constructs that most of us are familiar with from the Relational and Entity-Relationship database management systems