Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Fixed
- Aggregating SPARQL queries work now (#70).
- Sources' fetch status is consistent now (#59).

### Removed

Expand Down
2 changes: 1 addition & 1 deletion cypress/e2e/aggregating-query.cy.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
describe("Aggregating query", () => {
it("AVG() function", () => {
it("AVG() function - see https://github.com/SolidLabResearch/generic-data-viewer-react-admin/issues/70", () => {
cy.visit("/");

cy.contains("Average value").click();
Expand Down
31 changes: 24 additions & 7 deletions cypress/e2e/sources-info.cy.js
Original file line number Diff line number Diff line change
@@ -1,25 +1,42 @@
describe("Sources info", () => {
it("Fetch status on query failed", () => {
it("Fetch status on fetch failure", () => {
cy.visit("/");

cy.contains("My favourite musicians").click();
cy.contains("Finished in:");
cy.get('[aria-label="Sources info"]').click();

cy.get('[aria-label="Query failed"]').should("exist");
cy.get('[aria-label="Fetch failed"]').should("exist");
});

it("Fetch status on query success", () => {
it("Fetch status on fetch success", () => {
cy.visit("/");

cy.contains("My wish list").click();
cy.contains("Finished in:");
cy.get('[aria-label="Sources info"]').click();

cy.get('[aria-label="Query was succesful"]').should("exist");
cy.get('[aria-label="Fetch was succesful"]').should("exist");
});

it("Authentication needed for query on public data", () => {
it("Fetch status on cached source - see https://github.com/SolidLabResearch/generic-data-viewer-react-admin/issues/59", () => {
cy.visit("/");

cy.contains("Components").click();
cy.contains("Finished in:");
cy.get('[aria-label="Sources info"]').click();

cy.get('[aria-label="Fetch was succesful"]').should("exist");

cy.contains("Components and their materials").click();
cy.contains("Finished in:");
cy.get('[aria-label="Sources info"]').click();

cy.get('[aria-label="Fetch was succesful"]').should("exist");
cy.get('[aria-label="Fetch failed"]').should("not.exist");
});

it("Authentication not required for query on public data", () => {
cy.visit("/");

cy.contains("My wish list").click();
Expand All @@ -29,7 +46,7 @@ describe("Sources info", () => {
cy.get('[aria-label="No authentication required"]').should("exist");
});

it("Authentication needed for query on private data", () => {
it("Authentication required for query on private data", () => {
cy.visit("/");

cy.get('[aria-label="Profile"]').click();
Expand All @@ -53,7 +70,7 @@ describe("Sources info", () => {
cy.get('[aria-label="Authentication required"]').should("exist");
});

it("Authentication needed for query on failing query", () => {
it("Authentication uncertain for query on not existing source", () => {
cy.visit("/");

cy.contains("My favourite musicians").click();
Expand Down
58 changes: 58 additions & 0 deletions initial-pod-data/boms$.ttl
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@

<http://www/example.com/data/component-bom-b01> a <http://www/example.com/ont/component-bom>;
<http://www/example.com/ont/has-component-material-assoc> <http://www/example.com/data/component-material-assoc-b01-m01>,
<http://www/example.com/data/component-material-assoc-b01-m02>, <http://www/example.com/data/component-material-assoc-b01-m03> .

<http://www/example.com/data/component-bom-b02> a <http://www/example.com/ont/component-bom>;
<http://www/example.com/ont/has-component-material-assoc> <http://www/example.com/data/component-material-assoc-b02-m04>,
<http://www/example.com/data/component-material-assoc-b02-m05>, <http://www/example.com/data/component-material-assoc-b02-m06>,
<http://www/example.com/data/component-material-assoc-b02-m07>, <http://www/example.com/data/component-material-assoc-b02-m08>,
<http://www/example.com/data/component-material-assoc-b02-m09> .

<http://www/example.com/data/component-bom-b03> a <http://www/example.com/ont/component-bom>;
<http://www/example.com/ont/has-component-material-assoc> <http://www/example.com/data/component-material-assoc-b03-m10>,
<http://www/example.com/data/component-material-assoc-b03-m11> .

<http://www/example.com/data/component-material-assoc-b01-m01> a <http://www/example.com/ont/component-material-assoc>;
<http://www/example.com/ont/has-material> <http://www/example.com/data/material-m01>;
<http://www/example.com/ont/percentage> 60 .

<http://www/example.com/data/component-material-assoc-b01-m02> a <http://www/example.com/ont/component-material-assoc>;
<http://www/example.com/ont/has-material> <http://www/example.com/data/material-m02>;
<http://www/example.com/ont/percentage> 30 .

<http://www/example.com/data/component-material-assoc-b01-m03> a <http://www/example.com/ont/component-material-assoc>;
<http://www/example.com/ont/has-material> <http://www/example.com/data/material-m03>;
<http://www/example.com/ont/percentage> 10 .

<http://www/example.com/data/component-material-assoc-b02-m04> a <http://www/example.com/ont/component-material-assoc>;
<http://www/example.com/ont/has-material> <http://www/example.com/data/material-m04>;
<http://www/example.com/ont/percentage> 40 .

<http://www/example.com/data/component-material-assoc-b02-m05> a <http://www/example.com/ont/component-material-assoc>;
<http://www/example.com/ont/has-material> <http://www/example.com/data/material-m05>;
<http://www/example.com/ont/percentage> 20 .

<http://www/example.com/data/component-material-assoc-b02-m06> a <http://www/example.com/ont/component-material-assoc>;
<http://www/example.com/ont/has-material> <http://www/example.com/data/material-m06>;
<http://www/example.com/ont/percentage> 25 .

<http://www/example.com/data/component-material-assoc-b02-m07> a <http://www/example.com/ont/component-material-assoc>;
<http://www/example.com/ont/has-material> <http://www/example.com/data/material-m07>;
<http://www/example.com/ont/percentage> 7 .

<http://www/example.com/data/component-material-assoc-b02-m08> a <http://www/example.com/ont/component-material-assoc>;
<http://www/example.com/ont/has-material> <http://www/example.com/data/material-m08>;
<http://www/example.com/ont/percentage> 5 .

<http://www/example.com/data/component-material-assoc-b02-m09> a <http://www/example.com/ont/component-material-assoc>;
<http://www/example.com/ont/has-material> <http://www/example.com/data/material-m09>;
<http://www/example.com/ont/percentage> 3 .

<http://www/example.com/data/component-material-assoc-b03-m10> a <http://www/example.com/ont/component-material-assoc>;
<http://www/example.com/ont/has-material> <http://www/example.com/data/material-m10>;
<http://www/example.com/ont/percentage> 85 .

<http://www/example.com/data/component-material-assoc-b03-m11> a <http://www/example.com/ont/component-material-assoc>;
<http://www/example.com/ont/has-material> <http://www/example.com/data/material-m11>;
<http://www/example.com/ont/percentage> 15 .
14 changes: 14 additions & 0 deletions initial-pod-data/boms.acl
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
@prefix acl: <http://www.w3.org/ns/auth/acl#>.
@prefix foaf: <http://xmlns.com/foaf/0.1/>.

<#public>
a acl:Authorization;
acl:accessTo <./boms>;
acl:agentClass foaf:Agent;
acl:mode acl:Read.

<#owner>
a acl:Authorization;
acl:accessTo <./boms>;
acl:agent <http://localhost:8080/example/profile/card#me>;
acl:mode acl:Read, acl:Write, acl:Control.
15 changes: 15 additions & 0 deletions initial-pod-data/components$.ttl
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@

<http://www/example.com/data/component-c01> a <http://www/example.com/ont/Component>;
<http://www/example.com/ont/has-component-bom> <http://www/example.com/data/component-bom-b01>;
<http://www/example.com/ont/name> "Component 1";
<http://www/example.com/ont/recycled-content-percentage> 80 .

<http://www/example.com/data/component-c02> a <http://www/example.com/ont/Component>;
<http://www/example.com/ont/has-component-bom> <http://www/example.com/data/component-bom-b02>;
<http://www/example.com/ont/name> "Component 2";
<http://www/example.com/ont/recycled-content-percentage> 20 .

<http://www/example.com/data/component-c03> a <http://www/example.com/ont/Component>;
<http://www/example.com/ont/has-component-bom> <http://www/example.com/data/component-bom-b03>;
<http://www/example.com/ont/name> "Component 3";
<http://www/example.com/ont/recycled-content-percentage> 0 .
14 changes: 14 additions & 0 deletions initial-pod-data/components.acl
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
@prefix acl: <http://www.w3.org/ns/auth/acl#>.
@prefix foaf: <http://xmlns.com/foaf/0.1/>.

<#public>
a acl:Authorization;
acl:accessTo <./components>;
acl:agentClass foaf:Agent;
acl:mode acl:Read.

<#owner>
a acl:Authorization;
acl:accessTo <./components>;
acl:agent <http://localhost:8080/example/profile/card#me>;
acl:mode acl:Read, acl:Write, acl:Control.
33 changes: 33 additions & 0 deletions initial-pod-data/materials$.ttl
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@

<http://www/example.com/data/material-m01> a <http://www/example.com/ont/Component>;
<http://www/example.com/ont/name> "Material 1" .

<http://www/example.com/data/material-m02> a <http://www/example.com/ont/Component>;
<http://www/example.com/ont/name> "Material 2" .

<http://www/example.com/data/material-m03> a <http://www/example.com/ont/Component>;
<http://www/example.com/ont/name> "Material 3" .

<http://www/example.com/data/material-m04> a <http://www/example.com/ont/Component>;
<http://www/example.com/ont/name> "Material 4" .

<http://www/example.com/data/material-m05> a <http://www/example.com/ont/Component>;
<http://www/example.com/ont/name> "Material 5" .

<http://www/example.com/data/material-m06> a <http://www/example.com/ont/Component>;
<http://www/example.com/ont/name> "Material 6" .

<http://www/example.com/data/material-m07> a <http://www/example.com/ont/Component>;
<http://www/example.com/ont/name> "Material 7" .

<http://www/example.com/data/material-m08> a <http://www/example.com/ont/Component>;
<http://www/example.com/ont/name> "Material 8" .

<http://www/example.com/data/material-m09> a <http://www/example.com/ont/Component>;
<http://www/example.com/ont/name> "Material 9" .

<http://www/example.com/data/material-m10> a <http://www/example.com/ont/Component>;
<http://www/example.com/ont/name> "Material 10" .

<http://www/example.com/data/material-m11> a <http://www/example.com/ont/Component>;
<http://www/example.com/ont/name> "Material 11" .
14 changes: 14 additions & 0 deletions initial-pod-data/materials.acl
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
@prefix acl: <http://www.w3.org/ns/auth/acl#>.
@prefix foaf: <http://xmlns.com/foaf/0.1/>.

<#public>
a acl:Authorization;
acl:accessTo <./materials>;
acl:agentClass foaf:Agent;
acl:mode acl:Read.

<#owner>
a acl:Authorization;
acl:accessTo <./materials>;
acl:agent <http://localhost:8080/example/profile/card#me>;
acl:mode acl:Read, acl:Write, acl:Control.
25 changes: 25 additions & 0 deletions public/queries/components-materials.rq
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Query Texon's components and their materials
# Datasources: https://css5.onto-deside.ilabt.imec.be/texon/data/dt/out/components.ttl https://css5.onto-deside.ilabt.imec.be/texon/data/dt/out/boms.ttl https://css5.onto-deside.ilabt.imec.be/texon/data/dt/out/materials.ttl

PREFIX oo: <http://purl.org/openorg/>
PREFIX ao: <http://purl.org/ontology/ao/core#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX d: <http://www/example.com/data/>
PREFIX o: <http://www/example.com/ont/>

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
19 changes: 19 additions & 0 deletions public/queries/components.rq
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Query Texon's components
# Datasources: https://css5.onto-deside.ilabt.imec.be/texon/data/dt/out/components.ttl

PREFIX oo: <http://purl.org/openorg/>
PREFIX ao: <http://purl.org/ontology/ao/core#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX d: <http://www/example.com/data/>
PREFIX o: <http://www/example.com/ont/>

SELECT ?component ?componentName ?recycledContentPercentage
WHERE {
?component
a o:Component ;
o:name ?componentName ;
o:recycled-content-percentage ?recycledContentPercentage ;
.
}
ORDER BY ?componentName
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@ function SourceFetchStatusIcon({ context, source, proxyUrl }) {
const status = context.fetchSuccess[actualSource];
if (status) {
return (
<Tooltip title="Query was succesful">
<Tooltip title="Fetch was succesful">
<CheckIcon size="small" />
</Tooltip>
);
} else {
return (
<Tooltip title="Query failed">
<CancelIcon size="small" />;
<Tooltip title="Fetch failed">
<CancelIcon size="small" />
</Tooltip>
);
}
Expand Down
26 changes: 25 additions & 1 deletion src/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@
"comunicaContext": {
"sources": [
"http://localhost:8080/example/favourite-musicians",
"httq://this-runs-on-httq.com/"
"http://www.example.com/fetch-failure-but-query-success"
],
"lenient": true
}
Expand Down Expand Up @@ -144,6 +144,30 @@
"http://localhost:8080/example/values"
]
}
},
{
"queryLocation": "components.rq",
"name": "Components",
"description": "Query components (no details about materials)",
"id": "7000",
"comunicaContext": {
"sources": ["http://localhost:8080/example/components"],
"lenient": true
}
},
{
"queryLocation": "components-materials.rq",
"name": "Components and their materials",
"description": "Query components (including details about materials)",
"id": "7001",
"comunicaContext": {
"sources": [
"http://localhost:8080/example/components",
"http://localhost:8080/example/boms",
"http://localhost:8080/example/materials"
],
"lenient": true
}
}
]
}
6 changes: 5 additions & 1 deletion src/dataProvider/SparqlDataProvider.js
Original file line number Diff line number Diff line change
Expand Up @@ -205,8 +205,12 @@ function generateContext(context) {
throw new HttpError("No sources provided", 500);
}

if(!context.fetchSuccess){
if (!context.fetchSuccess) {
context.fetchSuccess = {};
// avoid faulty fetch status for sources cached in Comunica
for (const source of context.sources) {
context.fetchSuccess[source] = true;
}
}

let fetchFunction = fetch;
Expand Down