Extension talk:Semantic Glossary

Jump to navigation Jump to search

About this board

Terrawide (talkcontribs)

First of all, thank you for all the hard work on the extension

Second, without going into any technical detail, I could not get the extension to work and had issues with the instructions for installing the extension, both manually and with Composer. I also don't want to burden you in any fashion by asking for help on solving the issue. I'll get it eventually. Instead I'd like to contribute some updates to the instructions for the manual installation of the extension, not Composer*. But it would be easier if you could help a bit.

Here's the short version of what I did: Semantic Glossary Extension downloaded, loaded in the LocalSettings.php file, permissions, ownership of everything set (no specific instructions given on that).  In the instructions for a manual installation I noticed that Lingo was the only dependency listed, along with the instructions to not load it in the LocalSettings.php file.  Downloaded, installed, not configured in LocalSettings.php, done.  Result: "Fatal exception of type "Error" displayed in the browser afterwards.  I haven't looked into the PHP error log yet, but this error doesn't seem to be at that lower level.  I then tried Composer* per your instructions.  It downloaded and installed 83 dependencys.  That seemed a bit much.  The result was more or less the same as it hosed our entire MediaWiki site.  Thankfully I don't test new extensions or Composer updates on a live site, so no big deal.

Anyway, and again, I don't want to waste your time or have you fix my install, but here are my questions:  Are there issues with MediaWiki 1.32.2?  What are all the dependencies for your Extension?  And do they need to be loaded or not loaded in the LocalSettings.php file?


* I've not had much luck with Composer helping more than it damages.  Maybe someone else can help with expanding the instructions for that for various Composer configurations and other OS installs.

F.trott (talkcontribs)

There seems to be an issue with some versions of MediaWiki 1.31 and 1.32 when using Composer. See https://phabricator.wikimedia.org/T226766 .

You could try to use the --no-dev switch with composer or wait for the release of 1.32.3

Reply to "MediaWiki 1.32.2 and Composer"

Glossary is generating a fatal error in MediaWiki 1.31.0

Legaulph (talkcontribs)
MediaWiki	1.31.0
PHP	7.1.8 (apache2handler)
MySQL	5.6.34-log

Fatal error: Uncaught Error: Call to undefined function SG\wfProfileIn() in /app/mediawiki/extensions/SemanticGlossary/src/LingoBackendAdapter.php:58 Stack trace: #0 /app/mediawiki/extensions/Lingo/src/LingoParser.php(191): SG\LingoBackendAdapter->next() #1 /app/mediawiki/extensions/Lingo/src/LingoParser.php(163): Lingo\LingoParser->buildLingo() #2 /app/mediawiki/extensions/Lingo/src/LingoParser.php(223): Lingo\LingoParser->getLingoTree() #3 /app/mediawiki/extensions/Lingo/src/LingoParser.php(80): Lingo\LingoParser->realParse(Object(Parser), '

parse(Object(Parser), '
F.trott (talkcontribs)
Legaulph (talkcontribs)
Why Thank you, that seems to work fine. 
Will I be able to use composer for this version?
F.trott (talkcontribs)

Composer should work. You just have to force it to use the master version.

Reply to "Glossary is generating a fatal error in MediaWiki 1.31.0"
Raulcpop (talkcontribs)

A database query error has occurred. This may indicate a bug in the software.

[a833f4b26fe85a741b68abc6] 2018-03-21 12:30:08: Fatal exception of type "Wikimedia\Rdbms\DBQueryError"

F.trott (talkcontribs)
Reply to "Its someone alive here?!"
Mri ice (talkcontribs)

I'm really sorry about yet another question. I've tried to troubleshoot to no avail and am now hoping I'm missing something really obvious.

So I've started building up a glossary and have added ca. 150 definitions so far. Everything has been working well up until now. I've added a new glossary term definition using the same template as I've used for everything else:


This is a term that occurs fairly frequently.

What I don't understand is that it does not seem to find all occurrences of the term, but some. I have uploaded a screenshot: https://www.dropbox.com/s/vrlmldqmi65gu0e/mosaiq_semantic_glossary.jpg?dl=0

Its correctly identified 3 instances, but it hasn't identified 4 others.

Is there a limit on how many it will find per page? How can I troubleshoot this?

As before, very grateful for any help.



F.trott (talkcontribs)

For the moment I have no idea at all. Looks like a bug. I'll get back to you.

Mri ice (talkcontribs)

Thank you and I must apologize, I have caused this all by myself :(

It appears that I had two Glossary-Terms defined. The first one:


and the second one:

[[Glossary-Term::MOSAIQ Server]]

All instances of MOSAIQ Server got tagged appropriately. Some instances of MOSAIQ on its own did and others didn't. Having removed the second term, all instances of MOSAIQ are now tagged.

I guess that what I tried to do was simply not possible.

Sorry to have wasted your time.

Thank you - Martin

F.trott (talkcontribs)

Ah yes, that might be problematic, although I still think it'd be nice if it worked. Thanks for the clarification.

Reply to "Not all instances found"
Mri ice (talkcontribs)

Dear all,

I'm running MediaWiki 1.29.0 with Semantic Glossary 2.2.0. Everything is working as expected, apart from the popup width for the glossary terms, which seems to default to a rather small width (see here: https://www.dropbox.com/s/3mo9vhfwfm0ia8l/popup_issue.jpg?dl=0)

I've tried to find a way to change the default width of the popups. Can anybody shed some light on this please? Is this all governed by the Lingo style sheets?

Many thanks -


F.trott (talkcontribs)

It works for me. The Qtip library sets the min width to 50px and the max width to 280px for the class .qtip and for me this is exactly what's applied: The tip grows as much as allowed in width until it reaches max width and then breaks to the next line. It appears that for some reason on your page the tip tries to become as narrow as possible, but I have no idea why. Lingo does not change the dimensions of the tip.

I could have a look at the applied styles on your wiki if it is public.

Mri ice (talkcontribs)

Thank you very much for taking the time to reply and sorry it's taken me a while to come back to you. Well, it's a school day every day. I'm using the Approved Revision Extension. When there is a new revision, and you approve that, it shows the page you've approved, with "This revision of the page has been set as the approved version." at the top of the page. While on this view, the behaviour of the popups is exactly as above. Once I reload the page, everything is fine :) So, luckily, a non-problem!

I do have another question that I'm hoping someone might know the answer to:

When defining the Glossary-Terms, how do I account for different spelling / capitalization? So let's say I want a popup for MASH and different spellings are Mash, M*A*S*H and MASH.

I have found that it seems to work if I define multiple Glossary-Terms as below


That works reasonably well, but when I build the "auto-glossary" through


it will obviously list all variants for the Glossary-Term.

So my question is whether a) I'm using the right way of defining multiple Glossary-Terms or whether there is a better way of doing this? and b) if the answer to a) is yes - does #ask have an possibility to limit to the first result for multiple definitions (a bit like select top 1 * in SQL).

Hope this makes sense?

Thanks - Martin

F.trott (talkcontribs)

The answer to the first question is yes, this is exactly how it should be done.

The answer to the second question in principle is also yes, but it is not as simple as it seems at first glance. One problem is that just because you define properties in a certain order does not mean that they appear in that same order when queried. So defining MASH, then M*A*S*H, then Mash may well lead to them appearing as M*A*S*H, MASH, Mash. The next problem is that SMW does not natively support this kind of grouping, so you would have to use the template format and in the template work with string functions (or use #array_map from the PageForms extension) to create the table row by hand.

An altogether simpler approach would be to just define a new property Main Term that you set in addition to the Glossary-Term properties on each page and then query for that:

{{#ask:[[Main Term::+]]
|?Main Term
Mri ice (talkcontribs)

Perfect, thank you very much.

Reply to "popup width"

Creating Form inputs for glossary terms

Nprobinson (talkcontribs)

On the Semantic_Glossary overview it mentions that "You can easily build a user interface to edit the glossary, e.g. using Semantic Forms.".

Does anyone have any more information than this regarding how to set the required objects up? I have tried different combinations of creating templates, forms and categories but can't find anyway of populating the 'Glossary-Term', 'Glossary-Definition' etc values via an input form?

Thanks in advance for any suggestions and apologies if I am missing a glaringly obvious solution somewhere.

Cavila (talkcontribs)

Just a quick answer with an example, presuming you have installed SMW, SF and SG properly:

Say you have something like the following in a template called "Template:Glossary term" (subobjects are used here as recommended by the docs):

{{{Definition|}}} (link: {{{Link|}}})

Then in the form you may want to use multiple-instance templates:

{{{for template|Glossary term|multiple}}}
{{{field|Term|input type=text}}}

{{{field|Definition|input type=textarea}}}

{{{field|Link|input type=textarea}}}

{{{end template}}}

Does that help you in any way?

F.trott (talkcontribs)

Create a page Category:Glossary Term:

[[Has default form::Glossary Term]]

Create a page Template:Glossary Term:

|Glossary-Term={{{Glossary Term|}}}
|Glossary-Definition={{{Glossary Definition|}}}

Create a page Form:Glossary Term:


{{#formlink:form=Glossary Term|link text=New Glossary Term}}

{{{info|create title=Create new Glossary Term|edit title=Edit Glossary Term|page name=<Glossary Term[Glossary Term]>}}}
{{{for template|Glossary Term}}}
{| class="formtable"
! Term:
| {{{field|Glossary Term|input type=text}}}
! Definition:
| {{{field|Glossary Definition|input type=textarea}}}
{{{end template}}}

{{{standard input|save}}} {{{standard input|cancel}}}

Follow the link on the Form page and create some terms.

It may be necessary to purge the pages containing text with terms.

F.trott (talkcontribs)

Heh, mid-air collision. :)

Both should work. Cavila's for one page containing several terms (up to the whole glossary), mine for one page per term.

Nprobinson (talkcontribs)

Thanks for the responses.

I ended up implementing the one page per term as it fitted my requirements better but thank you both for the guidance.

Solution worked perfectly.

Kmlancaster (talkcontribs)

When I follow your example, I get the following as the only visible content on my Form:Glossary Term page. Any help?

{{#formlink:form=Glossary Term|link text=New Glossary Term}}

F.trott (talkcontribs)

Usually when a function call appears verbatim on the page it means, that the respective function is unknown. Make sure that PageForms is installed properly.

Reply to "Creating Form inputs for glossary terms" (talkcontribs)

Sorry for the Noob question but I've installed the extension as well as Lingo on my SMW site. I've created the properties and now I'm stuck to figure out how to start creating Pages/terms for the Glossary? I'm new to SMW and just figuring out the structure of properties, types, categories, forms, templates and all. Glossary was my go-button and I LOVE the idea of it, but where the heck do I find some step-by-step instructs on how to start using it? Thanks, Dave L

F.trott (talkcontribs)

Ok, lets build a simple structure of pages:

  • Create a page 'Hypertext Markup Language' and insert the following text (taken from wikipedia):
HTML is the predominant markup language for web pages. HTML elements are the basic building-blocks of webpages.
Web browsers can refer to CSS to define the appearance and layout of text and other material. The W3C, maintainer
of both the HTML and the CSS standards, encourages the use of CSS over explicitly presentational HTML markup. In
1980, physicist Tim Berners-Lee, who was a contractor at CERN, proposed and prototyped ENQUIRE, a system for CERN
researchers to use and share documents. Berners-Lee considered HTML to be an application of SGML. It was formally
defined as such by the IETF with the mid-1993 publication of the first proposal for an HTML specification.
  • Create a page 'Cascading Style Sheet' and insert the following text:
* Abbreviation: [[Glossary-Term::CSS]]
* Definition: [[Glossary-Definition::Cascading Style Sheet]]
  • Create similar pages for 'CERN', 'ENQUIRE', 'SGML', 'IETF'
  • Go back to the page 'Hypertext Markup Language'. The abbreviations should be underlined and when you hover over them the Definition should appear.
  • To provide links with the tooltips, define the Glossary-Link property for the pages, e.g. go to 'Cascading Style Sheet' and modify it so it looks like this:
* Abbreviation: [[Glossary-Term::CSS]]
* Definition: [[Glossary-Definition::Cascading Style Sheet]]
* Link: [[Glossary-Link::Cascading Style Sheet]]
  • Go back to the page 'Hypertext Markup Language' to see the effect
  • You can also provide interwiki links, e.g. on the 'Cascading Style Sheet' try replacing the line with the link by
* Link: [[Glossary-Link::wikipedia:Cascading Style Sheet]]
  • If you want, create a page 'Glossary' and put the following query in it:


Dave88008 (talkcontribs)

Beautiful - Thank You so much! (and I posted the example)

F.trott (talkcontribs)

Thanks! :)

MWJames (talkcontribs)

I looked at your Extension:Semantic Glossary/Example and made a general overhaul. Please also note that you should use <nowiki></nowiki> for any documentation purpose where you reference to internal declarations such as [[Glossary:: ... ]] otherwise the documentation will contain red links.

F.trott (talkcontribs)

Hi James,

thanks for that. The screenshots especially are awesome, I am always to lazy to do them. One thing though - the original example was meant for somebody completely new to SMW (and maybe not too experienced with MW, either), hence the detailed step-by-step instructions. Should we get back into that direction? I like the idea of the Semantic Glossary as a starting point for an SMW experience, because it gives useful results almost immediately.


MWJames (talkcontribs)

Hi Stephan, anything works for me as long as the user can work with it. Cheers,

Dave88008 (talkcontribs)

I've been using Semantic Glossary and thanks to User:F.trott's simple explanation I was able to get up-and-running with Semantic Mediawiki.

I had been completely confused about properties, datatypes, templates and forms and how they all worked together.

But Mr. User:F.trott made it all come together after I posted the original question. Thank You!!!

Sorry to say that User:MWJames' "improvement" is in fact, very confusing. It may be technically accurate but is/was NOT the simple explanation as laid out in the original response.

I referred a friend here who is just beginning to learn SMW as I was a couple years ago, but when I saw the original answer had been removed I had to tell my friend to ignore this thread and we would find other ways to break down the learning process.

As an educator, I know it is all-to easy for experts in a particular field to forget how to break down the basics of a subject and sail right over the top of the heads of novice students...so I don't want this to come across as a criticism of User:MWJames. Just a reminder for us all to pay attention to the steps involved in the learning process.

I would suggest the original post response of User:F.trott be reverted to so others can gain the benefit of his tutorial.

Kmlancaster (talkcontribs)

When I follow this tutorial, my glossary shows the term, but my pages do not have any mouseover/markup effect. I'm very new to MW, so please forgive my fundamental question.

F.trott (talkcontribs)

Might be as easy as purging the page. On your page actions choose "Refresh".

Reply to "How do I enter terms?"

Error trying to get Semantic Glossary working

Kriegfrj (talkcontribs)

I have been trying unsuccessfully to get Semantic Glossary to work and I've been having issues. Whenever I enable it in LocalSettings.php I get the following error in the php log:

PHP Fatal error:  Call to a member function getValueFormatter() on null in C:\inetpub\wwwroot\w\extensions\SemanticMediaWiki\includes\datavalues\SMW_DV_String.php on line 74

I was wondering if anyone had come across this and/or had a fix for it?

Version info:

Component Version
MediaWiki 1.28.1
SMW 2.5.2
Semantic Result Formats 2.5.0
Semantic Cite 1.3.0
Semantic Breadcrumb Links 1.3.1
DisplayTitle 1.2
Semantic Glossary 2.0

Plus various other extensions that I am not sure whether or not they are causing problems.

F.trott (talkcontribs)

Try upgrading to latest version, please.

Kriegfrj (talkcontribs)

Well, whaddaya know. I thought I was already at the latest version (I normally check that before posting for help), but it turns out I had a typo in my composer.local.json, specifying version 2.0 of SG rather than ~2.0. When I fixed it and ran composer it upgraded to 2.2.0 - and the problem seems to have resolved itself.

Thank you for your help, F.trott - to be honest, I'm a bit embarrassed that the solution turned out to be so trivial. At least it wasn't as simple as rebooting the web server. :)

F.trott (talkcontribs)


Reply to "Error trying to get Semantic Glossary working"

handling synonymous terms in Semantic Glossary

4 (talkcontribs)

How do I handle synonyms in Semantic Glossary? In Lingo you can specify synonyms in the following way:

Term definition



F.trott (talkcontribs)

Hi Anna, good question. I thought it would be as easy as specifying a second Glossary-Terms for one definition. But I just tried it and it does not work. So right now the only way to do this is to actually define the two synonyms separately. I will fix the extension so this should be easier in future versions.

Cheers (talkcontribs)

Hi all,

it is possible, but elaborate to create synonyms for a page. I succeded to do so by creating a Semantic Internal Object for every synonym on the page. This can e.g. be simplified by using functions like term and TERM in templates to simulate case-insensitivity. Just don't look on the complexity...

thx (talkcontribs)

Have some solution to use synonymous in Semantic Glossary?

Reply to "handling synonymous terms in Semantic Glossary" (talkcontribs)

Hello, are there plans to make Semantic Glossary working with Cargo extension ?

F.trott (talkcontribs)

No. But it should not be to complicated to create a Cargo-specific extension. Lingo (the underlying extension responsible for the markup of terms) was created with extensibility in mind. You just need to create and register a Cargo-specific backend and that should be it.