package fr.insee.rmes.api.concepts;

public class ConceptsQueries {
	
	public static String getConceptsByLabel(String label) {
		return "SELECT ?id ?uri ?intitule ?remplace ?estRemplacePar WHERE { \n"
				+ "?uri skos:inScheme ?conceptScheme . \n"
				+ "FILTER(REGEX(STR(?conceptScheme),'/concepts/definitions/scheme')) \n"
				+ "?uri skos:notation ?id . \n"
				+ "?uri skos:prefLabel ?intitule . \n"
				+ "FILTER(lang(?intitule) = 'fr') \n"
				+ "FILTER(REGEX(STR(?intitule),'" + label + "','i'))"
				+ "OPTIONAL{ ?uri dcterms:replaces ?remplace } \n"
				+ "OPTIONAL{ ?estRemplacePar dcterms:replaces ?uri } \n"
				+ "}"
				+ "ORDER BY ?intitule";
	}
	
	public static String getConceptById(String id) {
		return "SELECT ?uri ?intitule ?remplace ?estRemplacePar WHERE { \n"
				+ "?uri skos:inScheme ?conceptScheme . \n"
				+ "FILTER(REGEX(STR(?conceptScheme),'/concepts/definitions/scheme')) \n"
				+ "?uri skos:notation '" + id + "' . \n"
				+ "?uri skos:prefLabel ?intitule . \n"
				+ "FILTER(lang(?intitule) = 'fr') \n"
				+ "OPTIONAL{ ?uri dcterms:replaces ?remplace } \n"
				+ "OPTIONAL{ ?estRemplacePar dcterms:replaces ?uri } \n"
				+ "}"
				+ "ORDER BY ?intitule";
	}

}

@@ -474,17 +474,18 @@
 titule),
-'
+%5C%22
 %22 + labe
@@ -489,17 +489,18 @@
 abel + %22
-'
+%5C%22
 ,'i'))%22%0A

Fix concept accents issue