Blog Taxonomy

Posts tagged with 'vocabulary server'

How the Skosmos Widget Wiki plugin works

kinow @ Dec 24, 2018 15:43:43

Skosmos can be extended through plugins, or widgets (a widget is a plugin for Skosmos). You can read more about how plugins work in Skosmos here.

This post is a note-to-self, explaining how the Skosmos Widget Wiki plugin works. This is a plugin - or widget - that displays Wikipedia information when the concept supports it.

Here’s an image of the plugin in action. Or you can go to a live instance of Skosmos that has the plugin enabled.

Skosmos Widget Wiki plugin in action

Under the hood

The plugin exposes a JavaScript callback via its plugin.json file. In the callback, it receives a data object, with the following properties.

  • uri, the concept identifier, e.g. http://www.yso.fi/onto/yso/p107650”
  • prefLabels, the concepts preferred labels, e.g. “Central Asia”@en, “Keski-Aasia”@fi
  • pageType, defaults to page
  • json-ld, which contains the JSON-LD @context, as well as a graph property

If the pageType is not page, or if there are no preferred labels, or if there is no JSON-LD data, the plugin is not activated.

( Read more ... )