-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
88d51b6
commit a050eff
Showing
7 changed files
with
78 additions
and
120 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
/** Creates SPARQL query to fetch latest cube iri. | ||
* Works for both versioned and unversioned cubes. | ||
*/ | ||
export const getLatestCubeIriQuery = (cubeIri: string) => { | ||
return `PREFIX schema: <http://schema.org/> | ||
SELECT ?iri WHERE { | ||
{ | ||
SELECT ?iri WHERE { | ||
VALUES ?versionHistory { <${cubeIri}> } | ||
?versionHistory schema:hasPart ?iri . | ||
?iri schema:version ?version . | ||
?iri schema:creativeWorkStatus ?status . | ||
FILTER(NOT EXISTS { ?iri schema:expires ?expires . } && ?status = <https://ld.admin.ch/vocabulary/CreativeWorkStatus/Published>) | ||
} | ||
} UNION { | ||
SELECT ?iri WHERE { | ||
VALUES ?oldIri { <${cubeIri}> } | ||
?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, <https://ld.admin.ch/vocabulary/CreativeWorkStatus/Published>)) | ||
} | ||
} | ||
} | ||
ORDER BY DESC(?version) | ||
LIMIT 1`; | ||
}; |