Help:Import vocabulary (Vocabulary definition)

Wiki-users with the appropriate administrative rights (requires write access to the MediaWiki namespace) can add new elements by simply editing a specific page for each vocabulary the match the "magic" name. This help page explains how vocabulary definitions are created.

The page is placed in the "Mediawiki" namespace with the prefix smw_import_ and as an example the page for the FOAF vocabulary is named MediaWiki:smw_import_foaf. It contains something like

http://xmlns.com/foaf/0.1/|Friend Of A Friend name|Type:Text homepage|Type:URI Person|Category knows|Type:Page ...

The first line tells the wiki that
 * the abbreviation "foaf:" refers to "http://xmlns.com/foaf/0.1/" and that
 * "Friend Of A Friend" should be given as an additional human-readable label for elements of this vocabulary (e.g. in the factbox).

After this, there is a line that declares each vocabulary element that can be reused within the wiki. For instance, "name" (referring to "foaf:name") can only be a property of. The text after the "|" declares the (unique) context in which some element can be used. Elements that can be imported as properties are declared by specifying their type with Type:some datatype, elements that can be imported as categories are declared by specifying the "Category" namespace identifier. (Note that in the type and namespace depends on your language setting!). Moreover, one can also declare other elements by writing anything else than the above; however, we strongly recommend you use one meaningful string; we suggest "Main", although you can use such elements in namespace other than "Property" and "Category" as well.

Strict typing
Imported vocabularies expect a type definition (except Categories those are mapped as ) which means a definition (in MediaWiki:Smw_import_yyy) is required a type to describe a qualified imported vocabulary.

For example, the property foaf:name is declared as a through the assignment found in it's import statement. 

Invalid type declaration
If for some reason a type declaration is invalid or incomplete then will produce an invalid XML CiteRef::gh:smw:1488 and it is recommended to run  or to make a null edit on a specific property to correct possible incorrect assignments.