implementazione query, in progress
This commit is contained in:
parent
cd42e5c0ba
commit
7679dba7bb
59
js/utils.js
59
js/utils.js
|
@ -219,11 +219,13 @@ function parseJsonClause(op, tokens, nowhere){
|
|||
te_op=tokens[mtoken]
|
||||
if ('TERM' in te_op){
|
||||
cond=theguiQ[te_op['TERM']]
|
||||
multipleCondSpQuery=buildClause(cond, multipleCondSpQuery, -1)
|
||||
}
|
||||
if('OR ' in te_op){
|
||||
parseJsonClause('OR', te_op['OR '], nowhere)
|
||||
//parsedquery.where.at(-1).patterns
|
||||
multipleCondSpQuery=buildJsonClause(cond, multipleCondSpQuery, -1, nowhere.at(-1).patterns)
|
||||
}
|
||||
else
|
||||
parseJsonClause(Object.keys(te_op)[0], te_op[Object.keys(te_op)[0]], nowhere.at(-1).patterns)
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -344,6 +346,55 @@ function buildClauseNick(clause, parsedquery){
|
|||
|
||||
}
|
||||
|
||||
function buildJsonClause(clause, parsedquery, whereind, theplace){
|
||||
|
||||
if (clause['queryText'].trim() != "") {
|
||||
if (clause['queryText'].trim().slice(-1) !=='*')
|
||||
strval="^" +clause['queryText'].trim()+ "$";
|
||||
else
|
||||
strval=clause['queryText'].trim().slice(0, -1)
|
||||
|
||||
parsedquery.where[1].expression.args[1].value = strval;
|
||||
if (clause['lemma_forma'] == 'lemma')
|
||||
parsedquery.where[1].expression.args[0].value = "lm";
|
||||
}
|
||||
else{
|
||||
if (parsedquery.where[1].type=='filter')
|
||||
parsedquery.where.splice(1, 1)
|
||||
}
|
||||
if (clause['typeGramm0'] !=null && clause['typeGramm0'] != "all")
|
||||
if(whereind> -1)
|
||||
parsedquery.where[whereind].triples.push(JSON.parse(data21)[clause['typeGramm0']]);
|
||||
else{
|
||||
//parsedquery.where.at(-1).patterns
|
||||
theplace.push(JSON.parse(unionop)['bgp']);
|
||||
theplace.at(-1).triples.push(JSON.parse(data21)[clause['typeGramm0']]);
|
||||
}
|
||||
|
||||
|
||||
if (clause['typeGramm0'] !=null && Object.keys(sottoCategorie).includes(clause['typeGramm0'].trim())){
|
||||
//sctmp=JSON.parse(sottoCategorieSostantivi)
|
||||
sctmp=sottoCategorie[clause['typeGramm0'].trim()]
|
||||
sctk=Object.keys(sctmp)
|
||||
for (ke in sctk){
|
||||
|
||||
keval=clause[sctk[ke]]
|
||||
if (keval!=null && keval!=''){
|
||||
sttmts=sctmp[sctk[ke]]
|
||||
if (sttmts[keval]!=null && (sttmts[keval].split(':')[1]) != null){
|
||||
subcatstat= buildsubcategoryClause(sttmts[keval])
|
||||
if(whereind> -1)
|
||||
parsedquery.where[whereind].triples.push(subcatstat);
|
||||
else
|
||||
theplace.at(-1).triples.push(subcatstat);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return parsedquery
|
||||
|
||||
}
|
||||
|
||||
function buildClause(clause, parsedquery, whereind){
|
||||
|
||||
|
|
Loading…
Reference in New Issue