Skip to content
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

feat: refactor a query inside a FLTH file and add a sort statement to… #676

Merged
merged 1 commit into from
Jul 5, 2024
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
Original file line number Diff line number Diff line change
Expand Up @@ -34,39 +34,10 @@ public static String conceptsQuery() throws RmesException {
return buildConceptRequest("getConcepts.ftlh", params);
}

public static String conceptsSearchQuery() {
return "SELECT DISTINCT ?id ?label ?created ?modified ?disseminationStatus "
+ "?validationStatus ?definition ?creator ?isTopConceptOf ?valid \n"
+ "(group_concat(?altLabelLg1;separator=' || ') as ?altLabel) \n"
+ "WHERE { GRAPH <"+config.getConceptsGraph()+"> { \n"
+ "?concept skos:notation ?notation . \n"
+ "BIND (STR(?notation) AS ?id) \n"
+ "?concept skos:prefLabel ?label . \n"
+ "OPTIONAL{?concept skos:altLabel ?altLabelLg1 . \n"
+ "FILTER (lang(?altLabelLg1) = '" + config.getLg1() + "')} \n"
+ "?concept dcterms:created ?created . \n"
// Not topConceptOf if has broader
+ "BIND (exists{?concept skos:broader ?broa} AS ?broader) . \n"
+ "BIND (IF(?broader, 'false', 'true') AS ?isTopConceptOf) . \n"
+ "OPTIONAL{?concept dcterms:modified ?modified} . \n"
+ "OPTIONAL {?concept dcterms:valid ?valid} . \n"
+ "?concept insee:disseminationStatus ?disseminationStatus . \n"
+ "?concept insee:isValidated ?validationStatus . \n"
+ "FILTER (lang(?label) = '" + config.getLg1() + "') . \n"
+ "?concept dc:creator ?creator . \n"
+ "OPTIONAL{?concept skos:definition ?noteUri . \n"
+ "?noteUri pav:version ?version . \n"
+ "?noteUri evoc:noteLiteral ?definition . \n"
+ "?noteUri dcterms:language '" + config.getLg1() + "'^^xsd:language . \n"
+ "OPTIONAL {?concept skos:definition ?latest . \n"
+ "?latest pav:version ?latestVersion . \n"
+ "?latest dcterms:language '" + config.getLg1() + "'^^xsd:language . \n"
+ "FILTER (?version < ?latestVersion)} . \n"
+ "FILTER (!bound (?latest))}"
+ "}} \n"
+ "GROUP BY ?id ?label ?created ?modified ?disseminationStatus \n"
+ "?validationStatus ?definition ?creator ?isTopConceptOf ?valid \n"
+ "ORDER BY ?label";
public static String conceptsSearchQuery() throws RmesException {
if (params==null) {initParams();}
params.put(CONCEPTS_GRAPH, config.getConceptsGraph());
return buildConceptRequest("getConceptsForAdvancedSearch.ftlh", params);
}

public static String conceptsToValidateQuery() {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
SELECT DISTINCT ?id ?label ?created ?modified ?disseminationStatus ?validationStatus ?definition ?creator ?isTopConceptOf ?valid (group_concat(?altLabelLg1;separator=' || ') as ?altLabel)
WHERE
{
GRAPH <${CONCEPTS_GRAPH}> {
?concept skos:notation ?notation .
BIND (STR(?notation) AS ?id)
?concept skos:prefLabel ?label .
FILTER (lang(?label) = '${LG1}') .

OPTIONAL {
?concept skos:altLabel ?altLabelLg1 .
FILTER (lang(?altLabelLg1) = '${LG1}')
}
?concept dcterms:created ?created .
BIND (exists{?concept skos:broader ?broa} AS ?broader) .
BIND (IF(?broader, 'false', 'true') AS ?isTopConceptOf) .

OPTIONAL{?concept dcterms:modified ?modified} .
OPTIONAL {?concept dcterms:valid ?valid} .

?concept insee:disseminationStatus ?disseminationStatus .
?concept insee:isValidated ?validationStatus .

?concept dc:creator ?creator .
OPTIONAL{
?concept skos:definition ?noteUri .
?noteUri pav:version ?version .
?noteUri evoc:noteLiteral ?definition .
?noteUri dcterms:language '${LG1}'^^xsd:language .
OPTIONAL {
?concept skos:definition ?latest .
?latest pav:version ?latestVersion .
?latest dcterms:language '${LG1}'^^xsd:language .
FILTER (?version < ?latestVersion)
} .
FILTER (!bound (?latest))
}
}
}
GROUP BY ?id ?label ?created ?modified ?disseminationStatus ?validationStatus ?definition ?creator ?isTopConceptOf ?valid
ORDER BY ?label
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,6 @@ WHERE {
BIND(EXISTS{?series dc:creator ?creator} AS ?hasCreator)
BIND(EXISTS{?series dcterms:contributor ?contrib} AS ?hasContributor)
BIND(EXISTS{?series insee:dataCollector ?datacoll} AS ?hasDataCollector)
BIND(EXISTS{?series dcterms:publisher ?publisher} AS ?hasPublisher)
}
BIND(EXISTS{?series dcterms:publisher ?publisher} AS ?hasPublisher)
}
ORDER BY ?prefLabelLg1
Loading