Help:Type Record/Using a record

For a typical example for using records, assume that you want to store information about the presidents of the U.S.A. in a wiki page about that country. You could simply write Has president::John F. Kennedy to state that Kennedy is among the presidents, but this would not allow you to see when Kennedy was president, and it would be impossible to find out the current president.

The fact that Kennedy was the 35th president of the U.S.A., serving from 1961 until his assassination in 1963, consists of various pieces of information that belong together. Setting independent property values,  ,   would not solve the problem if the page contains many presidents, since one could no longer know which in-office dates belong to which president.

A possible solution is to declare the property "Has president" to be a record with fields. Here the property "Has name" would be of or, the properties "In office since" and "In office until" would be of. One could then write a fact as  so as to group these pieces of information. As explained above, one could also omit some of the fields if they are unknown or non-applicable, e.g. when writing  where the end of office is not known yet.

Another possible solution to this modeling problem is to create one article for each presidency, and to assign individual fields values to this article instead. For example, one could have a page "Kennedy's presidency" that is annotated with individual property values for person, start and end of office. Thus it would be possible to insert the information about the presidents to a page about the U.S.A via an inline query.


 * Other examples
 * Used by the Intel 8∕16 LAN Adapter example to add device specific configurations
 * Used to model product configurations
 * CiteRef::gh:smw:3418