Schema
(→Creating a schema example) |
(→Creating a schema example) |
||
Line 45: | Line 45: | ||
==Creating a schema example== | ==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. | + | 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: |
− | 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 | + | * 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'''. | ||
Line 53: | Line 61: | ||
− | 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 the topic. Open '''Schema type''' subtree and select '''Content type'''. Finally confirm class addition clicking '''OK'''. | + | === 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 the topic. 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. | ||
[[Image:schema_example_02.gif|center]] | [[Image:schema_example_02.gif|center]] | ||
+ | |||
+ | === 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...'''. Association editor offers us schema associations. By default editor waits for associations of '''Association type'''. This is fine for us. Enter '''hasAlbum''' to the text field titled '''Association type''' and click OK. | 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...'''. Association editor offers us schema associations. By default editor waits for associations of '''Association type'''. This is fine for us. Enter '''hasAlbum''' to the text field titled '''Association type''' and click OK. | ||
Line 65: | Line 77: | ||
− | 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 ie. '''The Art of Noise (artist)''' has associations of type '''hasAlbum'''. Next step is to tie roles and players of '''hasAlbum''' associations. Open '''hasAlbum''' double clicking the topic. Note that '''hasAlbum''' has class '''Association type'''. Class was added to the topic during the previous step. | + | 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 ie. '''The Art of Noise (artist)''' has associations of type '''hasAlbum'''. Next step is to tie roles and players of '''hasAlbum''' associations. |
+ | |||
+ | |||
+ | === Specifying roles of schema === | ||
+ | |||
+ | Open '''hasAlbum''' double clicking the topic. Note that '''hasAlbum''' has class '''Association type'''. Class was added to the topic during the previous step. | ||
Line 71: | Line 88: | ||
− | Right click '''Associations''' header title and select '''Add association...'''. As the topic is instance of '''Association type''' association editor expects you to enter '''Role''' association. Write '''album''' to the text field titled '''Role''' and click '''Add'''. Association is added to the topic but association editor remains open. Continue writing '''artist''' to the text field titled '''Role''' and click '''OK'''. We have just created two associations to the topic. Both associations are typed as '''Role''' and '''hasAlbum''' plays role '''Association type''' in both association while '''Role''' player is '''artist''' and '''album'''. This means that we can add two players to every '''hasAlbum''' association. First player is instance of '''artist''' and second player is instance of '''album'''. '''Artist''' and '''album''' topics are also roles of the players. | + | Right click '''Associations''' header title and select '''Add association...'''. As the topic is instance of '''Association type''' association editor expects you to enter '''Role''' association. Write '''album''' to the text field titled '''Role''' and click '''Add'''. Association is added to the topic but association editor remains open. Continue writing '''artist''' to the text field titled '''Role''' and click '''OK'''. We have just created two associations to the topic. Both associations are typed as '''Role''' and '''hasAlbum''' plays role '''Association type''' in both association while '''Role''' player is '''artist''' and '''album'''. This means that we can add two players to every '''hasAlbum''' association. First player is instance of '''artist''' and second player is instance of '''album'''. '''Artist''' and '''album''' topics are also roles of the players. Now we are are to try how the schema works in real life. |
Line 77: | Line 94: | ||
− | + | === Using the example schema === | |
+ | |||
+ | Lets create yet another album. Select '''album''' topic in tree. Right click the topic and select '''New topic > New instance topic...'''. | ||
Revision as of 21:01, 18 August 2008
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 text data (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 and constructions to do things more comfortably. Schema is a collection of topics and associations found usually under Schema type topic.
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.
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 the topic. 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.
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.... Association editor offers us schema associations. By default editor waits for associations of Association type. This is fine for us. Enter hasAlbum to the text field titled Association type and click OK.
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 ie. The Art of Noise (artist) has associations of type hasAlbum. Next step is to tie roles and players of hasAlbum associations.
Specifying roles of schema
Open hasAlbum double clicking the topic. Note that hasAlbum has class Association type. Class was added to the topic during the previous step.
Right click Associations header title and select Add association.... As the topic is instance of Association type association editor expects you to enter Role association. Write album to the text field titled Role and click Add. Association is added to the topic but association editor remains open. Continue writing artist to the text field titled Role and click OK. We have just created two associations to the topic. Both associations are typed as Role and hasAlbum plays role Association type in both association while Role player is artist and album. This means that we can add two players to every hasAlbum association. First player is instance of artist and second player is instance of album. Artist and album topics are also roles of the players. Now we are are to try how the schema works in real life.
Using the example schema
Lets create yet another album. Select album topic in tree. Right click the topic and select New topic > New instance topic....
Write Best Of Art Of Noise to the basename field and http://www.wandora.net/album/Best_Of_Art_Of_Noise to the subject identifier field. Confirm the request and new topic appears in albums.
Open topic The Art of Noise (artist). Open association editor by selecting Add assocation.... You are now able to create hasAlbum associations between artists and albums very easily. Just press TAB on the album field and Wandora opens drop down selector for existing albums or write new album name to the text field and Wandora creates new topic for the album and makes the created topic instance of album topic. This is just much more convenient than explicitly picking up every role and player in associations.
Created schema is not automatically symmetric. You must link artists and albums in the artist. Schema says nothing about creating same association in the album. If you want to add artist-album associations in albums you need to create symmetric schema definitions 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.