User:Patrick/category
From semanticweb.org
User space unless indicated otherwise:
annotation | ask | Help:Attribute name | Help:Browsing and searching | category | Help:Chains of relations and attributes | Help:Custom units | Help:Namespace | Help:Relation name | selection | Help:SearchTriple | sorting | Help:Templates in SMW | this page on sandbox.semantic-mediawiki.org | this page on Wikible
The categories with the number of members of each are given at Special:Categories.
Contents |
[edit] Singular or plural
It is not obvious whether a page like Amsterdam should be in Category:City (a description of a member of the category) or "Category:Cities" (a description of the category as a set of pages). A convention for using one or the other is useful to avoid ending up with both, with part of the applicable pages in one, and part in the other, as has happened.
Currently the convention on Ontoworld is to use the singular form, while the convention on the English Wikipedia is to use the plural form.
[edit] Comparison with relations and attributes
The whole category system is comparable with a single relation: the subject is called "category member", the object "category". Let us call the direction from member to category "up". In the selection part of a query, the category feature finds related pages on the downward side, with automatic "transitivity": if page P is in category Q and Q is a subcategory of category R, selecting category R also gives P. In view of that the feature is intended for some transitive relation.
In a query, we can use [[Category:*]] to show for each selected page the categories it is in (i.e., go up one step), similar to using e.g. [[Instance of::*]] to see for each selected page, of what it is an instance.
Thus selecting Category:Country in European Union also gives countries in Category:Country in Eurozone, but in a query that selects countries, Category:=* gives for Netherlands the latter (and other categories), but not "Category:Country in European Union", in which it is indirectly.
Compare with a relation like Property:Subclass of: if we also have the inverse relation, in this case Property:Has subclass, we can list the contents of up to two sublevels.
Both for selection and for display, it is not obvious whether including instances of subclasses is an advantage or disadvantage, it depends on the case and on one's wishes.
Regardless of the method, if one wants to include instances of subclasses while these are not provided automatically, of course one can annotate them directly.
[edit] Film release year
One can have Category:2006 film etc., or Category:film combined with Property:released in year.
- Selection: no difference
- Display: in a table of films a linked 2006 in a separate column seems better than "2006 film" linked to the category, in a column shared with film genre.
[edit] Usage
The category feature can in principle be used for any transitive relation. Usually it is applied for "instance/subclass of": thus selection gives subclasses and instances of arbitrary level, but the info about the selected pages only shows one superclass level. It could also be applied for the inverse, but not both on one wiki. In that case we could select superclasses of arbitrary level, but show of each selected page only one subclass level.
As long as there is no confusion "instance of/subclass of" could be extended with the meanings part of, located in (an area can be identified with a class of point locations), member of (e.g., an organisation of countries can more or less be identified with the combined area, in the exceptional case of multiple organisations with the same set of countries we can use different pages anyway), released in year (a film can be identified with the event of its release, a year can be identified with the class of events in the year).
A category regarding an area could also have as members topics about that area, thus covering the relation is about. This may or may not be made explicit in the name. Thus we might use Category:Netherlands or "Category:Topic related to the Netherlands".
This way the benefits of the category feature can be maximized, and also queries involving categories and their inverse relation "has subclass" can be maximally reused, they could then include the meanings has part, location of, has member, has subtopic (with regard to has topic, note that if a conference covers a topic, this topic is probably also covered elsewhere, so there is not a kind of subclass relation unless we narrow down the topic to the coverage at the conference).
The precise meaning of the relation for any instance can largely be derived from the properties of the subject and object, e.g. if a country is a "subclass" of an organization of countries it is a member, if a city is a subclass of the organisation it is a city in a member country.
We can even use the category relation for one type of relation between a person and a film or between a film and a person, e.g. played in, has actor, director of, directed by, but not more than one within one wiki, there would have to be a wiki-wide convention what the category relation means in this case. Thus a category of films could contain all actors who played in these films, or a category of actors could contain all films they played in. In the first case we would make every film a category; if we would make every person an instance, not a subcategory, we could still distinguish films from persons: by namespace. In that case we could not do something similar with a category for a person. It seems that such practices get confusing and should only be adopted with great care.
This confusion and these limitations are avoided by giving the categories names appropriately describing the class, e.g. putting the actors of the film Afblijven not in a "Category:Afblijven", but in Category:Actor who played in Afblijven and putting the films in which Matthijs van de Sande Bakhuyzen played not in "Category:Matthijs van de Sande Bakhuyzen" but in Category:Film in which Matthijs van de Sande Bakhuyzen played. This comes at a cost: we need an extra page (category) for each film and each actor, respectively.
[edit] Category as class
On Ontoworld a page representing a class is always put in the category namespace, even if instances are not notable enough for a page, e.g. electron. As a result their are empty categories such as Category:Electron.
Property:Instance of and Property:Subclass of are in principle deprecated, a category tag is used instead. However, the inverses Property:Has instance and Property:Has subclass are still useful. On the category page itself instances and subclasses are shown as articles and subcategories in the category, but on other pages the category feature does not provide this info. "Has instance" tags at the lowest class level may even be more useful than the corresponding category tags at the instance pages (the category is then shown as query result).
Currently there are still pages in the main namespace which each represent a class, see e.g. the objects of Property:Instance of and both the subjects and objects of Property:Subclass of.
For several of these classes there is also a category, see Property:Category about.
See also:
[edit] Attribute
Although an attribute can have many values, we can also use an attribute for the answer to a yes/no question, e.g. of type string with value "v" for "yes" and undefined for "no". There may be additional possible values such as "partly". With this method, in a query result table the column focuses on the required property, and does not also show other properties. This can be an advantage or a disadvantage. Examples:
- Property:Fictional:
- value "v": the page represents a fictional person, animal, or thing, or a class of them
- undefined: all other cases
- Property:Located in Europe:
- value "v": country, city, class of one of these, etc. is fully in Europe
- value "partly": country, city, object, class of one of these, etc. is partly in Europe
- undefined: all other cases (i.e., not applicable or fully outside Europe)
- Property:Query results link to properties (for pages within Category:Semantic MediaWiki wiki)
- v = yes
- - = no
- undefined = not checked yet
Whether an annotation for "no" is useful and practical varies.
[edit] Advantages of a category
A category page provides sections by first letter.
Multiple categories, as compared with one relation, have the advantage that Special:Categories shows the number of members of each while Special:Relations only gives the total for the relation. Of course we can also replace each category by a separate relation.
In a query we can use a selection like "Category:Located in Europe||Overlaps Europe". Compare this with the fact that with relations, although we can take a union of objects, as in located in::Europe||Asia, we cannot take a union of selections involving two relations, such as located in::Europe and overlaps::Europe.
Suppose there are n disjoint categories, then for each of the 2^n - 1 non-empty subsets of the set of categories, the selection in a query can be the union of the pages in that subset of categories. Compare this with using a single attribute with n values: with :=+, equalities and inequalities, we have 3n - 3 possible selections (n>1), which for n>2 is less.
[edit] Advantages of a relation
In the case of a relation, we can also relate to a page in the main namespace. This avoids the duplication of having e.g. pages Continent and Category:Continent, or Fictional person and Property:Fictional. The query table directly links to this page in the main namespace, while in the other cases it links to the category page or attribute page only.
- Note: Directly relating content pages can also be achieved with the category system by not using the main namespace, but putting all content in the category namespace. However, this somewhat clutters the titles of the pages and makes linking more cumbersome.
All instances of e.g. Property:Instance of can be produced by one query, either alphabetically, or sorted by the object of the relation. Thus we can ask an open question "Of what is this an instance?" instead of a yes/no question "Is this an instance of ...?".
[edit] Advantages of an attribute with simple values
In a query result table the table column only needs a small width if we use a short header (if needed with a legend before or after the table).
In addition to info representing "yes" and "no" we can have "partly", etc.
In the case of two values, e.g. "v" and "partly" (in addition to undefined) we can use the attribute for any selection, with :=+, :=v, and :=partly. In the case of more than two values we can choose the values such that the most desired selections can be done, if not with an equality, with an inequality. For example, if there are three values, 6 of the 7 selections are possible with :=*, an equality, or an inequality; if there are four values, 9 of the 15.
Compare this with the fact that we can not take the union of e.g. selections located in::Europe and overlaps::Europe.
[edit] Union
Compare:
- <ask>Category:continent</ask> gives !, !Main, !Main, !Main-c, Faisal Alkhateeb, 'n Beetje Verliefd, ( 31) - 20 - 598 7731/7483, (+31) - 20 - 598 7678, (+44)(0)114 222 1891, (+44-161) 275-6176, (+45) 4674 3835, (302) 831-1959, (306) 585-5226, (310) 448-8472, (33)4 67 41 85 79, (33-1) 40 27 22 53, (351)911085353, (404) 3851139, (407) 380-1200, (412) 266-2492, (412) 268-5477, (509) 372-4946, (610) 758-6533, (617)440-4364, (65)6790-4802, (650) 723-6725, (650) 723-9770, (650) 859-6153, (805) 523-0193, (814) 865-6460, (animated), (testing 2), (testing), *, ++31 (0) 20 - 598 7753, ++49681/302-5358, +1 (215) 898-2665, +1 (650) 859-6058, +1 (703) 669 5510, +1 000 000 8080, +1 302.463.1354, +1 412 268 1357, +1 415 555 1212, +1 425 785 9995, +1 507-5388384, +1 613-321-2043, +1 617 258 6167, +1 951 710 1861, +1(973)386-6695, and +1-410-455-2590 … further resultswarning.pngThe part "Category:" of the query was not understood.
Results might not be as expected. The part "continent" of the query was not understood. Results might not be as expected. Some subquery has no valid condition.
- <ask>instance of::continent</ask> gives <a sk>instance of::continent</ask>
- <ask>Category:continent||country</ask> gives <a sk>Category:continent||country</ask>
- <ask>instance of::continent||country</ask> gives <a sk>instance of::continent||country</ask>
- <ask sort="instance of">instance of::continent||country</ask> gives <a sk sort="instance of">instance of::continent||country</ask>
A union of a category and a set of subjects relating to a given object is not possible. Therefore, if one wants the possibility to take a union one has to use two categories, or two objects with the "instance of" relation, not one of each.
[edit] Redirect
A redirect to a category works, but the target does not show the subcategories and pages in the redirect page (if that is also a category).
[edit] Category template
Instead of directly putting a category tag in a member page it is often useful to call a template that puts the tag. This template can then also be used for other common content of the members of the category, e.g. category-specific queries: it can be a category-specific version of Template:ask (talk, backlinks, edit).
The category tag is put inside includeonly tags. The category links to the template with Property:Category added by template.
A complication is the possible duplication if a page is in multiple categories. If several pages are in the same two categories C and D a separate template can be used for the combination. This template can either call C or D, say C, and in addition contain the content of D - C.
[edit] See also
- Special:Categories
- Special:Mostlinkedcategories
- Special:Mostcategories
- Special:Uncategorizedcategories
- Special:Uncategorizedimages
- Special:Uncategorizedpages
- Special:Unusedcategories - "usused" is not quite an adequate term, since a category is used for a class, regardless of having pages for instances; besides, Property:Has instance can be used on the category page to indicate members; this can be done in addition to adding the category tag to each member page, but it can also be done as alternative.
- Special:Wantedcategories
- feature request to show whether a page belongs to a category
- discussion of possible new features: type boolean and type enumerated
User space unless indicated otherwise:
annotation | ask | Help:Attribute name | Help:Browsing and searching | category | Help:Chains of relations and attributes | Help:Custom units | Help:Namespace | Help:Relation name | selection | Help:SearchTriple | sorting | Help:Templates in SMW | this page on sandbox.semantic-mediawiki.org | this page on Wikible
