Schema

From WandoraWiki
Jump to: navigation, search

Each topic of a specific type usually have same kind of associations and occurrences. For example people have parents and birth and death dates. Some other kind of topic, for example music album, doesn't have these associations but uses a different set of association types. These kind of rules are encoded in the topic map schema.

Schema defines

  • What associations are allowed for topics.
  • What roles are allowed and required within associations.
  • What players are allowed to play a specific role.
  • What kinds of occurrences are allowed for the topic.
  • Superclass-subclass hierarchy with inheritance of schema definitions

Schema does not restrict the associations, roles or players you can view or import to Wandora, that is, schema is not used to validate the topic map. You can always create whatever associations or occurrences you want. Schema just offers you a framework to do things more comfortably. Schema is a collection of topics and associations found usually under Schema type topic.

Schema tree.gif

All different schema concepts are describe here. You can find a practical example of creating a topic map schema at the end of this page.

Contents

Content type

Content type is the type of topics in the topic map. Basically all different types of topics you have in your topic map should be of type content type. Note that only types of topic should be of type content type, not all topics. For example the sample ArtofNoise.xtm topic map has artists, albums and titles. These topics are used as types of other topics and also should be content types. The actual albums, titles and artists are instances of these topics and shouldn't be of type content type.

Association type

Association types are types of associations you use in your topic map. The Art of Noise topic map for example associates albums with artists. The type of this association could be hasAlbum and the type of this topic would be Association type.

To associate an association type with a content type create an association with type Association type and roles Content type and Association type. Semantics of such an association is that the specified association type is relevant with the content type and Wandora schema aware dialogs will suggest such an association in the context of the content type.

Each association of a specific type always uses same roles. These are added as associations with type Role in the association type. Roles for this association are Association type and Role. Usually you need at least two such associations for each association type because associations usually have two or more players and thus roles.

Role

You need topics that indicate the role of a player in an association. These are instances of the topic Role. The topic Role is also the association type described in previous paragraph. Usually the player playing a specific role is also an instance of the role. Schema aware tools in Wandora add the role as class of the player automatically if needed. However in some cases you don't want to use role topic as the class of the player. Then you need to specify a role class for the role.

Role class

As described in previous paragraph, you may want to specify a role class for a role. This is done by adding an association in your role topic. The type of the association is Role class, and the two roles are Role and Role class. Semantics of such an association is that each player of the role should be an instance of the specified role class rather than an instance of the role itself.

Occurrence type

Occurrence type is like association type but for occurrences. You need to specify that some topic can be used as occurrence type by making it an instance of Occurrence type. After that you need to associate your occurrence type with your content type. This is done by creating an association of type Occurrence type with roles Content type and Occurrence type. After that you can use your occurrence type with the content type.

Superclasses and subclasses

You can make topics subclasses of other topics. Subclasses inherit schema definitions from superclasses. For example you can specify that topics of type Person have an occurrence of type Birth date. Then you can make the topic Artist subclass of Person. After this all artist can also have a birth date without making further changes. You can then add hasAlbum as an association type for Artist. Then artists can also have albums but topics that aren't artist but are people, that is instances of Person, can't.

Creating a schema example

Wandora software package contains a sample topic map ArtofNoise.xtm covering almost perfect discography of Art of Noise music group. Let's say we are planning to extend this discography to cover unlisted albums also. We could use regular association editor but as we think the work is continual we want to optimize the work flow as smooth as possible. Schema assists our filing project. Our example has following steps:

  • Preparing example
  • Specifying content type of schema
  • Specifying association type of schema
  • Specifying roles of schema
  • Using created schema

Preparing example

First open the topic map ArtofNoise.xtm found in samples/ArtofNoise folder. Drag and drop the XTM file to the layer stack. Select created layer named after the imported XTM file and open topic artist.


Schema example 01.gif


Specifying content type of schema

Now you should have artist open in Wandora as shown above. Note that topic has only one class myMusic and one instance The Art of Noise (artist). Next step is to add class Content type to the topic. Right click Classes header title and select Add class.... Wandora opens a dialog used to select topics. Open Schema type subtree and select Content type. Finally confirm class addition clicking OK. You have just specified the topic artist is a content type.


Schema example 02.gif

Specifying association type of schema

Now you have topic artist open and the topic has two classes of myMusic and Content type as shown above. Our next step is to define associations for artists. Right click on Associations and select Add association.... Click the button beside association type and select topic Association type. Wandora fills roles for the association type and you have to address player only. Select hasAlbum as second player and click OK.


Schema example 03.gif


You should now see first association in the artist topic. Association's type is Association type and association has two players of artist and hasAlbum with roles Content type and Association type. We have just described that all instances of artist topic, The Art of Noise (artist) for example, has associations of type hasAlbum. Below is a screenshot of Wandora and topic artist after association creation.


Schema example 04.gif


Just to finalize association type specification open hasAlbum and add class Association type to the topic as shown below.


Schema example 05.gif


Specifying roles of schema

Next step is to tie roles of hasAlbum associations. Association has two players and equivalent number of roles. Thus we create two associations that specify roles.

We have topic hasAlbum open. Right click Associations header title and select Add association.... Create associations as shown below.


Schema example 06.gif


Schema example 07.gif


Schema example 08.gif


We have just specified that hasAlbum association contains two players and these players are instances of album and instances of artist.

Using the example schema

Now we are ready to try how the schema works in real life. Lets create yet another album. Select album topic in tree. Right click the topic and select New topic > New instance topic....


Schema example 09.gif


Write Best Of Art Of Noise to the basename field and http://www.wandora.org/album/best_of_art_of_noise to the subject identifier field. Confirm the request and new topic appears in albums.


Schema example 10.gif


Open topic The Art of Noise (artist). Open association editor by selecting Add assocation....


Schema example 11.gif


Schema example 12.gif


You are now able to create hasAlbum associations between artists and albums very easily. Press association type button and Wandora suggests you schema specified association types. As we specified association type above, list should contain topic hasAlbum.


Schema example 13.gif


Select hasAlbum and click OK. Wandora automatically selects roles for the hasAlbum association using specified schema.


Schema example 14.gif


Next click player topic button and once again schema suggests you possible player topics. Select topic Best of Art of Noise and click OK.


Schema example 15.gif


Schema example 16.gif


New hasAlbum association is created when you click OK.


Schema example 17.gif


Created schema is not automatically symmetric. Our schema says nothing about creating hasAlbum association in point of view of the album. If you want to add artist-album associations in albums, you need to create symmetric schema specification to album topic. As role definitions remain the same you just have to define Content type and Association type.

Summary of schema creation steps

  • Open class topic of topic's you want to edit.
  • Make topic instance of Content type.
  • Add topic association of type Association type where another player defines the association type.
  • Open this player topic that defines association type.
  • Add topic associations of type Role, one for each intended role, where another player defines the class of accepted players.
Personal tools