Rozšíření:Semantic Drilldown

This page is a translated version of the page Extension:Semantic Drilldown and the translation is 100% complete.
Základní informace k tomuto rozšíření MediaWiki
Semantic Drilldown
Stav rozšíření: beta
Zavádění Speciální stránka
Popis An extension, based around Semantic MediaWiki, that provides a page for drilling down into the category-based and semantic data of a site, using easily-created filters.
Napsal(i) Yaron Koren
Spravuje/jí gesinn.it
Nejnovější verze 4.0.0-beta3 (listopadu 2022)
MediaWiki 1.35+
PHP 7,4+
Změny v databázi Ne
Composer mediawiki/semantic-drilldown
Licence GNU General Public License 2.0 nebo pozdější
Zdrojový kód
Příklad Narutopedia
  • $sdgShowCategoriesAsTabs
  • $sdgNumRangesForNumberFilters
  • $sdgDisableFilterCollapsible
  • $sdgFiltersLargestFontSize
  • $sdgHideCategoriesByDefault
  • $sdgFiltersSmallestFontSize
  • $sdgMinValuesForComboBox
  • $sdgHideFiltersWithoutValues
  • $sdgNumResultsPerPage
  • $sdgResultFormatTypes

Rozšíření Semantic Drilldown poskytuje stránku pro drill down v datech webu pomocí kategorií a filtrů na sémantické vlastnosti. Je silně svázáno s rozšířením Semantic MediaWiki a je určeno k použití pro strukturovaná data, která mají sémantické označení.

Srdcem rozšíření je stránka "Browse data" (procházet data). Uvádí všechny kategorie "nejvyšší úrovně" na wiki. Tj. kategorie, které nejsou podkategoriemi jiné kategorie, a počet stránek v rámci této kategorie. Každý název kategorie je odkazem na "rozbalovací seznam" stránek v dané kategorii. Umožňuje uživateli vybrat další omezení pro omezení počtu výsledků. Tato omezení existují ve dvou typech:

  • Podkategorie – pokud má kategorie nějaké podkategorie, ty se zobrazí v řádku "Podkategorie". Každý z nich bude odkazem, který uživateli umožní zobrazit pouze stránky, které patří do dané podkategorie. Výsledná stránka rozbalení bude obsahovat odkazy na všechny filtry pro kategorii nejvyšší úrovně a jakékoli podkategorie vybrané podkategorie. Můžete tak použít stránku "Procházet data" k procházení celým stromem kategorií.
  • Filtry - filtry založené na sémantických vlastnostech lze nastavit pro jakoukoli kategorii nejvyšší úrovně. Každý takový filtr dostane svůj vlastní řádek v oblasti omezení, aby mohl uživatel omezit výsledky pouze na ty stránky, které mají určité hodnoty pro sémantickou vlastnost. Pro filtry, které odpovídají vlastnostem typu Datum nebo Číslo, existuje speciální manipulace - u filtrů Datum závisí časový rozsah, podle kterého jsou hodnoty seskupeny (roky, měsíce nebo dny), na rozložení aktuální sady hodnot a u filtrů Počet, jsou číselné hodnoty seskupeny do sady rozsahů přibližně stejné velikosti, opět v závislosti na aktuální sadě hodnot.
Stránka sémantického rozbalení

V zobrazení filtru v rozbalení se hodnoty, které pro ně nemají žádné výsledky, nezobrazí. Filtr také zobrazí dvě další hodnoty: "Other" (jiné) a "None" (žádné). Stránky, které se zobrazují jako "Other", jsou ty, které mají pro vlastnost daného filtru jinou hodnotu než jednu z předem zadaných hodnot. Stránky, které se zobrazují jako "None", jsou ty, které pro danou vlastnost nemají žádnou hodnotu. Hodnoty "Other" a "None" se stejně jako jiné hodnoty filtru nezobrazí, pokud pro ně neexistují žádné výsledky.

Po libovolném počtu kliknutí na různé podkategorie a filtry bude uživatel moci vidět v záhlaví stránky v horní části stránky sadu podkategorií a filtrů, na které klikl a které aktuálně nastavují omezení pro výsledek. Uživatel se může zbavit jakéhokoli omezení kliknutím na "x" vedle jeho názvu v záhlaví.

'Výsledky' rozbalení, tj. sada stránek zobrazených kdykoli během rozbalování, se standardně zobrazují stejným způsobem jako na stránce kategorie MediaWiki. Toto zobrazení však lze přizpůsobit, aby zobrazovalo další hodnoty pro každou stránku nebo zobrazovalo výsledky v jiných formátech, jako jsou tabulky, mapy a časové osy.

Instalace

  • Aby toto rozšíření fungovalo, musíte mít nainstalovaný Semantic MediaWiki .
  • Ke stažení soubor/y a vložte je do adresáře pojmenovaného SemanticDrilldown ve vaší složce extensions/.
  • Na konec vašeho souboru LocalSettings.php přidejte následující kód:
    wfLoadExtension( 'SemanticDrilldown' );
    
  • Spusťte aktualizační skript, který automaticky provede všechny nezbytné databázové změny, jaké rozšíření vyžaduje.
  •   Dokončeno – Přejděte na stránku Special:Version vaší wiki a zkontrolujte, zda bylo rozšíření úspěšně nainstalováno.


Autoři

Semantic Drilldown was mostly written by Yaron Koren. The code to display drilldown results was written by David Loomer. The 'combo box' jQuery input was created by Sanyam Goyal as part of the 2010 Google Summer of Code. Kód pro propojení s rozšířením Page Schemas vytvořil Ankit Garg jako součást programového léta 2011 Google. Much of the current code for handling date filters was written by Edward Chernenko. Helpful contributions have also been made by MWJames, Joel Natividad and others.

Historie verze

Začínáme

Before you set up Semantic Drilldown, you should have all the data structures on your site set up - properties, categories, templates, and, if you're using them, forms. See the Page Forms "Getting started" section for more on how to set these up.

Make sure that some pages exist, that these pages contain annotations, and that the pages belong to a category.

After all this is done, you should first go to the page "Special:BrowseData" and see what the category structure looks like on your site. There you can see what filters are needed or would be helpful for each category.

At this point, you have two options, depending on whether or not you have the Page Schemas extension installed. (In brief, it presents a single interface for generating templates, forms and filters.) If you are using Page Schemas, then you can go back into the page schema(s) you have already created (or, if you haven't, create new ones), and add filters onto each relevant property via the interface.

If you don't have it, you should make use of the #drilldowninfo parser function.

#drilldowninfo

The #drilldowninfo parser function should only be added to either top-level categories, or categories whose page contains "__SHOWINDRILLDOWN__" - see Excluding and including categories from the list.

#drilldowninfo takes in the following parameters:

  • filters - takes in the set of filters for this category. In most cases, this will be the only parameter set. Filters should be separated by commas, and after each filter's name, in parentheses, should be a clause listing any of the following:
    • property - the Semantic MediaWiki property that this filter applies to (mandatory)
    • category - a MediaWiki category from which to get values
    • requires - any number of previously-listed filters, that the user must select a value for before they can see this filter.
Example
{{#drilldowninfo:filters=Author (property=Was written by),
Second author (property=Was written by),
Date (property=Was published on),
Source (property=Was published by,category=Sources),
Topic (property=Addresses topic,category=Topics),
For (property=Is for, category=Positions,requires=Topic),
Against (property=Is against,category=Positions,requires=Topic),
Mixed (property=Is mixed on,category=Positions,requires=Topic)}}
Filters are displayed in Special:BrowseData in the order in which they are listed in #drilldowninfo.
  • title - sets the title for the drilldown page for this category (optional).
  • display parameters - this parameter lets you set the display of results as you would the display of Semantic MediaWiki's inline queries: that includes both additional properties that you would want to see displayed, and the format (such as a map or calendar) in which results will be displayed. "display parameters=" takes in a set of parameters like that of an inline query, although separated by semicolons instead of pipes. So, for instance, to display the drilldown results of a category on a Google Maps map, you could have the following in the call: "|display parameters=? Has coordinates;format=googlemaps3".
You can see an example of a simple use of this functionality here; every event gets its city shown as well. The relevant #drilldowninfo call is here.
There are several issues relating to the use of "display parameters=":
  • Unfortunately, currently one format is allowed for any one category.
  • The "sort=" and "order=" parameters for inline queries will not work - pages will always be sorted by their name.
  • As of Semantic MediaWiki version 1.8 and later wiki markup and html in properties of type text is displayed as plain text in various table result formats (table, broadtable, datatables), a workaround would be using result format template to create tabular output

Možnosti zobrazení

 
A Semantic Drilldown page with map. (see the result of drilling down)

Zobrazení hodnot filtru ve stylu tag-cloud

You can set the drilldown page to show the values for each filter and each subcategory in "tag-cloud" style, where the size of each value's name is dependent on the number of results it has. To do this, you need to add two values to your LocalSettings.php file, "$sdgFiltersSmallestFontSize" and "$sdgFiltersLargestFontSize"; these represent the font size of the names of the least-popular and most-popular filter values, respectively, in pixels. Here is an example:

$sdgFiltersSmallestFontSize=9;
$sdgFiltersLargestFontSize=25;

Make sure to add these below the inclusion of Semantic Drilldown itself.

Nastavení počtu výsledků na stránku

By default, the list of results, or pages that match the current set of filters, is displayed in the style of a category page, with a maximum of 100 results per page. You can change the number of results per page in your LocalSettings.php file, by setting the variable "$sdgNumResultsPerPage". To set the page to show 250 results per page, add the following:

$sdgNumResultsPerPage=250;

Nastavení zobrazení hodnot filtru

For filters that have above a certain number of values, values are shown in a combo box, instead of individually. By default, that number is 40. To change the number, add something like this to LocalSettings.php:

$sdgMinValuesForComboBox=50;

...or you can set it to 0 or 1 if you want filter values to always show up within a combo box, in order to boost performance; values shown individually require an additional database query in order to get the number of instances of that value.

For filters that correspond to Number properties, the values are automatically grouped into ranges, with an attempt to create ranges of roughly equal size while still having "nice" numbers for the boundaries (e.g., 1200 instead of 1234). By default, values are grouped into 6 ranges. To change this number, add something like this to LocalSettings.php:

$sdgNumRangesForNumberFilters=4;

Zobrazení kategorií

By default, a list of all top-level categories on the wiki shows up on one side of the "Browse data" page, to let users navigate to the drilldown interface for each such category. However, this display can be modified in a number of ways.

Odstranění seznamu kategorií

You may want to have the drilldown page show the data only for one category, and not display the list of other categories. To do that, just add the string "?_single" to anywhere in the URL query string; this will remove the list of categories.

Zobrazení názvů kategorií jako karet

If you add the following line to LocalSettings.php:

$sdgShowCategoriesAsTabs = true;

...it will display categories as tabs at the top of the page, instead of in a vertical list on the side of the page. This option makes more sense for sites with a smaller number of categories (less than seven or so).

Vyloučení a zařazení kategorií ze seznamu

You may want certain categories to not show up in the top-level list of categories. You can easily remove a category by adding the following anywhere within the category's page:

__HIDEFROMDRILLDOWN__

Conversely, there are some categories that you may want to show up in the main BrowseData list, even though they are not top-level categories. You can accomplish this as well, by adding the following to the category's page:

__SHOWINDRILLDOWN__

Conversely, you can also set for categories to only show up in the list if you specifically include them, i.e. have an "opt-in" instead of an "opt-out" approach. You can do that by adding the following to LocalSettings.php:

$sdgHideCategoriesByDefault = true;

If you do that, only categories marked with "__SHOWINDRILLDOWN__" will appear. (The "__HIDEFROMDRILLDOWN__" marking, on the other hand, will become irrelevant.)

Linking to a drilldown page

The best way to link to Special:BrowseData is with the #drilldownlink parser function. It has the following syntax;

{{#drilldownlink:category=|subcategory=|single|link text=|tooltip=|filters=}}

The parameters are as follows:

  • category - the category name
  • subcategory - the subcategory, if any
  • single - if this parameter is added, the list of categories is not displayed
  • link text - the text of the link; by default, it's the category name
  • tooltip - the text that appears when the cursor hovers over the link, if any
  • filters - the set of filters to apply, in the format "a=b&c=d&..."

Stránky, které používají sémantický rozbor

Here is a small sampling of sites that use Semantic Drilldown:

Seznam adresátů

You should use the Semantic MediaWiki mailing list, semediawiki-user, for any questions, suggestions or bug reports about Semantic Drilldown. If possible, please add "[SD]" at the beginning of the subject line, to clarify the subject matter.

Přispívání do projektu

Chyby a požadavky na funkce

You can submit bug reports and requests for new features in GitHubs's bug tracker.

The current list of known bugs and requested features for Semantic Drilldown can be found here.

Překlad

Translation of Semantic Drilldown is done through translatewiki.net. The translation for this extension can be found here. To add language values or change existing ones, you should create an account on translatewiki.net, then request permission from the administrators to translate a certain language or languages on this page (this is a very simple process). Once you have permission for a given language, you can log in and add or edit whatever messages you want to in that language.

Související odkazy

  • Cargo - provides a similar drill-down interface, on top of a different storage system