-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
perf: Missing caching per cube iri for some queries #1651
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
@Rdataflow this PR should hopefully fix the missing caching by cube iri queries 👍 |
@bprusinowski there still some cases left... IIUC it occurs with maps thanks for fixing this soon 👍
PREFIX cube: <https://cube.link/>
PREFIX geo: <http://www.opengis.net/ont/geosparql#>
PREFIX schema: <http://schema.org/>
PREFIX sh: <http://www.w3.org/ns/shacl#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
CONSTRUCT {
?dimensionIri rdf:first ?unversionedValue .
?unversionedValue
schema:name ?name ;
schema:alternateName ?alternateName ;
schema:description ?description ;
schema:identifier ?identifier ;
schema:position ?position ;
schema:color ?color ;
geo:hasGeometry ?geometry ;
schema:latitude ?latitude ;
schema:longitude ?longitude .
} WHERE {
{ #pragma evaluate on
SELECT ?dimensionIri ?versionedValue ?unversionedValue WHERE {
VALUES ?dimensionIri { <https://environment.ld.admin.ch/foen/nfi/unitOfReference> }
<https://environment.ld.admin.ch/foen/nfi/nfi_T-changes/cube/2024-1> cube:observationConstraint/sh:property ?dimension .
?dimension sh:path ?dimensionIri .
?dimension schema:version ?version .
?dimension sh:in/rdf:rest*/rdf:first ?versionedValue .
?versionedValue schema:sameAs ?unversionedValue .
}
} UNION { #pragma evaluate on
SELECT ?dimensionIri ?versionedValue ?unversionedValue WHERE {
VALUES ?dimensionIri { <https://environment.ld.admin.ch/foen/nfi/unitOfReference> }
<https://environment.ld.admin.ch/foen/nfi/nfi_T-changes/cube/2024-1> cube:observationConstraint/sh:property ?dimension .
?dimension sh:path ?dimensionIri .
FILTER NOT EXISTS { ?dimension schema:version ?version . }
?dimension sh:in/rdf:rest*/rdf:first ?versionedValue .
BIND(?versionedValue as ?unversionedValue)
}
} UNION {
{
SELECT DISTINCT ?dimensionIri ?versionedValue ?unversionedValue WHERE {
{ #pragma evaluate on
SELECT ?observation WHERE {
VALUES ?dimensionIri { <https://environment.ld.admin.ch/foen/nfi/unitOfReference> }
<https://environment.ld.admin.ch/foen/nfi/nfi_T-changes/cube/2024-1> cube:observationConstraint/sh:property ?dimension .
?dimension sh:path ?dimensionIri .
?dimension schema:version ?version .
FILTER NOT EXISTS { ?dimension sh:in ?in . }
<https://environment.ld.admin.ch/foen/nfi/nfi_T-changes/cube/2024-1> cube:observationSet/cube:observation ?observation .
}
}
VALUES ?dimensionIri { <https://environment.ld.admin.ch/foen/nfi/unitOfReference> }
?observation ?dimensionIri ?versionedValue .
?versionedValue schema:sameAs ?unversionedValue .
}
}
} UNION {
{
SELECT DISTINCT ?dimensionIri ?versionedValue ?unversionedValue WHERE {
{ #pragma evaluate on
SELECT ?observation WHERE {
VALUES ?dimensionIri { <https://environment.ld.admin.ch/foen/nfi/unitOfReference> }
<https://environment.ld.admin.ch/foen/nfi/nfi_T-changes/cube/2024-1> cube:observationConstraint/sh:property ?dimension .
?dimension sh:path ?dimensionIri .
FILTER NOT EXISTS { ?dimension schema:version ?version . }
FILTER NOT EXISTS { ?dimension sh:in ?in . }
<https://environment.ld.admin.ch/foen/nfi/nfi_T-changes/cube/2024-1> cube:observationSet/cube:observation ?observation .
}
}
VALUES ?dimensionIri { <https://environment.ld.admin.ch/foen/nfi/unitOfReference> }
?observation ?dimensionIri ?versionedValue .
BIND(?versionedValue as ?unversionedValue)
}
}
}
OPTIONAL { ?versionedValue schema:name ?name_de . FILTER(LANG(?name_de) = "de") }
OPTIONAL { ?versionedValue schema:name ?name_fr . FILTER(LANG(?name_fr) = "fr") }
OPTIONAL { ?versionedValue schema:name ?name_it . FILTER(LANG(?name_it) = "it") }
OPTIONAL { ?versionedValue schema:name ?name_en . FILTER(LANG(?name_en) = "en") }
OPTIONAL { ?versionedValue schema:name ?name_ . FILTER(LANG(?name_) = "") }
BIND(COALESCE(?name_de, ?name_fr, ?name_it, ?name_en, ?name_) AS ?name)
OPTIONAL { ?versionedValue schema:description ?description_de . FILTER(LANG(?description_de) = "de") }
OPTIONAL { ?versionedValue schema:description ?description_fr . FILTER(LANG(?description_fr) = "fr") }
OPTIONAL { ?versionedValue schema:description ?description_it . FILTER(LANG(?description_it) = "it") }
OPTIONAL { ?versionedValue schema:description ?description_en . FILTER(LANG(?description_en) = "en") }
OPTIONAL { ?versionedValue schema:description ?description_ . FILTER(LANG(?description_) = "") }
BIND(COALESCE(?description_de, ?description_fr, ?description_it, ?description_en, ?description_) AS ?description)
OPTIONAL { ?versionedValue schema:alternateName ?alternateName_de . FILTER(LANG(?alternateName_de) = "de") }
OPTIONAL { ?versionedValue schema:alternateName ?alternateName_fr . FILTER(LANG(?alternateName_fr) = "fr") }
OPTIONAL { ?versionedValue schema:alternateName ?alternateName_it . FILTER(LANG(?alternateName_it) = "it") }
OPTIONAL { ?versionedValue schema:alternateName ?alternateName_en . FILTER(LANG(?alternateName_en) = "en") }
OPTIONAL { ?versionedValue schema:alternateName ?alternateName_ . FILTER(LANG(?alternateName_) = "") }
BIND(COALESCE(?alternateName_de, ?alternateName_fr, ?alternateName_it, ?alternateName_en, ?alternateName_) AS ?alternateName)
OPTIONAL { ?versionedValue schema:identifier ?identifier . }
OPTIONAL { ?versionedValue schema:position ?position . }
OPTIONAL { ?versionedValue schema:color ?color . }
OPTIONAL { ?versionedValue geo:hasGeometry ?geometry . }
OPTIONAL { ?versionedValue schema:latitude ?latitude . }
OPTIONAL { ?versionedValue schema:longitude ?longitude . }
}
#pragma describe.strategy cbd
#pragma join.hash off
DESCRIBE ?subject WHERE {
{
BIND(<https://environment.ld.admin.ch/foen/gefahren-waldbrand-warnung/1> AS ?subject)
}
UNION
{
?subject <http://schema.org/hasPart> <https://environment.ld.admin.ch/foen/gefahren-waldbrand-warnung/1> .
}
}
#pragma describe.strategy cbd
#pragma join.hash off
DESCRIBE <https://environment.ld.admin.ch/foen/gefahren-waldbrand-warnung/1/shape/> |
Hi @Rdataflow, thanks again for catching this 💯 I am off for the end of this week and will tackle this once I am back on Monday ⛰️ |
@adintegra please coordinate this fix makes it into the upcoming release |
Fixes #1599 (comment)