passaggio parametro query

This commit is contained in:
Luca Trupiano 2022-09-30 12:40:40 +02:00
parent 09598255ee
commit 12b3e7d8d0
1 changed files with 4 additions and 45 deletions

View File

@ -368,16 +368,8 @@ $(document).ready(function() {
alert("Inserire un termine di ricerca od una clausola attiva!"); alert("Inserire un termine di ricerca od una clausola attiva!");
return false; return false;
} }
//alert("Funzione non ancora implementata!");
//const SparqlParser = sparqljs.Parser;
const sparqlGenerator = sparqljs.Generator; const sparqlGenerator = sparqljs.Generator;
//var parser = new SparqlParser(); jsonQuery = buildSQ(logicExprString);
//myquery = gimmespq();
//jsonQuery = parser.parse(baseQuery);
//jsonQuery = parser.parse(sparqlQuery1);
//jsonQuery = form2filter(jsonQuery);
//jsonQuery = form2filter(myquery);
jsonQuery = buildSQ();
queryFields = []; queryFields = [];
for (var i in jsonQuery.variables) { for (var i in jsonQuery.variables) {
if (jsonQuery.variables[i].value) { if (jsonQuery.variables[i].value) {
@ -579,7 +571,8 @@ $(document).ready(function() {
var tabID = 0; var tabID = 0;
var claListLen = 0; var claListLen = 0;
var condListLen = 0; var condListLen = 0;
var execQuery =``; var logicExprString = ``;
var execQuery = ``;
var queryFields = []; // Contiene le intestazioni di colonna della tabella dei risultati var queryFields = []; // Contiene le intestazioni di colonna della tabella dei risultati
var c0 = JSON.parse('{"queryText": "", "lemma_forma": "lemma", "Tipo": "0", "Attiva": "0"}'); var c0 = JSON.parse('{"queryText": "", "lemma_forma": "lemma", "Tipo": "0", "Attiva": "0"}');
var queryJson = JSON.parse('{"EsprLogica":""}'); var queryJson = JSON.parse('{"EsprLogica":""}');
@ -833,7 +826,7 @@ $(document).ready(function() {
}; };
}; };
}); });
var logicExprString = parseCond("#sortable0", "AND"); logicExprString = parseCond("#sortable0", "AND");
$("#sparqlquery").val(logicExprString); $("#sparqlquery").val(logicExprString);
queryJson.EsprLogica = logicExprString.split(' '); queryJson.EsprLogica = logicExprString.split(' ');
//console.log(queryJson); //console.log(queryJson);
@ -897,40 +890,6 @@ $(document).ready(function() {
return condText; 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() { $.fn.copy2clipboard = function() {
$('div[id^="msgCopiata"]').remove(); $('div[id^="msgCopiata"]').remove();
this.select(); this.select();