Help:Import vocabulary (Vocabulary definition)

From semantic-mediawiki.org
Jump to: navigation, search
Import vocabularyHelp: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.

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/|[http://www.foaf-project.org/ Friend Of A Friend]
 name|Type:Text
 homepage|Type:URI
 Person|Category
 knows|Type:Page
 ...

The first line tells the wiki that

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 datatype Text. 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 SMW 1.0 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 rdf:type) 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 text through the assignment found in its import statement.

Invalid type declaration

If for some reason a type declaration is invalid or incomplete then the ExportRDF will produce an invalid XML 1 and it is recommended to run rebuildData.php or to make a null edit on a specific property to correct possible incorrect assignments.


References

  1. ^  1488 "ExportRDF produces XML Parsing Error: « xmlns:="" »"