Help:Property naming

The naming of properties is more important than one would probably expect at first. Property names should avoid ambiguity and confusion. Thus, it is good practice to create property names as a verb phrase. Here's an example that uses Berlin and Germany to makes this practice more comprehensible:

Germany's capital is Berlin. ↔ Berlin is the capital of Germany.

In both cases one could assign a property named "Capital", but this does not convey exactly the intended meaning. The first sentences says that Germany has a capital called Berlin. Therefore the better name for the property is "Has capital": Germany's capital is Has capital::Berlin.

The second sentence states that Berlin is the capital of Germany. Hence the better name for the property is "Is capital of" in this case. So the annotation avoiding ambiguity is as follows: Berlin is the capital of Is capital of::Germany.

Note that in the first case "Has capital" is a property of "Germany" with value "Berlin" whereas in the second case "Is capital of" is a property of "Berlin" with value "Germany".

Avoid reserved names
For technical reasons reserved names cannot or should not be used.CiteRef::gh:smw:2835 Reserved names identify a special kind of syntax or represent magic words, special pages, behaviour switches, namespaces etc. These are defined for MediaWikiCiteRef::mw:languages.messages.MessagesEn.php, Semantic MediaWikiCiteRef::smw:i18n.extra.en.json and any other software that may be use as an extension for both. Thus it is advisable or even required to avoid too generic names like e.g. "category"; use "Belongs to category" instead. brought which provides an extendable list of reserved names which will cause warnings to be shown to the user if a reserved name is being used.CiteRef::gh:smw:2840

Avoid using the name of a datatype
For technical reasons a property name should not be the same as the name of one of the datatypes. So an annotation like e.g.  will not serve the intended purpose, since the assigned datatype will always be "Code" and cannot be changed to "Text". However, to name the property "Is registration code" or something alike is the better alternative for this in the first place anyway.

Avoid using certain kinds of punctuation
Certain kinds of punctuation are to be avoided or have been declared invalidCiteRef::gh:smw:2282 in property names, because they are also used as special syntax in semantic queries or they may cause problems for other reasons.


 * Examples
 * (two subsequent colons) − a single colon should not cause any trouble
 * (hyphen) in initial position − for reasons to do with inverse properties
 * (dot) − operator used to link properties in concatenationCiteRef::gh:smw:676
 * (pipe)
 * (number sign) − for since it is interpreted as part of a subobject declaration.CiteRef::gh:smw:1087:123476927 CiteRef::gh:smw:1568

Best practice

 * Use a verb phrase (recommended) to describe a property
 * Use short names. Some Result formats like CSV or JSON put property names in URLs with API calls. In case you have a lot of/long property names the resulting URLs can become too long resulting in a call to the page Special:Ask instead of delivering a CSV or JSON file.
 * "Style Guidelines for Naming and Labeling Ontologies in the Multilingual Web" CiteRef::montiel2011style contains some general guidelines how to name properties and URI's