User Tools

Site Tools


Sidebar

Hello!

Start here!

Download

Loki Semantic Wiki

BiFröST Framework

Semantic Business Platform

BPWiki

SBVRwiki

Other Projects



tests:loki-queries:ask
startSectionEdit: $data "section" is NOT an array! One of your plugins needs an update.
startSectionEdit: $data "section" is NOT an array! One of your plugins needs an update.
startSectionEdit: $data "section" is NOT an array! One of your plugins needs an update.
startSectionEdit: $data "section" is NOT an array! One of your plugins needs an update.
startSectionEdit: $data "section" is NOT an array! One of your plugins needs an update.

Tests: Loki ASK Queries

  • Delete lib/plugins/loki/temp/loki/tests/loki-ask.txt file before tests
  • Tests are performed manually - you have to compare if sections “Expected result” and “Actual result” represent the same thing!

Standard table results

Description: Simple table with results and additional headers. All elements in querytest category are shown.

Code:

{{#ask: [[category:querytest]] |
?test_title=Title |
?test_year=Year |
?test_lang |
?test_location |
?test_length |
?test_other_page |
default=No results! |
mainlabel=Main label |
intro=Text before results |
outro=Text after results
}}

Expected result:

Text before results

Main label Title Year Test_lang Test_location Test_length Test_other_page
page1 Długi tytuł testowy 2015 english polish 100 page2
page2 1900 internet 140 nonexisting-page
page1
page3 Krzysztof Trzeci Kutt homepage 2013
2016
123
124
ask
sparql
page4 Lorem Ipsum! 1410 latin Wszędzie 666
page5 Pięć Cztery Trzy Dwa Jeden 1633 latin Kraków
Moskwa
1234
page6 I jeszcze jeden test 1999 polish Kraków abc
page7 Miejsce na twoją reklamę dzisiaj english internet 1 page1

Text after results

Actual result:

Text before resultsNo results!Text after results

Results as a list

Description: Results as a enumeration + AND and OR conjunctions used in query. Query lists all pages which have test_length equal 1 or 123.

Code:

{{#ask: [[category:querytest]] [[test_length:=1||123]] |
?test_title=Title |
?test_lang |
?test_length |
default=No results! |
format=ol
}}

Expected result:

Nazwy stron i nazwy atrybutów powinny być linkami (nazwy stron do istniejących stron, nazwy atrybutów do nieistniejących stron tych atrybutów)

  1. page3 (Title Krzysztof Trzeci Kutt homepage, Test_lang , Test_length 123, 124, )
  2. page7 (Title Miejsce na twoją reklamę, Test_lang english, Test_length 1, )

Test:

No results!

Subqueries

Opis: Subqueries + result as a row count. Subquery returns pages which have test_lang equal to english → page1 and page7. Next, “external” query returns pages that have test_other_page set to found pages page1 or page7 → page2 and page7. Result is displayed as a row count → 2.

Code:

{{#ask: [[category:querytest]] [[test_other_page::<q>[[category:querytest]] [[test_lang:=english]]</q>]] |
?test_title=Title |
?test_lang |
?test_length |
default=No results! |
format=count
}}

Expected result:

2

Actual result:

0

Partial tables

Opis: Row sort (lexically, 100 is before 2) + partial table using offset and limit; here results consist of 7 rows; we simulate showing 2nd page, with 3 results on each (so, we show rows 4-6) + links not placed in results

Code:

{{#ask: [[category:querytest]] |
?test_title=Title |
?test_length |
?test_other_page |
default=No results! |
sort=test_length |
link=none |
limit=3 |
offset=4
}}

Expected result:

Title Test_length Test_other_page
tests:loki-queries:page2 140 tests:loki-queries:nonexist-page
tests:loki-queries:page1
tests:loki-queries:page4 Lorem Ipsum! 666
tests:loki-queries:page5 Pięć Cztery Trzy Dwa Jeden 1234

Actual result:

No results!



tests/loki-queries/ask.txt · Last modified: 2022/03/23 16:59 (external edit)