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
[[Has president::John F. Kennedy]],
[[In office since::1961]],
[[In office until::1963]] 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
[[Has fields::Has name; In office since; In office until]]. Here the property "Has name" would be of datatype "Page"Holds names of wiki pages, and displays them as a link or datatype "Text"Holds text of arbitrary length, the properties "In office since" and "In office until" would be of datatype "Date"Holds particular points in time. One could then write a fact as
[[Has president::John F. Kennedy; 1961; 1963]] 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
[[Has president::Barack Obama; 2009]] 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
- Semantic MediaWiki: GitHub issue 3418 comment no – Usage of
#askon a Record in a Record, i.e. data retrieval on elements in a "sub-record"1
- API example
Some use of "" in your query was not closed by a matching "".
- Semantic MediaWiki: GitHub issue gh:smw:3418