Skip to content

Fix prefix parameter with link#6307

Draft
thomas-topway-it wants to merge 34 commits into
SemanticMediaWiki:masterfrom
Knowledge-Wiki:fix-prefix-parameter-with-link
Draft

Fix prefix parameter with link#6307
thomas-topway-it wants to merge 34 commits into
SemanticMediaWiki:masterfrom
Knowledge-Wiki:fix-prefix-parameter-with-link

Conversation

@thomas-topway-it

Copy link
Copy Markdown
Contributor

@coderabbitai

coderabbitai Bot commented Feb 28, 2026

Copy link
Copy Markdown
Contributor

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

Walkthrough

Renames the parameter in ValueTextsBuilder::getValueText to $dataValue and imports SMWWikiPageValue. Internal logic now computes $useLongText and $dataValueMethod, obtains a local $linker via getLinkerForColumn, and for SMWWikiPageValue sets its OPTION form (PREFIXED_FORM or SHORT_FORM) on the data value before generating text; rendering uses $dataValue->$dataValueMethod with the local linker and result is passed through sanitizeValueText. TableResultPrinter introduces an $isHtmlOutput/$parseAsWikitext path: for files/images/blobs/wiki-page values it pre-renders the raw value with the wiki output and linker and runs Message::get on that raw output; otherwise it caches a local $linker and pre-sets each data value’s rendering option before rendering. Existing separator/formatting and fallback flows are preserved. A reference to the prefix/link issue is included.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title 'Fix prefix parameter with link' directly relates to the main objective: fixing the prefix parameter when used with the link parameter in issue #6305.
Description check ✅ Passed The description references issue #6305 and mentions refactoring TableResultPrinter, which directly aligns with the linked issue about prefix parameter not working with link parameter.
Linked Issues check ✅ Passed The code changes implement conditional handling for SMWWikiPageValue instances with PREFIXED_FORM/SHORT_FORM options and refactor getCellContent logic, directly addressing the prefix parameter issue when combined with link parameter [#6305].
Out of Scope Changes check ✅ Passed All changes focus on fixing the prefix parameter behavior when used with link parameter by refactoring value rendering logic and adding SMWWikiPageValue handling, staying within the scope of issue #6305.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Tip

💬 Introducing Slack Agent: The best way for teams to turn conversations into code.

Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.

  • Generate code and open pull requests
  • Plan features and break down work
  • Investigate incidents and troubleshoot customer tickets together
  • Automate recurring tasks and respond to alerts with triggers
  • Summarize progress and report instantly

Built for teams:

  • Shared memory across your entire org—no repeating context
  • Per-thread sandboxes to safely plan and execute work
  • Governance built-in—scoped access, auditability, and budget controls

One agent for your entire SDLC. Right inside Slack.

👉 Get started


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/Query/ResultPrinters/ListResultPrinter/ValueTextsBuilder.php (1)

65-70: ⚠️ Potential issue | 🟡 Minor

Fix PHPDoc parameter name mismatch.

Line 65 still documents @param SMWDataValue $value, but the signature at Line 70 is $dataValue. Please align the docblock to avoid confusion in static analysis and maintenance.

📝 Suggested doc fix
-	 * `@param` SMWDataValue $value
+	 * `@param` SMWDataValue $dataValue
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/Query/ResultPrinters/ListResultPrinter/ValueTextsBuilder.php` around
lines 65 - 70, Update the PHPDoc for getValueText to match the actual parameter
names and types: change the `@param` line that currently says "@param SMWDataValue
$value" to "@param SMWDataValue $dataValue" (and keep the existing "@param int
$column" and "@return string") so the docblock matches the method signature of
getValueText(SMWDataValue $dataValue, $column = 0).
🧹 Nitpick comments (1)
src/Query/ResultPrinters/TableResultPrinter.php (1)

330-331: Move linker resolution outside the value loop.

Line 330 resolves the same linker on every iteration. Resolve it once before the loop to avoid redundant calls and keep per-cell rendering state stable.

♻️ Suggested refactor
 	$values = [];
+	$linker = $this->getLinker( $isSubject );
 	foreach ( $dataValues as $dv ) {
-		$linker = $this->getLinker( $isSubject );
 		$dataItem = $dv->getDataItem();
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/Query/ResultPrinters/TableResultPrinter.php` around lines 330 - 331, The
code calls $this->getLinker($isSubject) inside the per-value loop (see
TableResultPrinter::$linker and $dv->getDataItem usage), causing repeated
resolution and unstable per-cell state; move the $linker =
$this->getLinker($isSubject) call to just before the loop that iterates over
values (so it runs once), then use that resolved $linker variable inside the
loop when rendering each cell/value (keep $dv->getDataItem() where it belongs).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@src/Query/ResultPrinters/TableResultPrinter.php`:
- Around line 342-360: Add PHPUnit regression tests covering the changed
rendering paths in TableResultPrinter: exercise prefix+link combinations and the
parse branch by creating tests that assert output for prefix=none & link=none
(both subject and non-subject columns), prefix=subject & link=none, and HTML
output paths for DIWikiPage(NS_FILE) and DIBlob; specifically invoke the
rendering flow that exercises TableResultPrinter and the
ListResultPrinter\ValueTextsBuilder->getValueText behavior, include cases that
trigger $parseAsWikitext (Message::get PARSE) and the $dataValueMethod branches
(getLongText vs short form), and assert the produced HTML/text to prevent
regressions.

---

Outside diff comments:
In `@src/Query/ResultPrinters/ListResultPrinter/ValueTextsBuilder.php`:
- Around line 65-70: Update the PHPDoc for getValueText to match the actual
parameter names and types: change the `@param` line that currently says "@param
SMWDataValue $value" to "@param SMWDataValue $dataValue" (and keep the existing
"@param int $column" and "@return string") so the docblock matches the method
signature of getValueText(SMWDataValue $dataValue, $column = 0).

---

Nitpick comments:
In `@src/Query/ResultPrinters/TableResultPrinter.php`:
- Around line 330-331: The code calls $this->getLinker($isSubject) inside the
per-value loop (see TableResultPrinter::$linker and $dv->getDataItem usage),
causing repeated resolution and unstable per-cell state; move the $linker =
$this->getLinker($isSubject) call to just before the loop that iterates over
values (so it runs once), then use that resolved $linker variable inside the
loop when rendering each cell/value (keep $dv->getDataItem() where it belongs).

ℹ️ Review info

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between b5a9c87 and c63ab8b.

📒 Files selected for processing (2)
  • src/Query/ResultPrinters/ListResultPrinter/ValueTextsBuilder.php
  • src/Query/ResultPrinters/TableResultPrinter.php

Comment on lines +342 to +360
// @see ListResultPrinter\ValueTextsBuilder -> getValueText
$dv->setOption(
$dataValueMethod === 'getLongText'
? $dv::PREFIXED_FORM
: $dv::SHORT_FORM,
true
);

if ( $parseAsWikitext ) {
$raw = $dv->$dataValueMethod( SMW_OUTPUT_WIKI, $linker );

// Too lazy to handle the Parser object and besides the Message
// parse does the job and ensures no other hook is executed
$value = Message::get(
[ 'smw-parse', $dv->$dataValueMethod( SMW_OUTPUT_WIKI, $this->getLinker( $isSubject ) ) ],
[ 'smw-parse', $raw ],
Message::PARSE
);
} else {
$value = $dv->$dataValueMethod( $outputMode, $this->getLinker( $isSubject ) );
$value = $dv->$dataValueMethod( $outputMode, $linker );

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Add regression tests for the prefix + link interaction and parse branch.

Lines 342-360 change the core rendering path used to fix issue #6305. Please add PHPUnit coverage for at least:

  • prefix=none | link=none (subject + non-subject columns),
  • prefix=subject | link=none,
  • HTML output paths hitting DIWikiPage(NS_FILE) and DIBlob.

Without this, this fix can regress silently.

I can draft a focused test matrix and skeleton tests if you want.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/Query/ResultPrinters/TableResultPrinter.php` around lines 342 - 360, Add
PHPUnit regression tests covering the changed rendering paths in
TableResultPrinter: exercise prefix+link combinations and the parse branch by
creating tests that assert output for prefix=none & link=none (both subject and
non-subject columns), prefix=subject & link=none, and HTML output paths for
DIWikiPage(NS_FILE) and DIBlob; specifically invoke the rendering flow that
exercises TableResultPrinter and the
ListResultPrinter\ValueTextsBuilder->getValueText behavior, include cases that
trigger $parseAsWikitext (Message::get PARSE) and the $dataValueMethod branches
(getLongText vs short form), and assert the produced HTML/text to prevent
regressions.

@paladox

paladox commented Mar 16, 2026

Copy link
Copy Markdown
Contributor

@thomas-topway-it can you rebase please?

@thomas-topway-it

Copy link
Copy Markdown
Contributor Author

done

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
src/Query/ResultPrinters/TableResultPrinter.php (1)

333-335: Move invariant linker lookup outside the loop (optional cleanup).

$this->getLinker( $isSubject ) is loop-invariant here, so retrieving it once improves readability and avoids repeated calls.

♻️ Suggested diff
 protected function getCellContent( array $dataValues, $outputMode, $isSubject ) {
 	$dataValueMethod = $this->prefixParameterProcessor->useLongText( $isSubject ) ? 'getLongText' : 'getShortText';
 	$isHtmlOutput = $outputMode === SMW_OUTPUT_HTML;
+	$linker = $this->getLinker( $isSubject );

 	$values = [];
 	foreach ( $dataValues as $dv ) {
-		$linker = $this->getLinker( $isSubject );
 		$dataItem = $dv->getDataItem();
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/Query/ResultPrinters/TableResultPrinter.php` around lines 333 - 335, The
call to $this->getLinker($isSubject) inside the foreach over $dataValues is
loop-invariant; move the call outside the loop to a local variable (e.g.,
$linker = $this->getLinker($isSubject)) before iterating so you reuse the same
linker for each $dv->getDataItem() iteration and avoid repeated method calls in
the loop body (locate in TableResultPrinter:: where $dataValues is iterated).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@src/Query/ResultPrinters/TableResultPrinter.php`:
- Around line 333-335: The call to $this->getLinker($isSubject) inside the
foreach over $dataValues is loop-invariant; move the call outside the loop to a
local variable (e.g., $linker = $this->getLinker($isSubject)) before iterating
so you reuse the same linker for each $dv->getDataItem() iteration and avoid
repeated method calls in the loop body (locate in TableResultPrinter:: where
$dataValues is iterated).

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 4d7fe494-ccef-4160-bdda-d8417690e80d

📥 Commits

Reviewing files that changed from the base of the PR and between 7ec0a1a and 2751667.

📒 Files selected for processing (2)
  • src/Query/ResultPrinters/ListResultPrinter/ValueTextsBuilder.php
  • src/Query/ResultPrinters/TableResultPrinter.php
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/Query/ResultPrinters/ListResultPrinter/ValueTextsBuilder.php

Comment thread src/Query/ResultPrinters/ListResultPrinter/ValueTextsBuilder.php Outdated

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
src/Query/ResultPrinters/TableResultPrinter.php (1)

334-336: Consider hoisting $linker outside the loop.

$isSubject is constant throughout the loop, so $this->getLinker($isSubject) returns the same value for every iteration. Moving it before the foreach avoids redundant calls.

♻️ Suggested refactor
+		$linker = $this->getLinker( $isSubject );
+
 		$values = [];
 		foreach ( $dataValues as $dv ) {
-			$linker = $this->getLinker( $isSubject );
 			$dataItem = $dv->getDataItem();
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/Query/ResultPrinters/TableResultPrinter.php` around lines 334 - 336,
Hoist the repeated call to $this->getLinker($isSubject) out of the foreach over
$dataValues by assigning it once to $linker before the loop; update the loop to
use that single $linker variable (leave $isSubject unchanged) so getLinker is
not invoked on every iteration when its input is constant.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@src/Query/ResultPrinters/TableResultPrinter.php`:
- Around line 334-336: Hoist the repeated call to $this->getLinker($isSubject)
out of the foreach over $dataValues by assigning it once to $linker before the
loop; update the loop to use that single $linker variable (leave $isSubject
unchanged) so getLinker is not invoked on every iteration when its input is
constant.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 2a5b4ddb-b6ff-4f35-827f-7d0f359957bd

📥 Commits

Reviewing files that changed from the base of the PR and between 1f45d46 and 81c6e54.

📒 Files selected for processing (1)
  • src/Query/ResultPrinters/TableResultPrinter.php

@thomas-topway-it

Copy link
Copy Markdown
Contributor Author

done, there are test errors (not sure if they belong to this PR) but not syntax errors

@paladox

paladox commented Mar 16, 2026

Copy link
Copy Markdown
Contributor

Think the errors belong to this change (as it's not happening to others).

It appears for one test I looked at, it should be Category:Project group C (expected) but instead it's Project group C (actual).

@thomas-topway-it

Copy link
Copy Markdown
Contributor Author

ok, so we should decide whether to update the test or the current source of truth which is the following:

	public function useLongText( bool $isSubject ): bool {
		$prefix = $this->prefix;

		if ( $prefix === 'all'
			|| ( $prefix === 'subject' && $isSubject )
			|| ( $prefix === 'auto' && $isSubject && $this->mixedResults ) ) {
			return true;
		}

		return false;
	}

not sure about this, I have asked @krabina

@krabina

krabina commented Mar 16, 2026

Copy link
Copy Markdown
Contributor

since the default result of a query like

{{#ask: [[Category:Glossary]] 
|mainlabel=
|format=plainlist
}}

is to don't show the prefix (in this case the Glossary:-namespace, I think the test has to be updated to reflect this.

@jaideraf

jaideraf commented Mar 16, 2026

Copy link
Copy Markdown
Member

I am not sure if I understand the issue... the namespace should not be removed when link=none is used. It's only about the link, not the namespace string, I guess. See: https://www.semantic-mediawiki.org/wiki/Examples/Different_link_parameter_options

@kghbln any thoughts?

Comment thread src/Query/ResultPrinters/ListResultPrinter/ValueTextsBuilder.php Outdated
Comment thread src/Query/ResultPrinters/TableResultPrinter.php Outdated
@thomas-topway-it

Copy link
Copy Markdown
Contributor Author

I am not sure if I understand the issue... the namespace should not be removed when link=none is used. It's only about the link, not the namespace string, I guess. See: https://www.semantic-mediawiki.org/wiki/Examples/Different_link_parameter_options

@kghbln any thoughts?

@jaideraf sure, our doubts are only about how to reconcile tests with the current logic, since there is a mismatch (not related to the link option, but to whether we should use a prefix or not)

@thomas-topway-it

Copy link
Copy Markdown
Contributor Author

or alternatively this

public function useLongText( bool $isSubject ): bool {
	// prefix can be 'all', 'subject', 'none', 'auto' 
	if ( $this->prefix === 'all') {
		return true;
	}

	if ( $this->prefix === 'none') {
		return false;
	}

	// add prefix to subject
	if ( $this->prefix === 'subject' ) {
		return $isSubject;
	}

	// prefix is auto
	return $this->mixedResults;
}

in this case prefix=subject is interpreted as: use prefix only for subjects but no prefix for other columns (in the other solution the prefix for other columns is auto)

@jaideraf

jaideraf commented Apr 10, 2026

Copy link
Copy Markdown
Member

... I think the test has to be updated to reflect this.

@jaideraf sure, our doubts are only about how to reconcile tests with the current logic, since there is a mismatch (not related to the link option, but to whether we should use a prefix or not)

@thomas-topway-it, but if I remember well, the test that was failing at the time was about the link option; it wasn't about the prefix option. So I disagree with the affirmation "the test has to be updated to reflect this." I don't think the test (about the link option) should be updated to accommodate a change that was not used in the specific test at all. I should have talked more clearly, but I was not sure if I had understood the point.

Now, when the majority of the tests pass, we can analyze again what specific tests are falling. If they are related to the link option or the prefix option.

@jaideraf

Copy link
Copy Markdown
Member

since the default result of a query like

{{#ask: [[Category:Glossary]] 
|mainlabel=
|format=plainlist
}}

is to don't show the prefix (in this case the Glossary:-namespace, I think the test has to be updated to reflect this.

My point is: the default result of a query like this (look at the absence of the prefix option) is TO SHOW the namespace prefixes because it could return pages with the same title in different namespaces. So, if it omits the namespaces by default, it could lead the reader to think they are talking about the same entity (same page).

@thomas-topway-it

Copy link
Copy Markdown
Contributor Author

since the default result of a query like

{{#ask: [[Category:Glossary]] 
|mainlabel=
|format=plainlist
}}

is to don't show the prefix (in this case the Glossary:-namespace, I think the test has to be updated to reflect this.

My point is: the default result of a query like this (look at the absence of the prefix option) is TO SHOW the namespace prefixes because it could return pages with the same title in different namespaces. So, if it omits the namespaces by default, it could lead the reader to think they are talking about the same entity (same page).

yes, the proposed implementation takes into account your point

@thomas-topway-it

Copy link
Copy Markdown
Contributor Author

@jaideraf and @krabina, I'm about to finalize this. So I plan to use

public function useLongText( bool $isSubject ): bool {
	// prefix can be 'all', 'subject', 'none', 'auto' 
	if ( $this->prefix === 'all') {
		return true;
	}

	if ( $this->prefix === 'none') {
		return false;
	}

	// add prefix to subject
	if ( $this->prefix === 'subject' && $isSubject ) {
		return true;
	}

	// prefix is auto
	return $this->mixedResults;
}

regarding the question about the semantic of prefix=subject perhaps the most complete would be:
prefix=subject (use prefix only for subjects and no prefix for other columns)
prefix=subject, auto (use prefix only for subjects and default/auto for other columns)

otherwise the meaning of prefix=subject could depend on the user's interpretation

@thomas-topway-it thomas-topway-it marked this pull request as draft May 11, 2026 02:31
@thomas-topway-it

Copy link
Copy Markdown
Contributor Author

@paladox @alistair3149
I've removed all the deprecated classes and restricted the use of the PrefixParameterProcessor to WikiPageValue. (there was a divergence from this https://github.com/SemanticMediaWiki/SemanticMediaWiki/blob/2df4093a4d04761f4bb283938623a2b7616800ca/src/Query/ResultPrinters/ListResultPrinter/ValueTextsBuilder.php that didn't show up previously since the default value for prefix was none, by contrast to auto (last update) so this particular feature was simply disabled during tests that otherwise would have triggered a lot of failures).

So currently there are a few tests that are failing most of them consistent to the behavior of PrefixParameterProcessor and which could actually be updated. However there are failing tests, specifically 2 and 6 (see here https://github.com/SemanticMediaWiki/SemanticMediaWiki/actions/runs/25651696871/job/75291121297?pr=6307) which don't seem related to this pull request and I experience also locally (despite locally I also get a lot of failures also on master, so it's not fully reliable at least on my install).
Do you have any hint why errors 2 and 6 are showing and whether they are actually related to this pull request ?

@paladox

paladox commented May 11, 2026

Copy link
Copy Markdown
Contributor

Seems like the errors are related to this pull as they are only caused by this pull request.

1) SMW\Tests\Integration\JSONScript\JSONScriptTestCaseRunnerTest::testCaseFile with data set "format-table-0006.json" ('/var/www/html/extensions/Sema...6.json')
Failed "#1"

==== (actual) ====
<div class="mw-content-ltr mw-parser-output" lang="en" dir="ltr"><table class="sortable wikitable smwtable"><tbody><tr><th>&#160;</th><th class="Property-description"><span class="smw-highlighter" data-type="1" data-state="inline" data-title="Property" title="&quot;Property description&quot; is a predefined property that allows to describe a property in context of a language and is provided by Semantic MediaWiki."><span class="smwbuiltin"><a href="/wiki/Property:Property_description" title="Property:Property description">Property description</a></span><span class="smwttcontent">"Property description" is a predefined property that allows to describe a property in context of a language and is provided by <a rel="nofollow" class="external text" href="https://www.semantic-mediawiki.org/wiki/Help:Special_properties">Semantic MediaWiki</a>.</span></span></th></tr><tr data-row-number="1" class="row-odd"><td class="smwtype&#95;wpg"><a href="/wiki/Property:Modification_date" title="Property:Modification date">Property:Modification date</a></td><td class="Property-description smwtype&#95;mlt&#95;rec">Some description (en)</td></tr></tbody></table></div>
==== (StringContains expected) ====
[ <a href=".*Property:Modification_date" title="Property:Modification date">Modification date</a> ]

Failed asserting that 1 matches expected 2.

/var/www/html/extensions/SemanticMediaWiki/tests/phpunit/Utils/Validators/StringValidator.php:76
/var/www/html/extensions/SemanticMediaWiki/tests/phpunit/Utils/Validators/StringValidator.php:31
/var/www/html/extensions/SemanticMediaWiki/tests/phpunit/Utils/JSONScript/QueryTestCaseProcessor.php:241
/var/www/html/extensions/SemanticMediaWiki/tests/phpunit/JSONScriptServicesTestCaseRunner.php:477
/var/www/html/extensions/SemanticMediaWiki/tests/phpunit/JSONScriptServicesTestCaseRunner.php:416
/var/www/html/extensions/SemanticMediaWiki/tests/phpunit/JSONScriptServicesTestCaseRunner.php:129
/var/www/html/extensions/SemanticMediaWiki/tests/phpunit/JSONScriptTestCaseRunner.php:183

2) SMW\Tests\Integration\JSONScript\JSONScriptTestCaseRunnerTest::testCaseFile with data set "p-0705.json" ('/var/www/html/extensions/Sema...5.json')
Failed "#1 with options"

==== (actual) ====
<div class="mw-content-ltr mw-parser-output" lang="en" dir="ltr"><table class="sortable wikitable smwtable"><tbody><tr><th>&#160;</th><th class="Has-file"><a href="/wiki/Property:Has_file" title="Property:Has file">Has file</a></th></tr><tr data-row-number="1" class="row-odd"><td class="smwtype&#95;wpg"><span class="mw-default-size mw-valign-text-top mw-image-border" typeof="mw:File/Frameless"><a href="/wiki/File:P0705.png" class="mw-file-description" title="File:P0705.png"><img alt="File:P0705.png" src="/images/thumb/2/2f/P0705.png/300px-P0705.png" decoding="async" width="300" height="300" class="mw-file-element" srcset="/images/thumb/2/2f/P0705.png/450px-P0705.png 1.5x, /images/2/2f/P0705.png 2x" /></a></span></td><td class="Has-file smwtype&#95;wpg"><span class="mw-default-size mw-valign-text-top mw-image-border" typeof="mw:File/Frameless"><a href="/wiki/File:P0705.png" class="mw-file-description" title="File:P0705.png"><img alt="File:P0705.png" src="/images/thumb/2/2f/P0705.png/300px-P0705.png" decoding="async" width="300" height="300" class="mw-file-element" srcset="/images/thumb/2/2f/P0705.png/450px-P0705.png 1.5x, /images/2/2f/P0705.png 2x" /></a></span></td></tr></tbody></table></div>
==== (StringContains expected) ====
[ 120px-P0705.png" ], [ width="120" height="120" ], [ 123 ], [ Extra ]

Failed asserting that 2 matches expected 6.

/var/www/html/extensions/SemanticMediaWiki/tests/phpunit/Utils/Validators/StringValidator.php:76
/var/www/html/extensions/SemanticMediaWiki/tests/phpunit/Utils/Validators/StringValidator.php:31
/var/www/html/extensions/SemanticMediaWiki/tests/phpunit/Utils/JSONScript/ParserTestCaseProcessor.php:186
/var/www/html/extensions/SemanticMediaWiki/tests/phpunit/Utils/JSONScript/ParserTestCaseProcessor.php:83
/var/www/html/extensions/SemanticMediaWiki/tests/phpunit/JSONScriptServicesTestCaseRunner.php:323
/var/www/html/extensions/SemanticMediaWiki/tests/phpunit/JSONScriptServicesTestCaseRunner.php:113
/var/www/html/extensions/SemanticMediaWiki/tests/phpunit/JSONScriptTestCaseRunner.php:183

3) SMW\Tests\Integration\JSONScript\JSONScriptTestCaseRunnerTest::testCaseFile with data set "p-0917.json" ('/var/www/html/extensions/Sema...7.json')
Failed "#1 (display categories as literal)"

==== (actual) ====
<div class="mw-content-ltr mw-parser-output" lang="en" dir="ltr"><table class="sortable wikitable smwtable"><tbody><tr><th>&#160;</th><th class="Category"><a href="/wiki/Special:Categories" title="Special:Categories">Category</a></th></tr><tr data-row-number="1" class="row-odd"><td class="smwtype&#95;wpg"><a href="/wiki/P0917/1" title="P0917/1">P0917/1</a></td><td class="Category smwtype&#95;wpg"><a href="/wiki/Category:P0917" title="Category:P0917">Category:P0917</a></td></tr><tr data-row-number="2" class="row-even"><td class="smwtype&#95;wpg"><a href="/wiki/P0917/2" title="P0917/2">P0917/2</a></td><td class="Category smwtype&#95;wpg"></td></tr></tbody></table></div>
==== (StringContains expected) ====
[ <td class="Category smwtype&#95;wpg"><a href=".*/Category:P0917" title="Category:P0917">P0917</a> ]

Failed asserting that 3 matches expected 4.

/var/www/html/extensions/SemanticMediaWiki/tests/phpunit/Utils/Validators/StringValidator.php:76
/var/www/html/extensions/SemanticMediaWiki/tests/phpunit/Utils/Validators/StringValidator.php:31
/var/www/html/extensions/SemanticMediaWiki/tests/phpunit/Utils/JSONScript/ParserTestCaseProcessor.php:186
/var/www/html/extensions/SemanticMediaWiki/tests/phpunit/Utils/JSONScript/ParserTestCaseProcessor.php:83
/var/www/html/extensions/SemanticMediaWiki/tests/phpunit/JSONScriptServicesTestCaseRunner.php:323
/var/www/html/extensions/SemanticMediaWiki/tests/phpunit/JSONScriptServicesTestCaseRunner.php:113
/var/www/html/extensions/SemanticMediaWiki/tests/phpunit/JSONScriptTestCaseRunner.php:183

4) SMW\Tests\Integration\JSONScript\JSONScriptTestCaseRunnerTest::testCaseFile with data set "p-0921.json" ('/var/www/html/extensions/Sema...1.json')
Failed "#0 (parenthetical page titles stripped as per pipe trick)"

==== (actual) ====
<div class="mw-content-ltr mw-parser-output" lang="en" dir="ltr"><p><a href="/wiki/Page0_(parenthesis)" title="Page0 (parenthesis)">Page0 (parenthesis)</a>, <a href="/wiki/Yours,_Mine_and_Ours_(1968_film)" title="Yours, Mine and Ours (1968 film)">Yours, Mine and Ours (1968 film)</a>
</p></div>
==== (StringContains expected) ====
[ >Page0< ]

Failed asserting that 0 matches expected 1.

/var/www/html/extensions/SemanticMediaWiki/tests/phpunit/Utils/Validators/StringValidator.php:76
/var/www/html/extensions/SemanticMediaWiki/tests/phpunit/Utils/Validators/StringValidator.php:31
/var/www/html/extensions/SemanticMediaWiki/tests/phpunit/Utils/JSONScript/ParserTestCaseProcessor.php:186
/var/www/html/extensions/SemanticMediaWiki/tests/phpunit/Utils/JSONScript/ParserTestCaseProcessor.php:83
/var/www/html/extensions/SemanticMediaWiki/tests/phpunit/JSONScriptServicesTestCaseRunner.php:323
/var/www/html/extensions/SemanticMediaWiki/tests/phpunit/JSONScriptServicesTestCaseRunner.php:113
/var/www/html/extensions/SemanticMediaWiki/tests/phpunit/JSONScriptTestCaseRunner.php:183

5) SMW\Tests\Integration\JSONScript\JSONScriptTestCaseRunnerTest::testCaseFile with data set "q-1301.json" ('/var/www/html/extensions/Sema...1.json')
Failed "#1 (output imported-from query)"

==== (actual) ====
<div class="mw-content-ltr mw-parser-output" lang="en" dir="ltr"><p><a href="/wiki/Property:Foaf:homepage" title="Property:Foaf:homepage">Property:Foaf:homepage</a> (<span class="smw-highlighter" data-type="1" data-state="inline" data-title="Property" title="&quot;Imported from&quot; is a predefined property that describes a relation to an imported vocabulary and is provided by Semantic MediaWiki."><span class="smwbuiltin"><a href="/wiki/Property:Imported_from" title="Property:Imported from">Imported from</a></span><span class="smwttcontent">"Imported from" is a predefined property that describes a relation to an <a rel="nofollow" class="external text" href="https://www.semantic-mediawiki.org/wiki/Help:Import_vocabulary">imported vocabulary</a> and is provided by <a rel="nofollow" class="external text" href="https://www.semantic-mediawiki.org/wiki/Help:Special_properties">Semantic MediaWiki</a>.</span></span>: <a href="/wiki/MediaWiki:Smw_import_foaf" title="MediaWiki:Smw import foaf">foaf:homepage</a> (<a rel="nofollow" class="external text" href="http://xmlns.com/foaf/0.1/">foaf</a> | <a rel="nofollow" class="external text" href="http://www.foaf-project.org/">Friend Of A Friend</a>))
</p></div>
==== (StringContains expected) ====
[ <a href="/wiki/Property:Foaf:homepage" title="Property:Foaf:homepage">Foaf:homepage</a> (<span class="smw-highlighter" data-type="1" data-state="inline" data-title="Property" title="&quot;Imported from&quot; is a predefined property that describes a relation to an imported vocabulary and is provided by Semantic MediaWiki."><span class="smwbuiltin"><a href="/wiki/Property:Imported_from" title="Property:Imported from">Imported from</a></span><span class="smwttcontent">"Imported from" is a predefined property that describes a relation to an <a rel="nofollow" class="external text" href="https://www.semantic-mediawiki.org/wiki/Help:Import_vocabulary">imported vocabulary</a> and is provided by <a rel="nofollow" class="external text" href="https://www.semantic-mediawiki.org/wiki/Help:Special_properties">Semantic MediaWiki</a>.</span></span>: <a href="/wiki/MediaWiki:Smw_import_foaf" title="MediaWiki:Smw import foaf">foaf:homepage</a> (<a rel="nofollow" class="external text" href="http://xmlns.com/foaf/0.1/">foaf</a> | <a rel="nofollow" class="external text" href="http://www.foaf-project.org/">Friend Of A Friend</a>)) ]

Failed asserting that 0 matches expected 1.

/var/www/html/extensions/SemanticMediaWiki/tests/phpunit/Utils/Validators/StringValidator.php:76
/var/www/html/extensions/SemanticMediaWiki/tests/phpunit/Utils/Validators/StringValidator.php:31
/var/www/html/extensions/SemanticMediaWiki/tests/phpunit/Utils/JSONScript/ParserTestCaseProcessor.php:186
/var/www/html/extensions/SemanticMediaWiki/tests/phpunit/Utils/JSONScript/ParserTestCaseProcessor.php:83
/var/www/html/extensions/SemanticMediaWiki/tests/phpunit/JSONScriptServicesTestCaseRunner.php:323
/var/www/html/extensions/SemanticMediaWiki/tests/phpunit/JSONScriptServicesTestCaseRunner.php:113
/var/www/html/extensions/SemanticMediaWiki/tests/phpunit/JSONScriptTestCaseRunner.php:183

6) SMW\Tests\Integration\JSONScript\JSONScriptTestCaseRunnerTest::testCaseFile with data set "special-ask-0003.json" ('/var/www/html/extensions/Sema...3.json')
Failed "#0 (display image in table with 50px|thumb|123)"

==== (actual) ====
<div id="ask-status" class="smw-ask-status plainlinks"><noscript><div class="cdx-message cdx-message--block cdx-message--error smw-error-noscript"><span class="cdx-message__icon"></span><div class="cdx-message__content">This page or action requires JavaScript to work. Please enable JavaScript in your browser or use a browser where it is supported, so that functionality can be provided as requested. For further assistance, please have a look at the <a rel="nofollow" class="external text" href="https://www.semantic-mediawiki.org/wiki/Help:Noscript">noscript</a> help page.</div></div></noscript></div><div id="ask-toplinks" class="smw-ask-toplinks hide-mode"><span class="float-left"><a href="#search">Search</a></span>&#160;<span class="float-right"><a href="/wiki/Special:Ask">Clear all entries</a></span></div><div class="clear-both"></div><div id="ask" class="is-disabled"><form action="/index.php?title=Special:Ask&amp;#search" name="ask" method="post"><div id="search" class="smw-tabs smw-ask-search-compact"><input id="tab-smw-askt-edit" class="nav-tab" type="radio" name="ask"><label id="tab-label-smw-askt-edit" for="tab-smw-askt-edit" class="nav-label edit-action"><a href="/index.php?title=Special:Ask&amp;q=%5B%5BCategory%3ASA0003%5D%5D&amp;p=mainlabel%3D-25%2Fformat%3Dbroadtable%2Flink%3Dall%2Fheaders%3Dshow&amp;po=%3FHas+file%2350px%3Bthumb%3B123%0A&amp;sort=&amp;order=asc&amp;offset=0&amp;limit=50&amp;eq=yes#search" rel="href" style="display:block; width:60px"><span class="smw-icon-pen" title="Edit query"></span></a></label><input id="tab-smw-askt-result" class="nav-tab" type="radio" name="ask" checked=""><label id="tab-label-smw-askt-result" for="tab-smw-askt-result" class="nav-label">Result</label><input id="tab-smw-askt-code" class="nav-tab" type="radio" name="ask"><label id="tab-label-smw-askt-code" for="tab-smw-askt-code" class="nav-label">Code</label><input id="tab-smw-askt-extra" class="nav-tab" type="radio" name="ask"><label id="tab-label-smw-askt-extra" for="tab-smw-askt-extra" class="nav-label smw-tab-right">Extra</label><section id="tab-content-smw-askt-code"><div style="margin-top:15px; margin-bottom:15px;"><p>To embed this query inline into a wiki page use the code below.</p><pre id="inlinequeryembedarea" readonly="" cols="20" rows="11" onclick="this.select()">{{#ask: [[Category:SA0003]]
 |?Has file#50px;thumb;123
 |format=broadtable
 |limit=50
 |offset=0
 |link=all
 |sort=
 |order=asc
 |headers=show
 |mainlabel=%
}}</pre></div></section><section id="tab-content-smw-askt-result"><div class="smw-ask-actions-nav"><div id="ask-pagination"><div class="smw-ui-pagination"><a class="page-link link-disabled"><b>Results 1 &#150; 1</b>&#160;</a><a class="page-link link-disabled">previous 50</a><a href="/index.php?title=Special:Ask&amp;limit=20&amp;offset=0&amp;q=%5B%5BCategory%3ASA0003%5D%5D&amp;p=mainlabel%3D-25%2Fformat%3Dbroadtable%2Flink%3Dall%2Fheaders%3Dshow&amp;po=%3FHas+file%2350px%3Bthumb%3B123%0A&amp;sort=&amp;order=asc&amp;eq=no#search" title="Show 20 results per page" class="page-link">20</a><a href="/index.php?title=Special:Ask&amp;limit=50&amp;offset=0&amp;q=%5B%5BCategory%3ASA0003%5D%5D&amp;p=mainlabel%3D-25%2Fformat%3Dbroadtable%2Flink%3Dall%2Fheaders%3Dshow&amp;po=%3FHas+file%2350px%3Bthumb%3B123%0A&amp;sort=&amp;order=asc&amp;eq=no#search" title="Show 50 results per page" class="page-link link-active">50</a><a href="/index.php?title=Special:Ask&amp;limit=100&amp;offset=0&amp;q=%5B%5BCategory%3ASA0003%5D%5D&amp;p=mainlabel%3D-25%2Fformat%3Dbroadtable%2Flink%3Dall%2Fheaders%3Dshow&amp;po=%3FHas+file%2350px%3Bthumb%3B123%0A&amp;sort=&amp;order=asc&amp;eq=no#search" title="Show 100 results per page" class="page-link">100</a><a href="/index.php?title=Special:Ask&amp;limit=250&amp;offset=0&amp;q=%5B%5BCategory%3ASA0003%5D%5D&amp;p=mainlabel%3D-25%2Fformat%3Dbroadtable%2Flink%3Dall%2Fheaders%3Dshow&amp;po=%3FHas+file%2350px%3Bthumb%3B123%0A&amp;sort=&amp;order=asc&amp;eq=no#search" title="Show 250 results per page" class="page-link">250</a><a href="/index.php?title=Special:Ask&amp;limit=500&amp;offset=0&amp;q=%5B%5BCategory%3ASA0003%5D%5D&amp;p=mainlabel%3D-25%2Fformat%3Dbroadtable%2Flink%3Dall%2Fheaders%3Dshow&amp;po=%3FHas+file%2350px%3Bthumb%3B123%0A&amp;sort=&amp;order=asc&amp;eq=no#search" title="Show 500 results per page" class="page-link">500</a><a class="page-link link-disabled">next 50</a></div></div><div id="ask-export-links" class="smw-ask-downloadlinks export-links"><div class="smw-ui-pagination"><a href="/wiki/Special:Ask/mainlabel%3D-25/offset%3D0/format%3Djson/link%3Dall/headers%3Dshow/order%3Dasc/sort%3D/limit%3D50/-5B-5BCategory:SA0003-5D-5D/-3FHas-20file-2350px-3Bthumb-3B123/prettyprint%3Dtrue/unescape%3Dtrue/searchlabel%3DJSON" class="page-link" title="Download queried results in JSON format">JSON</a><a href="/wiki/Special:Ask/mainlabel%3D-25/offset%3D0/format%3Dcsv/link%3Dall/headers%3Dshow/order%3Dasc/sort%3D/limit%3D50/-5B-5BCategory:SA0003-5D-5D/-3FHas-20file-2350px-3Bthumb-3B123/prettyprint%3Dtrue/unescape%3Dtrue/searchlabel%3DCSV" class="page-link" title="Download queried results in CSV format">CSV</a><a href="/wiki/Special:Ask/mainlabel%3D-25/offset%3D0/format%3Drss/link%3Dall/headers%3Dshow/order%3Dasc/sort%3D/limit%3D50/-5B-5BCategory:SA0003-5D-5D/-3FHas-20file-2350px-3Bthumb-3B123/prettyprint%3Dtrue/unescape%3Dtrue/searchlabel%3DRSS" class="page-link" title="Download queried results in RSS format">RSS</a><a href="/wiki/Special:Ask/mainlabel%3D-25/offset%3D0/format%3Drdf/link%3Dall/headers%3Dshow/order%3Dasc/sort%3D/limit%3D50/-5B-5BCategory:SA0003-5D-5D/-3FHas-20file-2350px-3Bthumb-3B123/prettyprint%3Dtrue/unescape%3Dtrue/searchlabel%3DRDF" class="page-link" title="Download queried results in RDF format">RDF</a><span id="ask-clipboard " class="page-link" style="vertical-align: top;"><a data-clipboard-action="copy" data-clipboard-target=".clipboard" data-onoi-clipboard-field="value" class="clipboard smw-icon-bookmark" value="http://localhost:8080/index.php?title=Special:Ask&amp;x=-5B-5BCategory%3ASA0003-5D-5D%2F-3FHas-20file-2350px-3Bthumb-3B123&amp;mainlabel=%25&amp;offset=0&amp;format=broadtable&amp;link=all&amp;headers=show&amp;order=asc&amp;sort=&amp;limit=50" title="Copy link to clipboard"></a></span></div></div></div></section><section id="tab-content-smw-askt-extra"><div style="margin-top:15px;margin-bottom:20px;"><h3>Query log</h3><pre>{
    "query_string": "[[Category:SA0003]]",
    "query_source": "SMWSQLStore",
    "query_time": "0.0028",
    "from_cache": false
}</pre></div></section></div></form><div id="result" class="smw-ask-result"><table class="sortable wikitable smwtable broadtable" width="100%"><thead><th class="%">%</th><th class="Has-file"><a href="/index.php?title=Property:Has_file&amp;action=edit&amp;redlink=1" class="new" title="Property:Has file (page does not exist)">Has file</a></th></thead><tbody><tr data-row-number="1" class="row-odd"><td class="% smwtype_wpg"><span class="mw-default-size mw-valign-text-top mw-image-border" typeof="mw:File/Frameless"><a href="/wiki/File:SA0003.png" class="mw-file-description" title="File:SA0003.png"><img alt="File:SA0003.png" src="/images/thumb/0/0b/SA0003.png/300px-SA0003.png" decoding="async" width="300" height="300" class="mw-file-element" srcset="/images/thumb/0/0b/SA0003.png/450px-SA0003.png 1.5x, /images/0/0b/SA0003.png 2x" /></a></span></td><td class="Has-file smwtype_wpg"><span class="mw-default-size mw-valign-text-top mw-image-border" typeof="mw:File/Frameless"><a href="/wiki/File:SA0003.png" class="mw-file-description" title="File:SA0003.png"><img alt="File:SA0003.png" src="/images/thumb/0/0b/SA0003.png/300px-SA0003.png" decoding="async" width="300" height="300" class="mw-file-element" srcset="/images/thumb/0/0b/SA0003.png/450px-SA0003.png 1.5x, /images/0/0b/SA0003.png 2x" /></a></span></td></tr></tbody></table></div></div><div id="ask-help" class="smw-modal plainlinks" style="display:none;"><div class="smw-modal-content"><div class="smw-modal-header"><span class="smw-modal-close">&#215;</span><span class="smw-modal-title">Cheat sheet</span></div><div class="smw-modal-body"><p>This section contains some links to help explain how to use the <code>#ask</code> syntax.
</p>
<ul><li><a rel="nofollow" class="external text" href="https://www.semantic-mediawiki.org/wiki/Help:Selecting_pages">Selecting pages</a> describes how to select pages and build conditions</li></ul>
<ul><li><a rel="nofollow" class="external text" href="https://www.semantic-mediawiki.org/wiki/Help:Search_operators">Search operators</a> lists available search operators including those for range and wildcard queries</li></ul>
<ul><li><a rel="nofollow" class="external text" href="https://www.semantic-mediawiki.org/wiki/Help:Displaying_information">Displaying information</a> outlines the use of printout statements and formatting options</li></ul><div class="strike" style="padding: 5px 0 5px 0;"><span style="font-size: 1.2em; margin-left:0px">Format</span><ul><li class="smw-ask-format-help-link"><a rel="nofollow" class="external text" href="https://www.semantic-mediawiki.org/wiki/Help:broadtable_format">broadtable</a> format</li></ul></div><div class="strike" style="padding: 5px 0 5px 0;"><span style="font-size: 1.2em; margin-left:0px">Input assistance</span></div><a rel="nofollow" class="external text" href="https://www.semantic-mediawiki.org/wiki/Help:Input_assistance">Input assistance</a> is provided for the printout, sort, and condition field. The condition field requires to use one of following prefixes:<ul><li><code>p:</code> to fetch property suggestions (e.g. <code>[[p:Has ...</code>)</li><li><code>c:</code> to fetch category suggestions</li><li><code>con:</code> to fetch concept suggestions</li></ul></div><div class="smw-modal-footer"></div></div></div>
==== (StringContains expected) ====
[ width="50" ]

Failed asserting that 2 matches expected 3.

/var/www/html/extensions/SemanticMediaWiki/tests/phpunit/Utils/Validators/StringValidator.php:76
/var/www/html/extensions/SemanticMediaWiki/tests/phpunit/Utils/Validators/StringValidator.php:31
/var/www/html/extensions/SemanticMediaWiki/tests/phpunit/Utils/JSONScript/SpecialPageTestCaseProcessor.php:152
/var/www/html/extensions/SemanticMediaWiki/tests/phpunit/Utils/JSONScript/SpecialPageTestCaseProcessor.php:94
/var/www/html/extensions/SemanticMediaWiki/tests/phpunit/JSONScriptServicesTestCaseRunner.php:380
/var/www/html/extensions/SemanticMediaWiki/tests/phpunit/JSONScriptServicesTestCaseRunner.php:121
/var/www/html/extensions/SemanticMediaWiki/tests/phpunit/JSONScriptTestCaseRunner.php:183

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

prefix parameter does not work in combination with link parameter

4 participants