RDF in Semantic Mediawiki: Difference between revisions

From artserver wiki
No edit summary
No edit summary
Line 55: Line 55:


==Classes==
==Classes==
As it is visible in [[MediaWiki:Smw_import_foaf]] the properties [[Property:Foaf:person]] and [[Property:Foaf:organization]] have both '''Category as their type''', which is not a [https://www.semantic-mediawiki.org/wiki/Help:List_of_datatypes SMW data types].
As it is visible in [[MediaWiki:Smw_import_foaf]] the entries '''Person''' and '''Organization'''  both have'''Category 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]].


The reason they have Category as data types is because ''' SMW uses category to define properties which in the Semantic Web ontogies are considered classes.
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." <ref>https://www.w3.org/TR/rdf-schema/#ch_type</ref>
'''


?? In SMW a class is page It is  a thing.
?? Create category pages for the properties containing the '''Datatype Category'''


<blockquote>
<blockquote>
An RDF class is defined as the set of its instances. Consider the class of abstract ideas. Members – instances – of that set include love, honour, duty, pi, evolution, etc. This view of a class is a mathematical concept, so the set of abstract ideas is both an idea and quite abstract, so therefore is itself an instance, or member, of the class abstract ideas. More prosaically, if a class is a set of things, then RDFS classes both denote sets of things, and are themselves instances of the set of all classes, aka rdfs:Class.<ref>https://stackoverflow.com/questions/6472043/instances-vs-classes-in-rdfs</ref>
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.<ref>http://www.linkeddatatools.com/introducing-rdfs-owl</ref></blockquote>
</blockquote>


The FOAF specification<ref>http://xmlns.com/foaf/spec/#sec-crossref</ref> stipulates the following classes: <code>Agent | Document | Group | Image | LabelProperty | OnlineAccount | OnlineChatAccount | OnlineEcommerceAccount | OnlineGamingAccount | Organization | Person | PersonalProfileDocument | Project
</code> out of which the [[MediaWiki:Smw_import_foaf]] uses Person and Organization.


Containing the Property::value pair


<nowiki>[[Imported from::foaf:Person]]</nowiki>
<nowiki>[[Imported from::foaf:Person]]</nowiki>

Revision as of 15:07, 30 April 2020

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

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.

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