Difference between revisions of "Help:SemanticMW import external vocabulary"

From Biowikifarm Metawiki
Jump to: navigation, search
(Import vocabulary)
(Import vocabulary)
Line 7: Line 7:
 
An example of this functionality is the use of the FOAF vocabulary in the TestWiki. Although the associated terms work like any other annotation in the
 
An example of this functionality is the use of the FOAF vocabulary in the TestWiki. Although the associated terms work like any other annotation in the
 
wiki, the RDF that is exported will directly use the elements of the FOAF specification, thus allowing users to edit FOAF files through the wiki.
 
wiki, the RDF that is exported will directly use the elements of the FOAF specification, thus allowing users to edit FOAF files through the wiki.
 +
 +
Importing an external vocabulary into a SMW property consists on three steps:
 +
 +
==Making vocabularies available for import==
 +
* The page is in the Mediawiki namespace with the prefix smw_import_.
 +
'''Create''' an entry in MediaWiki namespace having the following format:
 +
 +
Mediawiki:Smw_import_'''''vocabulary_name'''''
 +
 +
where '''''service_name''''' is a given name for the service. The first part of the new created service name is mandatory prefixed by 
 +
''Mediawiki:Smw_import_''
 +
For example, the page for the foaf vocabulary is named MediaWiki:smw_import_foaf.
 +
 +
* '''edit''' the new page and insert vocabulary elements having the following format:
 +
 +
http://xmlns.com/foaf/0.1/|[http://www.foaf-project.org/ Friend Of A Friend]
 +
name|Type:String
 +
homepage|Type:URI
 +
Person|Category
 +
knows|Type:Page
 +
.......
 +
 +
*# '''save''' the page.
 +
 +
==Create property or modify an existing one==
 +
 +
* Create a SMW Property. When the Property already exists, edit it and add the vocabulary element to the property as follows:
 +
 +
This is a property of type <nowiki>[[has type::</nowiki>'''''Element type'''''<nowiki>|Element type]]</nowiki>
 +
 +
and is imported from
 +
<nowiki>[[imported from::foaf:vocabulary_element]] </nowiki>
  
 
The names of the selected pages, without namespace prefix, are either shown automatically in query results, or optionally by specifying mainlabel.
 
The names of the selected pages, without namespace prefix, are either shown automatically in query results, or optionally by specifying mainlabel.
Line 12: Line 44:
  
  
Applications of attribute '''FoafName''' include:
+
Applications of Property '''FoafName''' include:
  
 
*the name deviates from the pagename without namespace prefix, e.g.
 
*the name deviates from the pagename without namespace prefix, e.g.
Line 26: Line 58:
  
 
Formally, ''FoafName'' is represented by the [http://xmlns.com/foaf/0.1/ FOAF] property <nowiki>[[imported from::foaf:name]]</nowiki>.
 
Formally, ''FoafName'' is represented by the [http://xmlns.com/foaf/0.1/ FOAF] property <nowiki>[[imported from::foaf:name]]</nowiki>.
 +
 +
*Save the Property page.
 +
 +
==Property usage==
 +
 +
The property could be used as any other property. Use the new created property in a wiki page as:
 +
 +
<nowiki>[[FoafName::somename]]</nowiki>
 +
 +
When this page will be exported as RDF, the property will appare like:
 +
 +
......
 +
 +
<foaf:name rdf:datatype="http://www.w3.org/2001/XMLSchema#string">somename</foaf:name>
 +
 +
......
 +
 +
  
 
[[Category:Help]]
 
[[Category:Help]]
 
[[Category:Extensions]]
 
[[Category:Extensions]]

Revision as of 14:00, 21 April 2010

Help sections
Contents · Semantic MediaWiki · Semantic Forms
Add Ontology · Semantic links and import/export features · Import external vocabulary
Other SemanticMW extensions · Other extensions



In Semantic MediaWiki it is possible to import and reuse controlled vocabulary that belongs to existing Semantic Web documents or standards by associating the vocabulary's elements with wiki terms.

Import vocabulary

An example of this functionality is the use of the FOAF vocabulary in the TestWiki. Although the associated terms work like any other annotation in the wiki, the RDF that is exported will directly use the elements of the FOAF specification, thus allowing users to edit FOAF files through the wiki.

Importing an external vocabulary into a SMW property consists on three steps:

Making vocabularies available for import

  • The page is in the Mediawiki namespace with the prefix smw_import_.

Create an entry in MediaWiki namespace having the following format:

Mediawiki:Smw_import_vocabulary_name 

where service_name is a given name for the service. The first part of the new created service name is mandatory prefixed by Mediawiki:Smw_import_ For example, the page for the foaf vocabulary is named MediaWiki:smw_import_foaf.

  • edit the new page and insert vocabulary elements having the following format:
http://xmlns.com/foaf/0.1/%7CFriend Of A Friend
name|Type:String
homepage|Type:URI
Person|Category
knows|Type:Page
.......
    1. save the page.

Create property or modify an existing one

  • Create a SMW Property. When the Property already exists, edit it and add the vocabulary element to the property as follows:
This is a property of type [[has type::Element type|Element type]]
and is imported from 
[[imported from::foaf:vocabulary_element]] 

The names of the selected pages, without namespace prefix, are either shown automatically in query results, or optionally by specifying mainlabel. Names are [[has type::String|strings]].


Applications of Property FoafName include:

  • the name deviates from the pagename without namespace prefix, e.g.
    • it is the full name while the pagename is a short form
    • it includes the namespace prefix (we can also use the separate [[Attribute:Ns]])
    • it starts with a lowercase letter
  • selection with an inequality


Formally, FoafName is represented by the FOAF property [[imported from::foaf:name]].

  • Save the Property page.

Property usage

The property could be used as any other property. Use the new created property in a wiki page as:

[[FoafName::somename]]

When this page will be exported as RDF, the property will appare like:

......
<foaf:name rdf:datatype="http://www.w3.org/2001/XMLSchema#string">somename</foaf:name>
......