diff --git a/app/rdf/light-cube.ts b/app/rdf/light-cube.ts index e3eb612c3b..0b631f5905 100644 --- a/app/rdf/light-cube.ts +++ b/app/rdf/light-cube.ts @@ -56,9 +56,14 @@ export class LightCube { const query = `PREFIX schema: SELECT ?iri WHERE { - ?versionHistory schema:hasPart <${this.iri}> . + VALUES ?oldIri { <${this.iri}> } + + ?versionHistory schema:hasPart ?oldIri . ?versionHistory schema:hasPart ?iri . ?iri schema:version ?version . + ?iri schema:creativeWorkStatus ?status . + ?oldIri schema:creativeWorkStatus ?oldStatus . + FILTER(NOT EXISTS { ?iri schema:expires ?expires . } && ?status IN (?oldStatus, )) } ORDER BY DESC(?version) LIMIT 1`;