This is an AI generated issue report, but controlled by assignee (rnsrk).

On which WissKI instance happened the incidence?

(development environment in docker wisski)

When does the issue occur?

18 August 2026, when opening a WissKI individual for edit and saving it.

On which page or in which action carried out?

Edit form of individual 16 ("Mein tolles Objekt", bundle Object): /wisski/navigate/16/edit.

After save, Drupal redirects to the canonical view: /wisski/navigate/16/view?wisski_bundle=bb48a22d36f1c15cd16b143d23466812. The warning is shown there because messenger messages persist across the redirect.

What exactly lead to the behaviour?

Opened the individual Edit tab and saved the entity. Several entity-reference fields on this bundle have the default WissKI selection handler with Sort by: label, ASC. Drupal core DefaultSelection::buildEntityQuery() then does $query->sort('label', 'ASC').

On this Object form those fields include Dimensions (IEF complex), Stay, Has Part, Data record (IEF simple), (Claimed) Ownership, and Object type or -appellation. Fields whose handler sort is _none do not trigger this warning.

In wisski_adapter_sparql11_pb/src/Query/Query.php, filter handling already treats title and label as the entity title. Sort handling only accepts rand, eid, and fields named wisski_path_{pb}__{path}. The entity-reference sort by label therefore hits:

$this->messenger->addWarning('Query contained unknown sorting criterion: ' . $field);

The sort is then skipped, so referenced individuals are not ordered by label.

What did you expect? Do you want to display, configure or save something?

Opening the edit form and saving should complete without a warning. Entity-reference widgets that are configured to sort by label should actually return candidates in label order (the same title handling already used for title/label filters).

What happened instead? Did the page crash, is there an error or did the action not take place?

The entity still saves and the view still renders. After save, a warning message is shown:

Query contained unknown sorting criterion: label

Because the criterion is skipped, entity-reference results are not sorted by label.

Watchdog log

No watchdog entry for this warning. It is a Drupal messenger message from the SPARQL query class, not a PHP exception.

Drupal status message (type warning):

Query contained unknown sorting criterion: label

Emitted from wisski_adapter_sparql11_pb/src/Query/Query.php when $field is label.

Issue fork wisski-3617844

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

rnsrk created an issue. See original summary.

rnsrk’s picture

Then (scs_base)

SPARQL query sort handling in wisski_adapter_sparql11_pb/src/Query/Query.php built SPARQL ORDER BY only for wisski_path_*, rand, and eid. Other sort fields, including Drupal's entity-key label, were skipped with no messenger warning.

When a title condition was present, executeEntityTitleCondition() ordered wisski_title_n_grams.ngram only if the sort field was exactly title. Drupal core entity-reference selection already issues an entity query with sort('label'); it does not need a WissKI-specific reference widget.

Filters already treated title and label as the same generated title. Sort handling did not.

Now (8.x-4.x)

The same SPARQL sort set, plus a messenger warning for any other field. Entity-reference fields configured with Sort by: label therefore warned on edit/save. The ngram ORDER BY still required title only.

Compatibility

Verdict: logic broken. Compatible with scs_base runtime behavior? no (the warning is new). Drupal already owns entity-reference selection, match, and range. The SPARQL query class only has to accept the same label key it already accepts as a filter.

What was done

The SPARQL sort loop skips title and label without a warning (same skip scs_base used for unknown fields, now explicit for the entity-key alias filters already use). executeEntityTitleCondition() applies the existing ngram ORDER BY when the sort field is label as well as title.

No extra paging or post-sort of SPARQL result pages. Drupal's entity query / DefaultSelection still builds the query; this patch only teaches the WissKI query backend the label field name.

Files: wisski_adapter_sparql11_pb/src/Query/Query.php, regression test wisski_core/tests/src/Functional/Query/LabelSortTest.php.

rnsrk’s picture

Status: Active » Needs review
rnsrk’s picture

Status: Needs review » Fixed

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.