Help:Import vocabulary/Step-by-step on how to import a vocabulary
Import vocabulary | |
---|---|
A step-by-step guide on how to import a vocabulary | |
Table of Contents | |
In this section, we will have a look at this example: http://sandbox.semantic-mediawiki.org/wiki/John_Doe.
Vocabulary page[edit]
Create the vocabulary page, like this one: http://sandbox.semantic-mediawiki.org/wiki/MediaWiki:Smw_import_foaf
Apart of describing the vocabulary base URI, the project URL and its name, it is necessary to set the types of all properties you want to use. Moreover, if you want to import classes as well, you have to state them as 'Category type' (Category is not a datatype in SMW, we have to use it just to tell SMW that what is there is not a property).
The page name has to follow the standard:
MediaWiki:Smw_import_[vocabulary prefix]
Important: By default, the MediaWiki namespace is protected (only sysadmins can edit it).
Property page[edit]
Create the property page for each property you declared in MediaWiki:Smw_import_[vocabulary prefix]
, for instance: http://sandbox.semantic-mediawiki.org/wiki/Property:Foaf:knows
If you want to, the page name can follow the standard:
Property:[vocabulary prefix]:[property name]
but it is not required. You can name your property page with any name permitted for a property page in a SMW wiki.
In the property page, you have to inform SWM that this is an imported property from an external vocabulary. This is done via the Imported from special property declaration:
[[Imported from::foaf:knows]]
Category page[edit]
Create the category page for each class you declared in MediaWiki:Smw_import_[vocabulary prefix]
, for instance: http://sandbox.semantic-mediawiki.org/wiki/Category:Foaf:Person
If you want to, the page name can follow the standard:
Category:[vocabulary prefix]:[Class name]
but it is not required. You can name your category page with any name permitted for a category page in a MediaWiki wiki.
In the category page, you have to inform SWM that this is an imported class from an external vocabulary. This is done via the Imported from special property declaration:
[[Imported from::foaf:Person]]
Vocabulary use[edit]
Now, you can use the vocabulary (properties and classes) in your wiki, using the standard syntaxes for properties and categories annotation, for example: http://sandbox.semantic-mediawiki.org/wiki/John_Doe
To view the RDF output format with your properties and classes declarations, you can use [[Special:ExportRDF/{{FULLPAGENAME}}|RDF format]]
on the page.