Extension:PropChainsHelper

MediaWiki extensions manual
PropChainsHelper
Release status: beta
Implementation Special page
Description Provides a form to help with property chains in Semantic MediaWiki queries involving multiple related categories.
Author(s) Marco Falda <marco.falda@gmail.com>
Latest version 0.1.0 (January 2022)
Compatibility policy Master maintains backward compatibility.
MediaWiki 1.34+
License GNU General Public License 2.0 or later
Download

Property Chains Helper is an extension to Semantic MediaWiki that provides a special page for helping the specification of the correct property chains needed to address properties in queries involving related categories.

Installation

edit

Clone 'PropChainsHelper' via Git, place this directory within the main MediaWiki 'extensions' directory. Then, in the file 'LocalSettings.php' in the main MediaWiki directory add the following line:

wfLoadExtension( 'PropChainsHelper' );

Configuration

edit

To describe the database structure populate the global variables $pchCatLevels, $pchPropLevels, and $pchLinkProps. There is also the possibility to help with the domains of categorical variables by filling the $pchDomains global variable.

  • $pchCatLevels is an associative array with the level of each category, for example:
$pchCatLevels = [
     'Patients' => 0,
     'Positives' => 1, // second level (first chain)
     'Samplings' => 1 // second level (second chain)
];
  • $pchPropLevels is an associative array with the chain numbers and their level. Suppose for instance that there are two chains 'Patients -> Positives' and 'Patients -> Samplings' with a common root and the properties are:

- Patient(Age_of_patient, Gender_of_patient)

- Positives(Contact_of_positive, Type_of_contact)

- Samplings(Date_of_sampling, Result_of_sampling)

then $pchPropLevels will be written as:

$pchPropLevels = [
     "Age_of_patient" => [0, 0], // First (and second) chain, first level
     "Gender_of_patient" => [0, 0],
     "Contact_of_positive" => [0, 1], // First chain, second level
     "Type_of_contact" => [0, 1],
     "Date_of_sampling" => [1, 1], // Second chain, second level
     "Result_of_sampling" => [1, 1],
];
  • $pchLinkProps is an associative array with the link properties for each chain, for example in the previous case both the 'Positives' and 'Samplings' chains are linked with the property 'Has Patient':
$pchLinkProps = [
    ['Has Patient'], // to Positives
    ['Has Patient'] // to Samplings
];

In the case more levels are present, the previous array would become an irregular array.

  • Finally, $pchDomains is useful for helping with categorical domains, for example:
 $pchDomains = [
     "Gender_of_patient" => ["M", "F"]
 ];

Usage

edit

Property Chains Helper defines a special page, at "Special:PropChainsHelper".

The page "Special:PropChainsHelper" displays a form that can be filled out with the category and the properties. The properties can be considered as printouts or filters. The next step is to prepare the semantic query by clicking on the button: the printouts and the criteria prefixed with the needed property chains will appear below. Finally, running the query will prefill a semantic search form with conditions, filters and printouts and it will execute it.

Contributing to the project

edit

Bugs and feature requests

edit

Send any bug reports and requests to Marco Falda (marco.falda gmail.com).

Contributing patches to the project

edit

If you found bugs and fixed it please create a patch.

git diff >filename.patch

If you created a patch you can send it to Marco Falda.