Difference between revisions of "Help:SemanticMW Service links"
(13 intermediate revisions by the same user not shown) | |||
Line 4: | Line 4: | ||
Factbox and in property pages. For example, when an article contains a geographic coordinate, like Geocoordinate property from [[K2N template::Template:Metadata]] has, it is useful to provide links to online mapping services so that users can retrieve a map of that location with one click. An other useful example is provided by ETI thesaurus service and further it will pointed out how to use this service in relation with a Semantic MediaWiki (SMW) property. | Factbox and in property pages. For example, when an article contains a geographic coordinate, like Geocoordinate property from [[K2N template::Template:Metadata]] has, it is useful to provide links to online mapping services so that users can retrieve a map of that location with one click. An other useful example is provided by ETI thesaurus service and further it will pointed out how to use this service in relation with a Semantic MediaWiki (SMW) property. | ||
Attaching an external service to a SMW property consists on three steps: | Attaching an external service to a SMW property consists on three steps: | ||
− | + | ==Providing service links== | |
− | * | + | * '''Create''' an entry in MediaWiki namespace having the following format: |
− | Mediawiki: | + | Mediawiki:Smw_service_'''''service_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_service_'' | |
+ | * '''edit''' the new page and insert services provided having the following format: | ||
+ | label text1|http://someurl.com | ||
+ | label text2|http://anotherurl.org | ||
+ | ....... | ||
+ | For every service, it might be necessary to add typed parameters. See bellow how to add parameters [[Help:SemanticMW_Service_links#Parameter_usage_in_service_links]]. | ||
+ | *# '''save''' the page. | ||
+ | Following these steps have been created the service to accessing ETI thesaurus: | ||
+ | http://biowikifarm.net/test/MediaWiki:Smw_service_ETI_thesaurus | ||
+ | ETI thesaurus|http://www.catalogueoflife.org/annual-checklist/2010/webservice?response=full&name=$1 | ||
+ | ETI thesaurus ID|http://www.catalogueoflife.org/annual-checklist/2010/webservice?response=full&format=xml&id=$1 | ||
+ | |||
+ | ==Create property or modify an existing one== | ||
+ | |||
+ | Create a SMW Property. When the Property already exists, edit it and add the service to the property as follows: | ||
+ | |||
+ | <nowiki>[[Provides service::</nowiki>'''''service_name'''''<nowiki>]]</nowiki> | ||
+ | |||
+ | For ETI thesaurus service: | ||
+ | |||
+ | <nowiki>[[Provides service::ETI thesaurus]]</nowiki> | ||
+ | |||
+ | Save the Property page. | ||
+ | |||
+ | ==Property usage== | ||
+ | |||
+ | |||
+ | Following previous steps, the Property with attached service could be used as usually. When the factbox or browse property will be called, for this property a special sign will be shown near (question sign). On clicking on this sign, the service names, separate by comma, will be available on a separate window as links. On following one of these services the parameters from property values will be transmited automatic. See bellow. | ||
+ | |||
+ | ETI thesaurus, | ||
+ | ETI thesaurus ID | ||
+ | |||
+ | Par example, following the first link, the ETI thesaurus service will be questioned to return all about ''Galium odoratum'', when this service is attached to "Scientific Name" property. | ||
+ | |||
+ | http://www.catalogueoflife.org/annual-checklist/2010/webservice?response=full&name=Galium%20odoratum | ||
+ | |||
+ | ==Parameter usage in service links== | ||
+ | |||
+ | The number and contents of the parameters that replace $1, $2, $3, ... depend on the | ||
+ | ''datatype'' of the property. For instance, a simple integer property replaces $1 with its | ||
+ | value, whereas a geographic coordinate provides parameters for latitude, longitude, di- | ||
+ | rection, and much more. In most cases, $1 is the most relevant parameter that just pro- | ||
+ | vides a URL-safe string version of the property value. | ||
+ | '''Type:Page''' | ||
+ | $1: URL-encoded article name (no namespace), with underscores replaced by | ||
+ | spaces | ||
+ | '''Type:Number''' (and types with custom units) | ||
+ | $1: numerical value in English punctuation | ||
+ | $2: integer version of value, in English punctuation | ||
+ | $3: From SMW version 1.1 onwards unit, if any. | ||
+ | '''Type:String''' (but not Type:Text) | ||
+ | $1: URL-encoded string | ||
+ | '''Type:URL, Type:Annotation URI and Type:Email''' | ||
+ | $1: URL-encoded value of the URL(includes mailto: for Type:Email) | ||
+ | '''Type:Geographic coordinate''' | ||
+ | $1: latitude integer degrees | ||
+ | $2: longitude integer degrees | ||
+ | $3: latitude integer minutes | ||
+ | $4: longitude integer minutes | ||
+ | $5: latitude integer seconds | ||
+ | $6: longitude integer seconds, | ||
+ | $7: latitude direction string (N or S) | ||
+ | $8: longitude direction string (W or E) | ||
+ | $9: latitude in decimal degrees | ||
+ | $10: longitude in decimal degrees | ||
+ | $11: sign (- if south) for latitude | ||
+ | $12: sign (- if west) for longitude | ||
[[Category:Help]] | [[Category:Help]] | ||
− |
Latest revision as of 15:01, 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 |
Semantic MediaWiki can provide links to online services when displaying certain data in the
Factbox and in property pages. For example, when an article contains a geographic coordinate, like Geocoordinate property from Template:Metadata has, it is useful to provide links to online mapping services so that users can retrieve a map of that location with one click. An other useful example is provided by ETI thesaurus service and further it will pointed out how to use this service in relation with a Semantic MediaWiki (SMW) property.
Attaching an external service to a SMW property consists on three steps:
Contents
Providing service links
- Create an entry in MediaWiki namespace having the following format:
Mediawiki:Smw_service_service_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_service_
- edit the new page and insert services provided having the following format:
label text1|http://someurl.com label text2|http://anotherurl.org .......
For every service, it might be necessary to add typed parameters. See bellow how to add parameters Help:SemanticMW_Service_links#Parameter_usage_in_service_links.
- save the page.
Following these steps have been created the service to accessing ETI thesaurus:
http://biowikifarm.net/test/MediaWiki:Smw_service_ETI_thesaurus
ETI thesaurus|http://www.catalogueoflife.org/annual-checklist/2010/webservice?response=full&name=$1 ETI thesaurus ID|http://www.catalogueoflife.org/annual-checklist/2010/webservice?response=full&format=xml&id=$1
Create property or modify an existing one
Create a SMW Property. When the Property already exists, edit it and add the service to the property as follows:
[[Provides service::service_name]]
For ETI thesaurus service:
[[Provides service::ETI thesaurus]]
Save the Property page.
Property usage
Following previous steps, the Property with attached service could be used as usually. When the factbox or browse property will be called, for this property a special sign will be shown near (question sign). On clicking on this sign, the service names, separate by comma, will be available on a separate window as links. On following one of these services the parameters from property values will be transmited automatic. See bellow.
ETI thesaurus, ETI thesaurus ID
Par example, following the first link, the ETI thesaurus service will be questioned to return all about Galium odoratum, when this service is attached to "Scientific Name" property.
http://www.catalogueoflife.org/annual-checklist/2010/webservice?response=full&name=Galium%20odoratum
Parameter usage in service links
The number and contents of the parameters that replace $1, $2, $3, ... depend on the datatype of the property. For instance, a simple integer property replaces $1 with its value, whereas a geographic coordinate provides parameters for latitude, longitude, di- rection, and much more. In most cases, $1 is the most relevant parameter that just pro- vides a URL-safe string version of the property value.
Type:Page $1: URL-encoded article name (no namespace), with underscores replaced by spaces Type:Number (and types with custom units) $1: numerical value in English punctuation $2: integer version of value, in English punctuation $3: From SMW version 1.1 onwards unit, if any. Type:String (but not Type:Text) $1: URL-encoded string Type:URL, Type:Annotation URI and Type:Email $1: URL-encoded value of the URL(includes mailto: for Type:Email) Type:Geographic coordinate $1: latitude integer degrees $2: longitude integer degrees $3: latitude integer minutes $4: longitude integer minutes $5: latitude integer seconds $6: longitude integer seconds, $7: latitude direction string (N or S) $8: longitude direction string (W or E) $9: latitude in decimal degrees $10: longitude in decimal degrees $11: sign (- if south) for latitude $12: sign (- if west) for longitude