Page MenuHomePhabricator

When SMW_QueryPrinter maxRecursionDepth >2, properties can get inherited via embed queries
Closed, DeclinedPublic

Description

Author: amh.public

Description:
Patch to enable different "classes" of recursion via SMW_QueryPrinter.php: Semantic and non-Semantic

An example appears in the link above, but this may introduce new issues because maxRecursionDepth on that wiki appears to be set to 2. (It also demonstrates how to circumvent maxRecursionDepth to accomplish infinite recursion. This may be expected behavior because the way I did it to get around maxRecursionDepth seems to be a very foolish way to do things, but users can be unpredictable, so you may want to look into this...).

In any case, based on the following, properties get inherited via embed queries when maxRecursionDepth is set to >2 (MW 1.16.2, SMW 1.5.5.1; also observed for MW >1.15, SMW >1.5). maxRecursionDepth must be set to at least 3 for this to work:

--Page 1--
[[Property::Page 1's value]]
{{#ask: [[Subpage of::page 1]]

format=embedded
embedonly=true

}}

--Page 2--
[[Property::Page 2's value]]
<noinclude>[[Subpage of::Page 1| ]]</noinclude>
{{#ask: [[subpage of::Page 2]]

format=embedded
embedonly=true

}}

--Page 3--
[[Property::Page 3's value]]
<noinclude>[[Subpage of::Page 2| ]]</noinclude>
{{#ask: [[Subpage of::Page 3]]

format=embedded
embedonly=true

}}

--Page 4--
[[Property::Page 4's value]]
<noinclude>[[Subpage of::Page 3| ]]</noinclude>
{{#ask: [[Subpage of::Page 4]]

format=embedded
embedonly=true

}}

Desired/expected result: Page 1 displays all content from pages 1-4, but holds only its own semantic data. Subpages display all content from lower subpages, but each page holds only its own semantic data.

Actual result: Page 1 displays all content from pages 1-4, but holds semantic data from all pages; Page 2 displays pages 2-4, but also holds property values for pages 2-4, page 3 displays pages 3-4, but also holds values for 3 and 4, and only page 4 holds values for itself alone. This appears to run counter to the comment at the bottom of http://semantic-mediawiki.org/wiki/Help:Embedded_format that "SMW will take care that embedded articles do not import their semantic annotations, so these need not be treated specifically."

Similar bug: https://bugzilla.wikimedia.org/show_bug.cgi?id=26658 ({{#set: values always inherited).

The attached patch creates two levels of recursion: The first, maxRecursionDepth, so that properties never get inherited beyond maxRecursionDepth unless the user specifically causes that to happen (e.g., by using an array to set property values via a query against the embedded page; absent the ability to switch semantics on/off inside a query, I think that is a good way to go because it prevent accidental property inheritance). The second, maxRecursionDepthNonSemantic, displays embedded page content with live links down to 10 levels of recursion so users can click to navigate, but the associated semantic data is not parsed, thus, properties are not inherited via embed queries.

Using this patch and setting maxRecursionDepth to 1 in LocalSettings.php obtains the desired result, above.

Access to a private system demonstrating this can be provided on request. Unfortunately, this patch does not address the issue in bug 26658.


Version: unspecified
Severity: normal
URL: http://sandbox.semantic-mediawiki.org/wiki/Special:Browse/Embed123
See Also:
https://bugzilla.wikimedia.org/show_bug.cgi?id=26658

Attached:

Details

Reference
bz27445

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 21 2014, 11:19 PM
bzimport set Reference to bz27445.

*Bulk BZ Change: +Patch to open bugs with patches attached that are missing the keyword*

sumanah wrote:

Alex, I've added the "need-review" keyword to indicate patch awaits review, and pinged a SMW developer to ask him to review the patch.

Aklapper subscribed.

The Semantic MediaWiki developers requested in https://phabricator.wikimedia.org/T64114 to move their task tracking to https://github.com/SemanticMediaWiki/SemanticMediaWiki/issues and to close remaining tasks in Wikimedia Phabricator. If you still face the problem reported in this task in a supported version of SMW, please feel free to transfer your report to https://github.com/SemanticMediaWiki/SemanticMediaWiki/issues . We are sorry for the inconvenience.