Page MenuHomePhabricator

Stored concept query text contains entity escapes, not re-parsed properly
Closed, ResolvedPublic

Description

On a Concept page with the source code

{{#concept: [[prop1::foo]] OR [[prop2::bar]]}}

the reported description is

<q> <q>[[prop1::foo]]</q> OR <q>[[prop2::bar]]</q> </q>

The list of pages contains only those for which both conditions are valid, i.e. AND behaviour.

See http://scratchpad.referata.com/wiki/Concept:2ndFloorCeramics for an example.

MediaWiki 1.15.4
Semantic MediaWiki 1.5.0


Version: unspecified
Severity: major

Details

Reference
bz24920

Event Timeline

bzimport raised the priority of this task from to High.Nov 21 2014, 11:05 PM
bzimport set Reference to bz24920.

Good catch, but a tricky one, too. The reason for the problem is that query descriptions serialise themselves writing <q> and </q> by means of HTML entities &lt; and &gt;. This is not understood by the current query parser, who simply ignores the respective parts including the OR, so it only evaluates the parts in square brackets, with the conjunctive default interpretation. The errors that are encountered are not reported since it is assumed that errors in concept queries are shown on the concept page anyway.

The easy way to "fix" this would be to replace HTML entities in the query text, but I am not sure if this is actually valid. The problem here is that this would also replace those entities in all other occurrences in the query, which may not be right (depending on whether the entities have been escaped before). If this is so, then the query would not be reconstructible from the part-escaped string and the serialisation would need to be changed. Unfortunately, this would affect other code, so care is needed.

A valid question to ask here is whether this has ever worked. Anyway, some more time is needed to look into this.

I think I have fixed this now (revision 81979). SMW_setup.php or the Special:SMWAdmin setup should be triggered after the update.

This may be related....
Concept page contains:
{{#concept:[[Type:+]] [[Type::Type:Namespace]] [[Class::Category:^what]]}}
Concept page displays:
[[Type:+]] [[Type::Type:Namespace]] [[Class:::Category:^what]]
Notice there are 3 colons in the third predicate.