RDF in Semantic Mediawiki

From artserver wiki

Notes on importing ontologies to SMW

How to importing ontology?

The documentation on importing existing ontologies to SMW in its Manual Section Help:Import_vocabulary

MediaWiki:Smw_import

To import existing Semantic Web ontologies SMW uses the MediaWiki:Smw_import_ONTOGOLOGYNAME pages, such as MediaWiki:Smw_import_foaf for the Friend Of A Friend ontology.

SMW manual mentions the following ontologies, some of which are already present in SMW instances, others need to be create from the examples provided by the SMW manual:

I will be adding and making use of in this wiki of the foaf ontology.


Property pages

Each one of the properties listed in the MediaWiki:Smw_import_XYZ page has to be created with the following template

* [[Imported from::ONTOLOGYNAME:PROPERTY]] 
* [[Has property description::DESCRIPTION OF PROPERTY.@langcode]] 

[[Category:Imported vocabulary]]{{DISPLAYTITLE:ONTOLOGYNAME:PROPERTY}}


As for instance the Property:foaf:name:

* [[Imported from::foaf:name]] 
* [[Has property description::A name for some thing or agent.@en]] 

[[Category:Imported vocabulary]]{{DISPLAYTITLE:foaf:name}}

Note in that Property page that the Property Type is not declared on this page, but its assignment is done at the ontology import page

Because it can be quite tedious to create all those Property pages manually we can resort to scripts which create wiki pages, by interaction with the Mediawiki API [1]

After the Properties have been created ensure to run MW's scripts:

  • maintenance/runJobs.php to run pending jpbs
  • maintenance/update.php since we made change to Property types


The created Properties should be visible in Special:Properties

Classes == Categories

As it is visible in MediaWiki:Smw_import_foaf the entries Person and Organization both haveCategory as their type, which makes them not a Property but a Category. And as a result they do not have property pages but category pages: Category:Person, Category:Organization.


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]]

Why Categories?

The reason they are Categories is because SMW uses categories to state that something is an element of a class, as categories are mapped internally as rdf:type.. In Semantic Web ontologies classes create semantic classification groupings. And according to the RDF Schema" "rdf:type is an instance of rdf:Property that is used to state that a resource is an instance of a class." [2]


A class in OWL is a classification of individuals into groups which share common characteristics. If an individual is a member of a class, it tells a machine reader that it falls under the semantic classification given by the OWL class.[3]

The FOAF specification[4] stipulates the following classes: Agent | Document | Group | Image | LabelProperty | OnlineAccount | OnlineChatAccount | OnlineEcommerceAccount | OnlineGamingAccount | Organization | Person | PersonalProfileDocument | Project out of which the MediaWiki:Smw_import_foaf uses Person and Organization.


[[Imported from::foaf:Person]]

Desambiguation

Classes in RDF and SMW