package fr.insee.rmes.api.codes.cj;

import fr.insee.rmes.api.Configuration;

public class CJQueries {

	public static String getCategorieJuridiqueNiveauIII(String code) {
		return "SELECT ?uri ?intitule WHERE { \n"
				+ "?uri skos:notation '" + code + "' . \n"
				+ "?lastCJThirdLevel skos:member ?uri . \n"
				+ "?uri skos:prefLabel ?intitule  \n"
				+ "FILTER (lang(?intitule) = 'fr') \n"
				+ "{ \n"
				+ "SELECT ?lastCJThirdLevel WHERE { \n"
				+ "?lastCJThirdLevel xkos:organizedBy <" + Configuration.BASE_HOST + "/concepts/cj/cjNiveauIII> . \n"
				+ "BIND(STRBEFORE(STRAFTER(STR(?lastThirdLevel ), '" + Configuration.BASE_HOST + "/codes/cj/cj'), '/niveauIII') AS ?lastCJVersion) \n"
				+ "BIND(xsd:float(?lastCJVersion) AS ?lastCJVersionFloat)"
				+ "} \n"
				+ "ORDER BY DESC (?lastCJVersionFloat) \n"
				+ "LIMIT 1 \n"
				+ "} \n"
				+ "}";
	}	

}

@@ -592,16 +592,18 @@
 TR(?last
+CJ
 ThirdLev
@@ -604,17 +604,16 @@
 irdLevel
- 
 ), '%22 + 

Fix issue with CJ query