Extension:Semantic Glossary/Example
For this example we will create a page about 'Hypertext Markup Language' (text taken from Wikipedia). Certain terms and abbreviations appearing on that page (CSS, CERN, etc.) will have additional glossary definitions available, but instead of leaving the original page about HTML to check those definitions, we would like them to be underlined and when one hovers over them the definition should appear.
Create a page 'Hypertext Markup Language'
[edit]Insert the following text (taken from Wikipedia):
Create another page 'Cascading Style Sheet'
[edit]Insert the following text:
Observe the definition of the glossary term and the glosary definition at the beginning of the text.
Create similar pages for 'CERN', 'ENQUIRE', 'SGML', and 'IETF'
[edit]Check the page 'Hypertext Markup Language'
[edit]The abbreviations should be underlined now and when you hover over them the respective definition should appear.
Provide links with the tooltips
[edit]For example go to the page 'Cascading Style Sheet' and add the following:
This will add a link to the tooltip for CSS that links back to the 'Cascading Style Sheet' page. Check that it worked on the 'Hypertext Markup Language' page.
You can also provide interwiki links, e.g. on the 'Cascading Style Sheet' try replacing the definition of the link by
Create a list of glossary terms and definitions
[edit]To do so, create a page 'Glossary' and put the following query in it:
{{#ask:[[Glossary-Term::+]] |?Glossary-Term |?Glossary-Definition |?Glossary-Link |mainlabel=- |format=table }}
Using internal objects
[edit]Glossary terms can also be described by using internal object declarations.
SMW 1.7+ Subobject
[edit]{{#subobject:HTML |Glossary-Term=HTML |Glossary-Definition=HyperText Markup Language |Glossary-Link=wp:HTML}}
Semantic Internal Objects
[edit]{{#set internal:Glossary |Glossary-Term=HTML |Glossary-Definition=HyperText Markup Language |Glossary-Link=wp:HTML}}