Help:SemanticMW import external vocabulary

From Biowikifarm Metawiki
Revision as of 08:45, 10 October 2011 by Andreas Plank (Talk | contribs) (adjusted named terms)

Jump to: navigation, search
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:

(1) 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_local-defined-namespace 

where local-defined-namespace is the case sensitive “short cut”, that tells SMW about vocabularies being imported. 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:
              RDF source                  e.g. documentation page
              ↓                            ↓
1  http://xmlns.com/foaf/0.1/|[http://www.foaf-project.org/ Friend Of A Friend]
2  name|Type:String
3  homepage|Type:URI
4  Person|Category
5  knows|Type:Page
6 
  • save the page.

(2) Create a property or modify an existing one

Create a property page and tell SMW about the imported vocabulary element. When it already exists, modify it and add the imported 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::local-defined-namespace:original-vocabulary-term]] 

For example in the page Property:FoafName:

This is a property of type [[has type::String|strings]]
and is imported from [[imported from::foaf:name]].

Now the RDF Export of this property includes a rdf:about-line and the “foaf:name” of the import definition ([[importedfrom::foaf:name]]) becomes:

<!DOCTYPE rdf:RDF><owl:ObjectProperty rdf:about="http://xmlns.com/foaf/0.1/name">

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

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.

(3) 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>
......

Changing import statements

It can easily happen that some existing article of the wiki should be modified to represent (another) imported concept. For example, a wiki community that already uses a category "Person" might decide to map this category to "foaf:Person" in the future. Import statements in existing articles can be changed at any point in time without requiring additional updates in the wiki. The exported RDF will immediately be modified accordingly.

Use cases

Import Dublin Core terms

An example of vocabulary import is:

http://purl.org/dc/terms/|[http://purl.org/dc/terms/ dcterms]
Policy|Category
isVersionOf|Type:Page
tableOfContents|Type:Page
FileFormat|Category
publisher|Type:Page
PeriodOfTime|Category
relation|Type:Page
MediaTypeOrExtent|Category
rightsHolder|Type:Page
coverage|Type:Page
type|Type:Page
URI|Type:Page
MethodOfAccrual|Category
LCSH|Type:Page
mediator|Type:Page
extent|Type:Page
Point|Type:Page
hasFormat|Type:Page
LocationPeriodOrJurisdiction|Category
LinguisticSystem|Category
creator|Type:Page
DDC|Type:Page
available|Type:Text
identifier|Type:Text
accrualMethod|Type:Page
rights|Type:Page
PhysicalMedium|Category
spatial|Type:Page
accessRights|Type:Page
Jurisdiction|Category
description|Type:Page
ProvenanceStatement|Category
RFC3066|Type:Page
TGN|Type:Page
modified|Type:Text
conformsTo|Type:Page
license|Type:Page
dateCopyrighted|Type:Text
RightsStatement|Category
subject|Type:Page
date|Type:Text
Standard|Category
isReferencedBy|Type:Page
Box|Type:Page
temporal|Type:Page
requires|Type:Page
dateAccepted|Type:Text
hasPart|Type:Page
UDC|Type:Page
references|Type:Page
Frequency|Category
BibliographicResource|Category
dateSubmitted|Type:Text
Agent|Category
isFormatOf|Type:Page
RFC1766|Type:Page
contributor|Type:Page
RFC4646|Type:Page
replaces|Type:Page
accrualPolicy|Type:Page
audience|Type:Page
MESH|Type:Page
hasVersion|Type:Page
isRequiredBy|Type:Page
medium|Type:Page
LCC|Type:Page
accrualPeriodicity|Type:Page
MediaType|Category
DCMIType|Type:Page
AgentClass|Category
bibliographicCitation|Type:Text
isReplacedBy|Type:Page
format|Type:Page
LicenseDocument|Category
alternative|Type:Page
valid|Type:Text
provenance|Type:Page
language|Type:Page
SizeOrDuration|Category
educationLevel|Type:Page
created|Type:Text
ISO639-2|Type:Page
ISO639-3|Type:Page
ISO3166|Type:Page
isPartOf|Type:Page
IMT|Type:Page
title|Type:Page
issued|Type:Text
PhysicalResource|Category
MethodOfInstruction|Category
instructionalMethod|Type:Page
Period|Type:Page
W3CDTF|Type:Page
source|Type:Page
abstract|Type:Page
Location|Category
NLM|Type:Page

See also: Import dcterms