Difference between revisions of "Help:SemanticMW import external vocabulary"
m (+docu) |
m (+Category:Semantic Mediawiki; +Category:Import using HotCat) |
||
(3 intermediate revisions by the same user not shown) | |||
Line 10: | Line 10: | ||
Importing an external vocabulary into a SMW property consists on three steps: | Importing an external vocabulary into a SMW property consists on three steps: | ||
− | ==Making vocabularies available for import== | + | ===(1) Making vocabularies available for import=== |
The page is in the Mediawiki namespace with the prefix smw_import_. | The page is in the Mediawiki namespace with the prefix smw_import_. | ||
* '''create''' an entry in MediaWiki namespace having the following format: | * '''create''' an entry in MediaWiki namespace having the following format: | ||
− | Mediawiki:Smw_import_''''' | + | Mediawiki:Smw_import_'''''local-defined-namespace''''' |
− | where ''''' | + | where '''''local-defined-namespace''''' is the case sensitive “short cut”, that tells {{abbr|SMW}} about vocabularies being imported. The first part of the new created service name is mandatory prefixed by |
''Mediawiki:Smw_import_'' | ''Mediawiki:Smw_import_'' | ||
For example, the page for the foaf vocabulary is named MediaWiki:smw_import_foaf. | 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: | * '''edit''' the new page and insert vocabulary elements having the following format: | ||
− | < | + | <pre style="border:0px none;margin:0px;"> |
− | + | RDF source e.g. documentation page | |
↓ ↓ | ↓ ↓ | ||
+ | </pre><!-- | ||
+ | --><syntaxhighlight lang="text" line start="1"> | ||
http://xmlns.com/foaf/0.1/|[http://www.foaf-project.org/ Friend Of A Friend] | http://xmlns.com/foaf/0.1/|[http://www.foaf-project.org/ Friend Of A Friend] | ||
name|Type:String | name|Type:String | ||
Line 34: | Line 36: | ||
* '''save''' the page. | * '''save''' the page. | ||
− | ==Create a property or modify an existing one== | + | ===(2) Create a property or modify an existing one=== |
'''Create''' a property page and tell {{abbr|SMW}} about the imported vocabulary element. When it already exists, modify it and add the imported vocabulary element to the property as follows: | '''Create''' a property page and tell {{abbr|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 <nowiki>[[has type::</nowiki>'''''Element type'''''<nowiki>|Element type]]</nowiki> | + | This is a property of type <nowiki>[[has type::</nowiki>'''''[http://biowikifarm.net/test/Special:Types Element type]'''''<nowiki>|Element type]]</nowiki> |
− | and is imported from <nowiki>[[imported from::</nowiki>''''' | + | and is imported from <nowiki>[[imported from::</nowiki>'''''local-defined-namespace''''':original-vocabulary-term]] |
For example in the page '''Property:FoafName''': | For example in the page '''Property:FoafName''': | ||
Line 44: | Line 46: | ||
and is imported from <nowiki>[[imported from::foaf:name]]</nowiki>. | and is imported from <nowiki>[[imported from::foaf:name]]</nowiki>. | ||
− | Now the [[Special:ExportRDF|RDF Export]] of this property includes a | + | Now the [[Special:ExportRDF|RDF Export]] of this property includes a rdf:about-line and the “foaf:name” of the import definition (<nowiki>[[importedfrom::foaf:name]]</nowiki>) becomes: |
<syntaxhighlight lang="xml" > | <syntaxhighlight lang="xml" > | ||
<!DOCTYPE rdf:RDF> | <!DOCTYPE rdf:RDF> | ||
Line 68: | Line 70: | ||
*'''Save''' the Property page. | *'''Save''' the Property page. | ||
− | ==Property usage== | + | ===(3) Property usage=== |
The property could be used as any other property. Use the new created property in a wiki page as: | The property could be used as any other property. Use the new created property in a wiki page as: | ||
Line 189: | Line 191: | ||
[[Category:Help]] | [[Category:Help]] | ||
+ | [[Category:Semantic Mediawiki]] | ||
+ | [[Category:Import]] |
Latest revision as of 13:23, 26 January 2015
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.
Contents
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