mod_wikiconcept

Import Wikidata concepts from OpenAlex and connect them to Zotonic keyword resources. Imported concepts and multilingual search names are stored locally; searching the local catalogue does not require an OpenAlex request.

Setup and installation

Enable mod_wikiconcept, which depends on mod_admin. Installation creates wikiconcept and wikiconcept_name, their constraints and search indexes. The database needs pg_trgm in the public schema. The installer uses create extension if not exists pg_trgm with schema public; the database user must be able to create the extension when absent and use that schema. There are no module-specific configuration keys.

Schema version 2 preserves existing concepts, search names and keyword links. It converts the legacy props_json bytea column containing UTF-8 JSON to jsonb in place. Invalid JSON aborts the schema transaction without discarding data. Reinstallation never drops the tables or the shared extension.

An OpenAlex import task is scheduled only when the concept table is empty. Use the Reimport button on the admin status page to refresh an existing or partially imported catalogue. Imports update matching concepts and their names without clearing keyword connections; they do not prune concepts missing from the upstream response.

Administration and search

The WikiConcepts entry under the admin Modules menu lists imported concepts, with live search by name, Wikidata ID, OpenAlex ID or URL and numbered pagination. The overview and concept dialog require use mod_admin. Click a row or its name button to view the summary, source links, ancestors, and available title and summary languages. Keyword and source links remain directly clickable.

For an unconnected concept, expand Create a keyword in the dialog and select the keyword category or an allowed subcategory. Creation checks admin access and resource insert permissions, publishes the keyword, and updates the dialog and table with its edit link. An existing connection is reused.

Keyword creation keeps nonempty translations in the site's editable languages. When none match, available English text is copied to the site's default language, not the current interface language. Titles fall back to the concept's display name or identifier if necessary, so newly created keywords always have a title.

The supplied keyword-editing UI also supports finding, connecting and disconnecting concepts. The media dialog supports creating keywords from concepts. When resources are merged, links to the losing keyword move to the winner.

Interface translation catalogs accompany the module for Arabic, German, Spanish, French, Indonesian, Italian, Dutch, Polish, Portuguese, Brazilian Portuguese, Russian, Swedish, Turkish, Ukrainian and Simplified Chinese. English is the source language. Interface translations are separate from imported concept translations.

Two searches are exposed through m.search:

{% with m.search.wikiconcept::%{ text: "biology" } as result %}
    {% for concept in result %}{{ concept.display_name|escape }}{% endfor %}
{% endwith %}

wikiconcept takes text and searches local names or identifiers. It returns an exact total for the standard pager; use m.search.paged.wikiconcept for pagination. wikiconcept_descendant takes concept and finds concepts at the next level whose ancestor list contains that concept. The results are concept maps, not resource IDs. Escape imported text when rendering it.

The model's read paths and the search observers do not apply resource ACL filtering. Connecting and disconnecting through m_wikiconcept require an editable keyword resource; creating a keyword uses m_rsc insert permissions. The Reimport postback itself has no explicit ACL check in its event handler. See m_wikiconcept for the model paths and direct Erlang APIs.

Observes

Notifications

observe_rsc_merge/2

Map to signal merging two resources. Move any information from the loser to the winner. The loser will be deleted.

Models

Models

m_wikiconcept

Look up imported Wikidata/OpenAlex concepts, search their names and connect them to keyword resources. Concept rows are binary-keyed maps, with properties from…

Dispatch rules