Jump to content
Toggle sidebar
UNITApedia
Search
English
Personal tools
Create account
Log in
Pages for logged out editors
learn more
Talk
Contributions
Navigation
Main Page
User Guide
Documentation
Viewpoints
Structural
Strategic
Beneficiary
Semantic
Infrastructure
Data
Beneficiaries
UNITA Participants
GEMINAE
Collectives
Agile Management Guide
Quality Management Process
Tools
What links here
Related changes
Special pages
Page information
Page values
In other languages
Editing
Documentation
(section)
Page
Discussion
English
Read
Edit
Edit source
View history
More
Read
Edit
Edit source
View history
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
=== MediaWiki for Data Retrieval === MediaWiki serves as the primary front-end for displaying and interacting with UNITApedia data. Its [https://www.mediawiki.org/wiki/Extension:External_Data External Data extension] allows the wiki to query the [https://unitapedia.univ-unita.eu/pga/ PostgreSQL] datamart directly, retrieving the latest processed data (e.g., indicators, event counts, user engagement metrics). ==== External Data Extension ==== <pre> $wgExternalDataSources['DW_UNITAData_DEMOJAN25_T125'] = [ 'server' => 'datawarehouse', 'type' => 'postgres', 'name' => 'datamart', 'user' => getenv('DATABASE_USERNAME'), 'password' => getenv('DATABASE_PASSWORD'), 'prepared' => <<<'POSTGRE' SELECT * FROM public.t125 ORDER BY id ASC; POSTGRE ]; </pre> * Defines a named data source (<code>DW_UNITAData_DEMOJAN25_T125</code>) pointing to the datamart database. * Uses prepared SQL statements for efficient and secure queries. * Data retrieval is performed via parser functions like <code>#get_db_data</code> to pull records into wiki pages. ==== Custom Namespaces ==== * <code>DataSrc</code> (ID 810) is used for storing and managing data imports. * <code>Doc</code> (ID 800) holds documentation or supplementary content. * These namespaces help organize data separately from content pages, and control access/edit permissions as needed. ==== Example Page for Data Import ==== <pre> {{#get_db_data: db=DW_UNITAData_DEMOJAN25_T125 |data=id=id,People_active=people_active,entry_date=date |cache seconds=0 }} {{#store_external_table: DW_UNITAData_DEMOJAN25_T125 |id={{{id}}} |People_active={{{People_active}}} |entry_date={{{entry_date}}} }} {{#ask: [[-Has subobject::{{FULLPAGENAME}}]] |?id |?People_active |?entry_date |class=datatable |format=datatables |mainlabel=- |header=show }} </pre> * <code>#get_db_data</code> fetches rows from <code>datamart.public.t125</code>. * <code>#store_external_table</code> writes these rows into Semantic MediaWiki subobjects, enabling semantic queries. * <code>#ask</code> displays the results in a dynamic DataTables format. [[File:DataSrcNamespace.png|thumb|930px|center|DataSrc Namespace Demo]]
Summary:
Please note that all contributions to UNITApedia are considered to be released under the Creative Commons Zero (public domain) (see
UNITApedia:Copyrights
for details). If you do not want your writing to be edited mercilessly and redistributed at will, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource.
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Debug data: