diff --git a/CHANGELOG.md b/CHANGELOG.md index ad716e32..71bd57fb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +### Added + +- A group of generic query examples was added (#135). +- Some icons for well known query groups were added (#146). + ## [1.2.2] - 2024-06-27 ### Added diff --git a/cypress/e2e/custom-query-editor.cy.js b/cypress/e2e/custom-query-editor.cy.js index 831f326b..d5d78d7f 100644 --- a/cypress/e2e/custom-query-editor.cy.js +++ b/cypress/e2e/custom-query-editor.cy.js @@ -43,8 +43,8 @@ PREFIX oo: PREFIX ao: PREFIX rdf: PREFIX rdfs: -PREFIX d: -PREFIX o: +PREFIX d: +PREFIX o: SELECT DISTINCT ?component ?componentName ?recycledContentPercentage WHERE { @@ -60,7 +60,7 @@ ORDER BY ?componentName cy.get('button[type="submit"]').click(); // Checking if the query works - cy.contains("http://www/example.com/data/component-c01").should('exist'); + cy.contains("https://www.example.com/data/component-c01").should('exist'); }); it("Check if all possible parameters are filled in with parameterized URL", () => { @@ -227,8 +227,8 @@ PREFIX oo: PREFIX ao: PREFIX rdf: PREFIX rdfs: -PREFIX d: -PREFIX o: +PREFIX d: +PREFIX o: SELECT ?component ?componentName ?material ?materialName ?percentage WHERE { @@ -263,7 +263,7 @@ WHERE { ) cy.get('button[type="submit"]').click(); - cy.contains("http://www/example.com/data/component-c01").should('exist'); + cy.contains("https://www.example.com/data/component-c01").should('exist'); }) diff --git a/cypress/e2e/fetch-status.cy.js b/cypress/e2e/fetch-status.cy.js index 9f85db78..ae85c3d8 100644 --- a/cypress/e2e/fetch-status.cy.js +++ b/cypress/e2e/fetch-status.cy.js @@ -42,10 +42,12 @@ describe("Fetch Status", () => { cy.get('input[name="idp"]').type("http://localhost:8080"); cy.contains("Login").click(); - cy.get("input#email").type("hello@example.com"); - cy.get("input#password").type("abc123"); - cy.contains("button", "Log in").click(); - cy.contains("button", "Authorize").click(); + cy.origin('http://localhost:8080', () => { + cy.get("input#email").type("hello@example.com"); + cy.get("input#password").type("abc123"); + cy.contains("button", "Log in").click(); + cy.contains("button", "Authorize").click(); + }); cy.url().should("eq", "http://localhost:5173/"); diff --git a/cypress/e2e/log-in.cy.js b/cypress/e2e/log-in.cy.js index d067850d..23054637 100644 --- a/cypress/e2e/log-in.cy.js +++ b/cypress/e2e/log-in.cy.js @@ -41,10 +41,12 @@ describe("Log in", () => { .type("http://localhost:8080/example/profile/card#me"); cy.contains("Login").click(); - cy.get("input#email").type("hello@example.com"); - cy.get("input#password").type("abc123"); - cy.contains("button", "Log in").click(); - cy.contains("button", "Authorize").click(); + cy.origin('http://localhost:8080', () => { + cy.get("input#email").type("hello@example.com"); + cy.get("input#password").type("abc123"); + cy.contains("button", "Log in").click(); + cy.contains("button", "Authorize").click(); + }); cy.url().should("eq", "http://localhost:5173/"); }); @@ -74,11 +76,13 @@ describe("Log in", () => { cy.get('input[name="idp"]').type("http://localhost:8080"); cy.contains("Login").click(); - cy.get("input#email").type("hello@example.com"); - cy.get("input#password").type("abc123"); - cy.contains("button", "Log in").click(); - cy.contains("button", "Authorize").click(); - + cy.origin('http://localhost:8080', () => { + cy.get("input#email").type("hello@example.com"); + cy.get("input#password").type("abc123"); + cy.contains("button", "Log in").click(); + cy.contains("button", "Authorize").click(); + }); + cy.url().should("eq", "http://localhost:5173/"); cy.contains("General examples").click(); diff --git a/cypress/e2e/sources-from-indexfile.cy.js b/cypress/e2e/sources-from-indexfile.cy.js index 962ed0e3..a5f7012a 100644 --- a/cypress/e2e/sources-from-indexfile.cy.js +++ b/cypress/e2e/sources-from-indexfile.cy.js @@ -14,7 +14,7 @@ describe("Sources from index file", () => { cy.get('.information-box').contains('Sources: 3'); // Check if correct data is displayed - cy.contains("http://www/example.com/data/component-c01"); + cy.contains("https://www.example.com/data/component-c01"); cy.contains("Component 1"); cy.contains("Material 1"); }); @@ -33,7 +33,7 @@ describe("Sources from index file", () => { cy.get('.information-box').contains('Sources: 4'); // Check if correct data is still displayed even if one source was unauthorized - cy.contains("http://www/example.com/data/component-c01"); + cy.contains("https://www.example.com/data/component-c01"); cy.contains("Component 1"); cy.contains("Material 1"); }); @@ -52,7 +52,7 @@ describe("Sources from index file", () => { cy.get('.information-box').contains('Sources: 4'); // Check if correct data is still displayed even if one source was unauthorized and different sources were merged - cy.contains("http://www/example.com/data/component-c01"); + cy.contains("https://www.example.com/data/component-c01"); cy.contains("Component 1"); cy.contains("Material 1"); }); @@ -72,7 +72,7 @@ describe("Sources from index file", () => { }); - cy.contains("http://www/example.com/data/component-c01").should("not.exist"); + cy.contains("https://www.example.com/data/component-c01").should("not.exist"); cy.contains("Component 1").should("not.exist"); cy.contains("Material 1").should("not.exist"); @@ -86,18 +86,20 @@ describe("Sources from index file", () => { .type("http://localhost:8080/example/profile/card#me"); cy.contains("Login").click(); - cy.get("input#email").type("hello@example.com"); - cy.get("input#password").type("abc123"); - cy.contains("button", "Log in").click(); - cy.contains("button", "Authorize").click(); - + cy.origin('http://localhost:8080', () => { + cy.get("input#email").type("hello@example.com"); + cy.get("input#password").type("abc123"); + cy.contains("button", "Log in").click(); + cy.contains("button", "Authorize").click(); + }); + cy.url().should("eq", "http://localhost:5173/"); //now try again cy.contains("For testing only").click(); cy.contains("Sources from an index file (requiring authentication)").click(); - cy.contains("http://www/example.com/data/component-c01").should("not.exist"); + cy.contains("https://www.example.com/data/component-c01").should("not.exist"); cy.contains("Component 1").should("exist"); cy.contains("Material 1").should("exist"); }) diff --git a/cypress/e2e/sources-info.cy.js b/cypress/e2e/sources-info.cy.js index 537f9927..02961852 100644 --- a/cypress/e2e/sources-info.cy.js +++ b/cypress/e2e/sources-info.cy.js @@ -56,10 +56,12 @@ describe("Sources info", () => { cy.get('input[name="idp"]').type("http://localhost:8080"); cy.contains("Login").click(); - cy.get("input#email").type("hello@example.com"); - cy.get("input#password").type("abc123"); - cy.contains("button", "Log in").click(); - cy.contains("button", "Authorize").click(); + cy.origin('http://localhost:8080', () => { + cy.get("input#email").type("hello@example.com"); + cy.get("input#password").type("abc123"); + cy.contains("button", "Log in").click(); + cy.contains("button", "Authorize").click(); + }); cy.url().should("eq", "http://localhost:5173/"); diff --git a/initial-pod-data/boms$.ttl b/initial-pod-data/boms$.ttl index 1155e2ee..22e7fc3e 100644 --- a/initial-pod-data/boms$.ttl +++ b/initial-pod-data/boms$.ttl @@ -1,58 +1,58 @@ - a ; - , - , . - - a ; - , - , , - , , - . - - a ; - , - . - - a ; - ; - 60 . - - a ; - ; - 30 . - - a ; - ; - 10 . - - a ; - ; - 40 . - - a ; - ; - 20 . - - a ; - ; - 25 . - - a ; - ; - 7 . - - a ; - ; - 5 . - - a ; - ; - 3 . - - a ; - ; - 85 . - - a ; - ; - 15 . + a ; + , + , . + + a ; + , + , , + , , + . + + a ; + , + . + + a ; + ; + 60 . + + a ; + ; + 30 . + + a ; + ; + 10 . + + a ; + ; + 40 . + + a ; + ; + 20 . + + a ; + ; + 25 . + + a ; + ; + 7 . + + a ; + ; + 5 . + + a ; + ; + 3 . + + a ; + ; + 85 . + + a ; + ; + 15 . diff --git a/initial-pod-data/components$.ttl b/initial-pod-data/components$.ttl index c79e9915..5fdf77c1 100644 --- a/initial-pod-data/components$.ttl +++ b/initial-pod-data/components$.ttl @@ -1,15 +1,15 @@ - a ; - ; - "Component 1"; - 80 . + a ; + ; + "Component 1"; + 80 . - a ; - ; - "Component 2"; - 20 . + a ; + ; + "Component 2"; + 20 . - a ; - ; - "Component 3"; - 0 . + a ; + ; + "Component 3"; + 0 . diff --git a/initial-pod-data/materials$.ttl b/initial-pod-data/materials$.ttl index e16e068c..2a4998d7 100644 --- a/initial-pod-data/materials$.ttl +++ b/initial-pod-data/materials$.ttl @@ -1,33 +1,33 @@ - a ; - "Material 1" . + a ; + "Material 1" . - a ; - "Material 2" . + a ; + "Material 2" . - a ; - "Material 3" . + a ; + "Material 3" . - a ; - "Material 4" . + a ; + "Material 4" . - a ; - "Material 5" . + a ; + "Material 5" . - a ; - "Material 6" . + a ; + "Material 6" . - a ; - "Material 7" . + a ; + "Material 7" . - a ; - "Material 8" . + a ; + "Material 8" . - a ; - "Material 9" . + a ; + "Material 9" . - a ; - "Material 10" . + a ; + "Material 10" . - a ; - "Material 11" . + a ; + "Material 11" . diff --git a/public/queries/components.rq b/public/queries/components.rq index bc44caa2..5614b57c 100644 --- a/public/queries/components.rq +++ b/public/queries/components.rq @@ -5,8 +5,8 @@ PREFIX oo: PREFIX ao: PREFIX rdf: PREFIX rdfs: -PREFIX d: -PREFIX o: +PREFIX d: +PREFIX o: SELECT DISTINCT ?component ?componentName ?recycledContentPercentage WHERE { diff --git a/public/queries/components_materials.rq b/public/queries/components_materials.rq index 659a2ade..09d4ac53 100644 --- a/public/queries/components_materials.rq +++ b/public/queries/components_materials.rq @@ -5,8 +5,8 @@ PREFIX oo: PREFIX ao: PREFIX rdf: PREFIX rdfs: -PREFIX d: -PREFIX o: +PREFIX d: +PREFIX o: SELECT ?component ?componentName ?material ?materialName ?percentage WHERE { diff --git a/public/queries/example_count_spo.rq b/public/queries/example_count_spo.rq new file mode 100644 index 00000000..f5de10a8 --- /dev/null +++ b/public/queries/example_count_spo.rq @@ -0,0 +1,3 @@ +SELECT (COUNT (*) AS ?count) WHERE { + ?subject ?predicate ?object +} diff --git a/public/queries/example_o.rq b/public/queries/example_o.rq new file mode 100644 index 00000000..5f9d2e6c --- /dev/null +++ b/public/queries/example_o.rq @@ -0,0 +1,5 @@ +SELECT DISTINCT ?object WHERE { + ?subject ?predicate ?object +} +ORDER BY ?object +LIMIT 50 \ No newline at end of file diff --git a/public/queries/example_p.rq b/public/queries/example_p.rq new file mode 100644 index 00000000..54a4fa4e --- /dev/null +++ b/public/queries/example_p.rq @@ -0,0 +1,5 @@ +SELECT DISTINCT ?predicate WHERE { + ?subject ?predicate ?object +} +ORDER BY ?predicate +LIMIT 50 \ No newline at end of file diff --git a/public/queries/example_s.rq b/public/queries/example_s.rq new file mode 100644 index 00000000..93f80ceb --- /dev/null +++ b/public/queries/example_s.rq @@ -0,0 +1,5 @@ +SELECT DISTINCT ?subject WHERE { + ?subject ?predicate ?object +} +ORDER BY ?subject +LIMIT 50 \ No newline at end of file diff --git a/public/queries/example_spo.rq b/public/queries/example_spo.rq new file mode 100644 index 00000000..103678ea --- /dev/null +++ b/public/queries/example_spo.rq @@ -0,0 +1,5 @@ +SELECT DISTINCT ?subject ?predicate ?object WHERE { + ?subject ?predicate ?object +} +ORDER BY ?subject ?predicate ?object +LIMIT 50 diff --git a/public/queries/example_spox.rq b/public/queries/example_spox.rq new file mode 100644 index 00000000..8eed0cc7 --- /dev/null +++ b/public/queries/example_spox.rq @@ -0,0 +1,6 @@ +SELECT DISTINCT ?subject ?predicate ?object WHERE { + ?subject ?predicate ?object + FILTER(?object = $object) +} +ORDER BY ?subject ?predicate +LIMIT 50 \ No newline at end of file diff --git a/public/queries/example_spxo.rq b/public/queries/example_spxo.rq new file mode 100644 index 00000000..88bae375 --- /dev/null +++ b/public/queries/example_spxo.rq @@ -0,0 +1,6 @@ +SELECT DISTINCT ?subject ?predicate ?object WHERE { + ?subject ?predicate ?object + FILTER(?predicate = $predicate) +} +ORDER BY ?subject ?object +LIMIT 50 \ No newline at end of file diff --git a/public/queries/example_sxpo.rq b/public/queries/example_sxpo.rq new file mode 100644 index 00000000..8f7127e1 --- /dev/null +++ b/public/queries/example_sxpo.rq @@ -0,0 +1,6 @@ +SELECT DISTINCT ?subject ?predicate ?object WHERE { + ?subject ?predicate ?object + FILTER(?subject = $subject) +} +ORDER BY ?predicate ?object +LIMIT 50 \ No newline at end of file diff --git a/public/queries/example_type.rq b/public/queries/example_type.rq new file mode 100644 index 00000000..39a629f0 --- /dev/null +++ b/public/queries/example_type.rq @@ -0,0 +1,5 @@ +SELECT DISTINCT ?term WHERE { + ?term $type +} +ORDER BY ?term +LIMIT 50 diff --git a/public/queries/texon_index_test.rq b/public/queries/texon_index_test.rq deleted file mode 100644 index 8d5f7fe4..00000000 --- a/public/queries/texon_index_test.rq +++ /dev/null @@ -1,24 +0,0 @@ -# Query Texon's components and their materials - -PREFIX oo: -PREFIX ao: -PREFIX rdf: -PREFIX rdfs: -PREFIX d: -PREFIX o: - -SELECT ?component ?componentName ?material ?materialName ?percentage -WHERE { - ?component - a o:Component ; - o:name ?componentName ; - o:has-component-bom [ - o:has-component-material-assoc [ - o:percentage ?percentage ; - o:has-material ?material ; - ]; - ]; - . - ?material o:name ?materialName ; -} -ORDER BY ?componentName diff --git a/src/IconProvider/IconProvider.js b/src/IconProvider/IconProvider.js index 972f2719..753bf91a 100644 --- a/src/IconProvider/IconProvider.js +++ b/src/IconProvider/IconProvider.js @@ -7,6 +7,8 @@ import ListAltIcon from '@mui/icons-material/ListAlt'; import FactoryIcon from '@mui/icons-material/Factory'; import BugReportIcon from '@mui/icons-material/BugReport'; import ConstructionIcon from '@mui/icons-material/Construction'; +import CheckroomIcon from '@mui/icons-material/Checkroom'; +import ElectricBoltIcon from '@mui/icons-material/ElectricBolt'; import EditNoteIcon from '@mui/icons-material/EditNote'; import AutoAwesomeIcon from '@mui/icons-material/AutoAwesome'; import AddIcon from '@mui/icons-material/Add'; @@ -17,6 +19,7 @@ import SaveIcon from '@mui/icons-material/Save'; import ModeEditIcon from '@mui/icons-material/ModeEdit'; import TuneIcon from '@mui/icons-material/Tune'; import SaveAsIcon from '@mui/icons-material/SaveAs'; +import InfoIcon from '@mui/icons-material/Info'; export default { BrushIcon, @@ -28,6 +31,8 @@ export default { FactoryIcon, BugReportIcon, ConstructionIcon, + CheckroomIcon, + ElectricBoltIcon, EditNoteIcon, AutoAwesomeIcon, AddIcon, @@ -37,5 +42,6 @@ export default { SaveIcon, ModeEditIcon, TuneIcon, - SaveAsIcon + SaveAsIcon, + InfoIcon }; diff --git a/src/config.json b/src/config.json index 746e2473..0e63e10f 100644 --- a/src/config.json +++ b/src/config.json @@ -26,6 +26,11 @@ "id": "c-tst", "name": "For testing only", "icon": "BugReportIcon" + }, + { + "id": "d-gqx", + "name": "Generic query examples", + "icon": "InfoIcon" } ], "queries": [ @@ -301,6 +306,181 @@ "comunicaContext": { "sources": ["http://localhost:8080/example/dup1"] } + }, + { + "id": "10000", + "queryGroupId": "d-gqx", + "queryLocation": "example_count_spo.rq", + "name": "Count", + "description": "Gives the count of triples in the indicated datasources", + "comunicaContext": { + "sources": [ + "http://localhost:8080/example/components", + "http://localhost:8080/example/boms", + "http://localhost:8080/example/materials" + ], + "lenient": true + } + }, + { + "id": "10001", + "queryGroupId": "d-gqx", + "queryLocation": "example_spo.rq", + "name": "Triples", + "description": "Gives at most 50 triples in the indicated datasources", + "comunicaContext": { + "sources": [ + "http://localhost:8080/example/components", + "http://localhost:8080/example/boms", + "http://localhost:8080/example/materials" + ], + "lenient": true + } + }, + { + "id": "10002", + "queryGroupId": "d-gqx", + "queryLocation": "example_s.rq", + "name": "Subjects", + "description": "Gives at most 50 subjects in the indicated datasources", + "comunicaContext": { + "sources": [ + "http://localhost:8080/example/components", + "http://localhost:8080/example/boms", + "http://localhost:8080/example/materials" + ], + "lenient": true + } + }, + { + "id": "10003", + "queryGroupId": "d-gqx", + "queryLocation": "example_p.rq", + "name": "Predicates", + "description": "Gives at most 50 predicates in the indicated datasources", + "comunicaContext": { + "sources": [ + "http://localhost:8080/example/components", + "http://localhost:8080/example/boms", + "http://localhost:8080/example/materials" + ], + "lenient": true + } + }, + { + "id": "10004", + "queryGroupId": "d-gqx", + "queryLocation": "example_o.rq", + "name": "Objects", + "description": "Gives at most 50 objects in the indicated datasources", + "comunicaContext": { + "sources": [ + "http://localhost:8080/example/components", + "http://localhost:8080/example/boms", + "http://localhost:8080/example/materials" + ], + "lenient": true + } + }, + { + "id": "10005", + "queryGroupId": "d-gqx", + "queryLocation": "example_sxpo.rq", + "name": "Triples with subject", + "description": "Gives at most 50 triples with a given subject in the indicated datasources", + "variables": { + "subject": [ + "", + "", + "", + "" + ] + }, + "comunicaContext": { + "sources": [ + "http://localhost:8080/example/components", + "http://localhost:8080/example/boms", + "http://localhost:8080/example/materials" + ], + "lenient": true + } + }, + { + "id": "10006", + "queryGroupId": "d-gqx", + "queryLocation": "example_spxo.rq", + "name": "Triples with predicate", + "description": "Gives at most 50 triples with a given predicate in the indicated datasources", + "variables": { + "predicate": [ + "", + "", + "", + "", + "", + "" + ] + }, + "comunicaContext": { + "sources": [ + "http://localhost:8080/example/components", + "http://localhost:8080/example/boms", + "http://localhost:8080/example/materials" + ], + "lenient": true + } + }, + { + "id": "10007", + "queryGroupId": "d-gqx", + "queryLocation": "example_spox.rq", + "name": "Triples with object", + "description": "Gives at most 50 triples with a given object in the indicated datasources", + "variables": { + "object": [ + "", + "", + "", + "", + "", + "", + "0", + "20", + "80", + "\"Component 1\"", + "\"Material 1\"" + ] + }, + "comunicaContext": { + "sources": [ + "http://localhost:8080/example/components", + "http://localhost:8080/example/boms", + "http://localhost:8080/example/materials" + ], + "lenient": true + } + }, + { + "id": "10008", + "queryGroupId": "d-gqx", + "queryLocation": "example_type.rq", + "name": "Terms of type", + "description": "Gives at most 50 terms of a given rdf:type in the indicated datasources", + "variables": { + "type": [ + "", + "", + "" + ] + }, + "comunicaContext": { + "sources": [ + "http://localhost:8080/example/components", + "http://localhost:8080/example/boms", + "http://localhost:8080/example/materials" + ], + "lenient": true + } } ] }