Skip to content

Commit a297298

Browse files
authored
Fix pagination when using DISTINCT, OFFSET, LIMIT in any combination in a query (#115)
Fixed DISTINCT, OFFSET, LIMIT queries
1 parent d6ed163 commit a297298

File tree

14 files changed

+205
-49
lines changed

14 files changed

+205
-49
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
2222
### Fixed
2323

2424
- Query menu is now scrollable (#102)
25+
- Pagination is correct when using a query using DISTINCT, OFFSET, LIMIT (#110, #19)
2526

2627
### Removed
2728

cypress/e2e/no-duplicates.cy.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
describe("No duplicates", () => {
2+
it("When sources contain identical triples, duplicates should not be counted in a SELECT DISTINCT query", () => {
3+
cy.visit("/");
4+
5+
cy.contains("A test on DISTINCT LIMIT OFFSET").click();
6+
cy.contains("1-10 of 36");
7+
cy.contains("http://www.example.com/data#s00").should("not.exist");
8+
9+
cy.get('.MuiPagination-ul > :nth-child(5)').click();
10+
cy.contains("31-36 of 36");
11+
cy.contains("http://www.example.com/data#s19").should("not.exist");
12+
});
13+
});

cypress/e2e/sources-from-indexfile.cy.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ describe("Sources from index file", () => {
44
cy.visit("/");
55

66
// Navigate to correct query
7-
cy.contains("Components and materials with sources from only the index file").click();
7+
cy.contains("Components and their materials, with sources from only the index file").click();
88

99
// Check that it finished
1010
cy.contains("Finished in:");
@@ -22,7 +22,7 @@ describe("Sources from index file", () => {
2222
cy.visit("/");
2323

2424
// Navigate to correct query
25-
cy.contains("Components and materials with sources from index file also containing an unauthorized source").click();
25+
cy.contains("Components and their materials, with sources from index file also containing an unauthorized source").click();
2626

2727
// Check that the query finished
2828
cy.contains("Finished in:");
@@ -40,7 +40,7 @@ describe("Sources from index file", () => {
4040
cy.visit("/");
4141

4242
// Navigate to correct query
43-
cy.contains("Components with mixed sources from comunicaContext and index file").click();
43+
cy.contains("Components and their materials, with mixed sources from comunicaContext and index file").click();
4444

4545
// Check that the query finished
4646
cy.contains("Finished in:");

cypress/e2e/verify-source.cy.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ describe("Verify source", () => {
22
it("Verification button exists and returns correct result", () => {
33
cy.visit("/");
44

5-
cy.contains("Verifiable Components").click();
5+
cy.contains("Components, with source verification").click();
66

77
cy.get('[aria-label="Sources info"]').click();
88

initial-pod-data/dup1$.ttl

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
2+
@prefix onto: <http://www.example.com/onto#> .
3+
@prefix ex: <http://www.example.com/data#> .
4+
5+
ex:s00 onto:p01 ex:o00 .
6+
ex:s01 onto:p01 ex:o01 .
7+
ex:s02 onto:p01 ex:o02 .
8+
ex:s03 onto:p01 ex:o03 .
9+
ex:s04 onto:p01 ex:o04 .
10+
ex:s05 onto:p01 ex:o05 .
11+
ex:s06 onto:p01 ex:o06 .
12+
ex:s07 onto:p01 ex:o07 .
13+
ex:s08 onto:p01 ex:o08 .
14+
ex:s09 onto:p01 ex:o09 .
15+
ex:s10 onto:p01 ex:o10 .
16+
ex:s11 onto:p01 ex:o11 .
17+
ex:s12 onto:p01 ex:o12 .
18+
ex:s13 onto:p01 ex:o13 .
19+
ex:s14 onto:p01 ex:o14 .
20+
ex:s15 onto:p01 ex:o15 .
21+
ex:s16 onto:p01 ex:o16 .
22+
ex:s17 onto:p01 ex:o17 .
23+
ex:s18 onto:p01 ex:o18 .
24+
ex:s19 onto:p01 ex:o19 .
25+
26+
ex:s00 onto:p02 ex:o00 .
27+
ex:s01 onto:p02 ex:o01 .
28+
ex:s02 onto:p02 ex:o02 .
29+
ex:s03 onto:p02 ex:o03 .
30+
ex:s04 onto:p02 ex:o04 .
31+
ex:s05 onto:p02 ex:o05 .
32+
ex:s06 onto:p02 ex:o06 .
33+
ex:s07 onto:p02 ex:o07 .
34+
ex:s08 onto:p02 ex:o08 .
35+
ex:s09 onto:p02 ex:o09 .
36+
ex:s10 onto:p02 ex:o10 .
37+
ex:s11 onto:p02 ex:o11 .
38+
ex:s12 onto:p02 ex:o12 .
39+
ex:s13 onto:p02 ex:o13 .
40+
ex:s14 onto:p02 ex:o14 .
41+
ex:s15 onto:p02 ex:o15 .
42+
ex:s16 onto:p02 ex:o16 .
43+
ex:s17 onto:p02 ex:o17 .
44+
ex:s18 onto:p02 ex:o18 .
45+
ex:s19 onto:p02 ex:o19 .

initial-pod-data/dup1.acl

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
@prefix acl: <http://www.w3.org/ns/auth/acl#>.
2+
@prefix foaf: <http://xmlns.com/foaf/0.1/>.
3+
4+
<#public>
5+
a acl:Authorization;
6+
acl:accessTo <./dup1>;
7+
acl:agentClass foaf:Agent;
8+
acl:mode acl:Read.
9+
10+
<#owner>
11+
a acl:Authorization;
12+
acl:accessTo <./dup1>;
13+
acl:agent <http://localhost:8080/example/profile/card#me>;
14+
acl:mode acl:Read, acl:Write, acl:Control.

initial-pod-data/dup2$.ttl

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
2+
@prefix onto: <http://www.example.com/onto#> .
3+
@prefix ex: <http://www.example.com/data#> .
4+
5+
ex:s00 onto:p01 ex:o00 .
6+
ex:s01 onto:p01 ex:o01 .
7+
ex:s02 onto:p01 ex:o02 .
8+
ex:s03 onto:p01 ex:o03 .
9+
ex:s04 onto:p01 ex:o04 .
10+
ex:s05 onto:p01 ex:o05 .
11+
ex:s06 onto:p01 ex:o06 .
12+
ex:s07 onto:p01 ex:o07 .
13+
ex:s08 onto:p01 ex:o08 .
14+
ex:s09 onto:p01 ex:o09 .
15+
ex:s10 onto:p01 ex:o10 .
16+
ex:s11 onto:p01 ex:o11 .
17+
ex:s12 onto:p01 ex:o12 .
18+
ex:s13 onto:p01 ex:o13 .
19+
ex:s14 onto:p01 ex:o14 .
20+
ex:s15 onto:p01 ex:o15 .
21+
ex:s16 onto:p01 ex:o16 .
22+
ex:s17 onto:p01 ex:o17 .
23+
ex:s18 onto:p01 ex:o18 .
24+
ex:s19 onto:p01 ex:o19 .
25+
26+
ex:s00 onto:p02 ex:o00 .
27+
ex:s01 onto:p02 ex:o01 .
28+
ex:s02 onto:p02 ex:o02 .
29+
ex:s03 onto:p02 ex:o03 .
30+
ex:s04 onto:p02 ex:o04 .
31+
ex:s05 onto:p02 ex:o05 .
32+
ex:s06 onto:p02 ex:o06 .
33+
ex:s07 onto:p02 ex:o07 .
34+
ex:s08 onto:p02 ex:o08 .
35+
ex:s09 onto:p02 ex:o09 .
36+
ex:s10 onto:p02 ex:o10 .
37+
ex:s11 onto:p02 ex:o11 .
38+
ex:s12 onto:p02 ex:o12 .
39+
ex:s13 onto:p02 ex:o13 .
40+
ex:s14 onto:p02 ex:o14 .
41+
ex:s15 onto:p02 ex:o15 .
42+
ex:s16 onto:p02 ex:o16 .
43+
ex:s17 onto:p02 ex:o17 .
44+
ex:s18 onto:p02 ex:o18 .
45+
ex:s19 onto:p02 ex:o19 .

initial-pod-data/dup2.acl

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
@prefix acl: <http://www.w3.org/ns/auth/acl#>.
2+
@prefix foaf: <http://xmlns.com/foaf/0.1/>.
3+
4+
<#public>
5+
a acl:Authorization;
6+
acl:accessTo <./dup2>;
7+
acl:agentClass foaf:Agent;
8+
acl:mode acl:Read.
9+
10+
<#owner>
11+
a acl:Authorization;
12+
acl:accessTo <./dup2>;
13+
acl:agent <http://localhost:8080/example/profile/card#me>;
14+
acl:mode acl:Read, acl:Write, acl:Control.

public/queries/components.rq

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
88
PREFIX d: <http://www/example.com/data/>
99
PREFIX o: <http://www/example.com/ont/>
1010

11-
SELECT ?component ?componentName ?recycledContentPercentage
11+
SELECT DISTINCT ?component ?componentName ?recycledContentPercentage
1212
WHERE {
1313
?component
1414
a o:Component ;

public/queries/gspo.rq

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
SELECT * WHERE {
1+
SELECT ?s ?p ?o ?g WHERE {
22
GRAPH ?g {?s ?p ?o}
33
}

0 commit comments

Comments
 (0)