From 12b3e7d8d0f109d53fcf4885e458b12c0774fb42 Mon Sep 17 00:00:00 2001 From: Luca Trupiano Date: Fri, 30 Sep 2022 12:40:40 +0200 Subject: [PATCH] passaggio parametro query --- js/script_Luk_Q.js | 49 ++++------------------------------------------ 1 file changed, 4 insertions(+), 45 deletions(-) diff --git a/js/script_Luk_Q.js b/js/script_Luk_Q.js index 7187d68..ece8730 100644 --- a/js/script_Luk_Q.js +++ b/js/script_Luk_Q.js @@ -368,16 +368,8 @@ $(document).ready(function() { alert("Inserire un termine di ricerca od una clausola attiva!"); return false; } - //alert("Funzione non ancora implementata!"); - //const SparqlParser = sparqljs.Parser; const sparqlGenerator = sparqljs.Generator; - //var parser = new SparqlParser(); - //myquery = gimmespq(); - //jsonQuery = parser.parse(baseQuery); - //jsonQuery = parser.parse(sparqlQuery1); - //jsonQuery = form2filter(jsonQuery); - //jsonQuery = form2filter(myquery); - jsonQuery = buildSQ(); + jsonQuery = buildSQ(logicExprString); queryFields = []; for (var i in jsonQuery.variables) { if (jsonQuery.variables[i].value) { @@ -579,7 +571,8 @@ $(document).ready(function() { var tabID = 0; var claListLen = 0; var condListLen = 0; - var execQuery =``; + var logicExprString = ``; + var execQuery = ``; var queryFields = []; // Contiene le intestazioni di colonna della tabella dei risultati var c0 = JSON.parse('{"queryText": "", "lemma_forma": "lemma", "Tipo": "0", "Attiva": "0"}'); var queryJson = JSON.parse('{"EsprLogica":""}'); @@ -833,7 +826,7 @@ $(document).ready(function() { }; }; }); - var logicExprString = parseCond("#sortable0", "AND"); + logicExprString = parseCond("#sortable0", "AND"); $("#sparqlquery").val(logicExprString); queryJson.EsprLogica = logicExprString.split(' '); //console.log(queryJson); @@ -897,40 +890,6 @@ $(document).ready(function() { return condText; }; - function form2filter(jsonQuery){ - data21 = getStatements(); - qText = $("form #queryText"); - if (qText.length) { - if (qText[0].value != '') - jsonQuery.where[1].expression.args[1].value= "^" + qText[0].value + "$"; - } - selectGramm = $("form #grammtypes1"); - if (selectGramm.length) { - if (selectGramm[0].value != 'all') - jsonQuery.where[0].triples.push(JSON.parse(data21)[selectGramm[0].value]); - } - /** - if (qText[0].value != "") - switch(form.tipo.value) { - case 'parola': - jsonQuery.where[1].expression.args[1].value = "^" + qText[0].value + "$"; - break; - case 'sottostringa': - jsonQuery.where[1].expression.args[1].value = qText[0].value; - break; - case 'prefisso': - jsonQuery.where[1].expression.args[1].value = qText[0].value; - break; - case 'suffisso': - jsonQuery.where[1].expression.args[1].value = qText[0].value + "$"; - break; - default: - jsonQuery.where[1].expression.args[1].value = "^" + qText[0].value + "$"; - }; - */ - return jsonQuery; - }; - $.fn.copy2clipboard = function() { $('div[id^="msgCopiata"]').remove(); this.select();