query, in progress
This commit is contained in:
parent
9c138ccdb6
commit
0dbde2b4a9
|
@ -1906,15 +1906,12 @@ $(document).ready(function() {
|
|||
|
||||
//alert(query)
|
||||
$("#loader").fadeIn(300);
|
||||
//$("#searchcomm2").prop("disabled", true);
|
||||
//$("#searchcomm2").html('<span class="spinner-grow spinner-grow-sm" role="status" aria-hidden="true"></span> Searching...');
|
||||
|
||||
try {
|
||||
var seachbBindingsStream = await myEngine.queryBindings(query, { sources: [{ type: 'sparql', value: sparqlEndpoint },], });
|
||||
}
|
||||
catch (err) {
|
||||
$("#loader").fadeOut(300);
|
||||
//$("#searchcomm2").prop("disabled", false);
|
||||
//$("#searchcomm2").html('<span class="" role="status" aria-hidden="true"></span> Search');
|
||||
console.log(err.message);
|
||||
};
|
||||
|
||||
|
@ -1981,6 +1978,16 @@ $(document).ready(function() {
|
|||
resultsInCantica.push(cantica);
|
||||
resultsInCanto.push(cantica + canto)
|
||||
}
|
||||
|
||||
//cambiare!
|
||||
for (var ip=1; ip<10; ip++){
|
||||
if (binding.has('pos'+ip)){
|
||||
var tp=binding.get('pos'+ip).value;
|
||||
if (!result.has(tp))
|
||||
result.add(tp)
|
||||
}
|
||||
}
|
||||
//cambiare!
|
||||
if (unitaRicerca != 'frase' && pos == -1) {
|
||||
unitaRicerca = 'frase'
|
||||
}
|
||||
|
|
|
@ -127,8 +127,8 @@ WHERE {
|
|||
ecrm:P148i_is_component_of ?canto.
|
||||
?cl syntit:hasClauseType ?clatype;
|
||||
syntit:hasClauseFunction ?clafun.
|
||||
?seocc olires:occurrenceOf ?sentence;
|
||||
olires:occursInRegion ?frag.
|
||||
#?seocc olires:occurrenceOf ?sentence;
|
||||
# olires:occursInRegion ?frag.
|
||||
?claocc olires:occurrenceOf ?cl;
|
||||
olires:occursInRegion ?fragcl.
|
||||
?fragcl olires:fragmentRegionFrom ?clfr;
|
||||
|
@ -140,7 +140,7 @@ WHERE {
|
|||
olires:hasStructuralComponent ?canto.
|
||||
BIND(CONCAT(STR(?clafun), ';') AS ?clafunction)
|
||||
BIND(STR(?clatype) AS ?clt)
|
||||
FILTER (?clto > ?pos && ?clfr<?pos) .
|
||||
#FILTER (?clto > ?pos && ?clfr<?pos) .
|
||||
}`
|
||||
|
||||
//bindConcatStatement
|
||||
|
@ -157,7 +157,7 @@ WHERE {
|
|||
"args": []
|
||||
}
|
||||
}`
|
||||
//clauseTypeBindConcatStatement
|
||||
//clauseTypeBindStatement
|
||||
const clausetarget_typebind =
|
||||
`{
|
||||
"type": "bind",
|
||||
|
@ -167,7 +167,7 @@ WHERE {
|
|||
},
|
||||
"expression": {
|
||||
"type": "operation",
|
||||
"operator": "concat",
|
||||
"operator": "",
|
||||
"args": []
|
||||
}
|
||||
}`
|
||||
|
@ -192,6 +192,46 @@ WHERE {
|
|||
}
|
||||
}`
|
||||
|
||||
const clausepos_filter=`
|
||||
{
|
||||
"type": "filter",
|
||||
"expression": {
|
||||
"type": "operation",
|
||||
"operator": "&&",
|
||||
"args": [
|
||||
{
|
||||
"type": "operation",
|
||||
"operator": ">",
|
||||
"args": [
|
||||
{
|
||||
"termType": "Variable",
|
||||
"value": "clto"
|
||||
},
|
||||
{
|
||||
"termType": "Variable",
|
||||
"value": "pos_"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "operation",
|
||||
"operator": "<",
|
||||
"args": [
|
||||
{
|
||||
"termType": "Variable",
|
||||
"value": "clfr"
|
||||
},
|
||||
{
|
||||
"termType": "Variable",
|
||||
"value": "pos_"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
`
|
||||
|
||||
//Query per advanced search con obiettivo = 'Periodo'
|
||||
const sentencetargetquery = `
|
||||
PREFIX ecrm: <http://erlangen-crm.org/current/>
|
||||
|
@ -219,7 +259,7 @@ SELECT (?t_canto as ?Canto) (?t_cantica as ?Cantica) ?sentence ?clfr ?clto ?claf
|
|||
olires:hasNumber ?num.
|
||||
?cantica ecrm:P102_has_title ?t_cantica;
|
||||
olires:hasStructuralComponent ?canto.
|
||||
#BIND(concat(str(?clatype1),";", str(?clatype2)) AS ?clatype)
|
||||
#BIND((str(?clatype1),";", str(?clatype2)) AS ?clatype)
|
||||
#BIND(COALESCE(?posgen,-1) AS ?pos)
|
||||
}
|
||||
|
||||
|
@ -431,4 +471,3 @@ WHERE {
|
|||
} order by ?Cantica ?Canto`
|
||||
|
||||
|
||||
|
|
@ -377,25 +377,25 @@ var filters = []
|
|||
var unionop = `{"union": {"type": "union", "patterns":[]}, "bgp": {"type": "bgp", "triples":[]}, "group": {"type": "group", "patterns":[]}}`
|
||||
|
||||
|
||||
var idtoken = 0;
|
||||
|
||||
function parseJsonClause(op, tokens, nowhere) {
|
||||
//alert(op)
|
||||
var idp = -1
|
||||
if (nowhere[0].type == 'filter' && nowhere[0].expression.args[0].value == 'Rappresentazione') {
|
||||
|
||||
/*if (nowhere[0].type != null && nowhere[0].type == 'filter' && nowhere[0].expression.args[0].value == 'Rappresentazione') {
|
||||
//nowhere.splice(0, 1)
|
||||
nowhere.splice(0, 2)
|
||||
}
|
||||
}*/
|
||||
if (op.trim() == 'OR') {
|
||||
|
||||
//nowhere.splice(1, 0, JSON.parse(unionop)['union'])
|
||||
nowhere.splice(0, 0, JSON.parse(unionop)['union'])
|
||||
nowhere.splice(1, 0, clausePosCoalesceStatement)
|
||||
idp = 0
|
||||
}
|
||||
if (op.trim() == 'AND') {
|
||||
|
||||
//nowhere.splice(1, 0, JSON.parse(unionop)['group'])
|
||||
nowhere.splice(0, 0, JSON.parse(unionop)['group'])
|
||||
//idp = 1
|
||||
idp = 0
|
||||
|
||||
}
|
||||
|
@ -403,12 +403,12 @@ function parseJsonClause(op, tokens, nowhere) {
|
|||
te_op = tokens[mtoken]
|
||||
if ('TERM' in te_op) {
|
||||
cond = theguiQ[te_op['TERM']]
|
||||
|
||||
multipleCondSpQuery = buildStatementClause(cond, multipleCondSpQuery, -1, nowhere[idp].patterns, mtoken)
|
||||
idtoken += 1;
|
||||
multipleCondSpQuery = buildStatementClause(cond, multipleCondSpQuery, -1, nowhere[idp].patterns, idtoken, op.trim())
|
||||
|
||||
}
|
||||
else
|
||||
parseJsonClause(Object.keys(te_op)[0], te_op[Object.keys(te_op)[0]], nowhere.at(-1).patterns)
|
||||
parseJsonClause(Object.keys(te_op)[0], te_op[Object.keys(te_op)[0]], nowhere[0].patterns)
|
||||
|
||||
}
|
||||
|
||||
|
@ -422,17 +422,21 @@ function buildSPQuery(guiquery) {
|
|||
var SparqlParser = sparqljs.Parser;
|
||||
var spqparser = new SparqlParser();
|
||||
multipleCondSpQuery = spqparser.parse(ontoSparqlQueryMultCond);
|
||||
bindConcatStatement = JSON.parse(sentencetarget_functionbind);
|
||||
occBindConcatStatement = JSON.parse(sentencetarget_occbind);
|
||||
posBindConcatStatement = JSON.parse(sentencetarget_posbind);
|
||||
clausePosCoalesceStatement = JSON.parse(clausetarget_coalesce);
|
||||
|
||||
if (theguiQ['unitaRicerca'] == 'frase' || theguiQ['unitaRicerca'] == 'verso') {
|
||||
multipleCondSpQuery = spqparser.parse(clausetargetquery);
|
||||
clausePosCoalesceStatement = JSON.parse(clausetarget_coalesce);
|
||||
//clausePosCoalesceStatement = JSON.parse(clausetarget_coalesce);
|
||||
|
||||
}
|
||||
if (theguiQ['unitaRicerca'] == 'periodo') {//Multiple Conditions
|
||||
multipleCondSpQuery = spqparser.parse(sentencetargetquery);
|
||||
bindConcatStatement = JSON.parse(sentencetarget_functionbind);
|
||||
/*bindConcatStatement = JSON.parse(sentencetarget_functionbind);
|
||||
occBindConcatStatement = JSON.parse(sentencetarget_occbind);
|
||||
posBindConcatStatement = JSON.parse(sentencetarget_posbind);
|
||||
posBindConcatStatement = JSON.parse(sentencetarget_posbind);*/
|
||||
|
||||
}
|
||||
|
||||
|
@ -444,21 +448,21 @@ function buildSPQuery(guiquery) {
|
|||
var clauses = parser.parse(test);
|
||||
//here get clauses
|
||||
var jsonclauses = JSON.parse(clauses)
|
||||
|
||||
idtoken = 0
|
||||
for (const ck of Object.keys(jsonclauses)) {
|
||||
parseJsonClause(ck, jsonclauses[ck], multipleCondSpQuery.where)
|
||||
|
||||
}
|
||||
if (theguiQ['unitaRicerca'] == 'frase' || theguiQ['unitaRicerca'] == 'verso') {
|
||||
|
||||
/*if (ck.trim()=='OR' && (theguiQ['unitaRicerca'] == 'frase' || theguiQ['unitaRicerca'] == 'verso')) {
|
||||
multipleCondSpQuery.where.push(clausePosCoalesceStatement)
|
||||
/*if (posBindConcatStatement['expression']['args'].length) {
|
||||
multipleCondSpQuery.where.push(posBindConcatStatement)
|
||||
multipleCondSpQuery.variables.push(JSON.parse(sentencetarget_posVariable))
|
||||
//multipleCondSpQuery.where.push(sentencetargetstatement_posCoalesce)
|
||||
}*/
|
||||
|
||||
}
|
||||
/*if (theguiQ['unitaRicerca'] == 'frase' || theguiQ['unitaRicerca'] == 'verso') {
|
||||
|
||||
multipleCondSpQuery.where.push(clausePosCoalesceStatement)
|
||||
|
||||
|
||||
}*/
|
||||
if (theguiQ['unitaRicerca'] == 'periodo') {
|
||||
multipleCondSpQuery.where.push(bindConcatStatement)
|
||||
multipleCondSpQuery.where.push(occBindConcatStatement)
|
||||
|
@ -672,7 +676,7 @@ function getFiltroContestoJson(datiContesto) {
|
|||
return []
|
||||
}
|
||||
|
||||
function buildStatementClause(clause, parsedquery, whereind, theplace, token) {
|
||||
function buildStatementClause(clause, parsedquery, whereind, theplace, token, op) {
|
||||
//
|
||||
var tmpgroup = ''
|
||||
if (clause['TipoClausola'] == "Sintattico") {
|
||||
|
@ -763,6 +767,7 @@ function buildStatementClause(clause, parsedquery, whereind, theplace, token) {
|
|||
}
|
||||
]
|
||||
}`
|
||||
|
||||
if (theguiQ['unitaRicerca'] == 'periodo') {
|
||||
posBindConcatStatement['expression']['args'].push(JSON.parse(tmppos))
|
||||
tmppos = `{"termType": "Literal",
|
||||
|
@ -775,13 +780,24 @@ function buildStatementClause(clause, parsedquery, whereind, theplace, token) {
|
|||
}`
|
||||
posBindConcatStatement['expression']['args'].push(JSON.parse(tmppos))
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
tmppos = `{
|
||||
"termType": "Variable",
|
||||
"value": "pos`+ token + `"
|
||||
}`
|
||||
if (op == 'OR') {
|
||||
clausePosCoalesceStatement['expression']['args'].push(JSON.parse(tmppos))
|
||||
var orfilter=clausepos_filter.replaceAll("pos_", "pos")
|
||||
if (!parsedquery['where'].includes(JSON.parse(orfilter)))
|
||||
parsedquery['where'].push(JSON.parse(orfilter))
|
||||
}
|
||||
else{
|
||||
parsedquery['variables'].push(JSON.parse(tmppos))
|
||||
var andfilter=clausepos_filter.replaceAll("pos_", "pos"+ token)
|
||||
parsedquery['where'].push(JSON.parse(andfilter))
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
tmpgroup = JSON.parse(tmpg)
|
||||
|
|
|
@ -76,7 +76,7 @@
|
|||
value: defaultEditorQuery
|
||||
},
|
||||
requestConfig : {
|
||||
endpoint : "https://hdnlab1.isti.cnr.it/fuseki/commedia/query"
|
||||
endpoint : "https://lida.dantenetwork.it/fuseki/commedia/query"
|
||||
},
|
||||
copyEndpointOnNewTab : false,
|
||||
resizeable : true,
|
||||
|
|
|
@ -937,91 +937,91 @@ WHERE {
|
|||
<h5>Esempi di query sulla struttura</h5>
|
||||
</p>
|
||||
<p>
|
||||
<a href="#" class="link-info" onClick='writeQuery(query_1)'>
|
||||
1 <a href="#" class="link-info" onClick='writeQuery(query_1)'>
|
||||
Versetti in cui compare una forma.</a>
|
||||
</p>
|
||||
<p>
|
||||
<a href="#" class="link-info" onClick='writeQuery(query_2)'>Versetti
|
||||
2 <a href="#" class="link-info" onClick='writeQuery(query_2)'>Versetti
|
||||
in cui compaiono parole che iniziano con una stringa.</a>
|
||||
</p>
|
||||
<p>
|
||||
<a href="#" class="link-info" onClick='writeQuery(query_11)'>Le
|
||||
3 <a href="#" class="link-info" onClick='writeQuery(query_11)'>Le
|
||||
parole più frequenti in un libro.</a>
|
||||
</p>
|
||||
<p>
|
||||
<a href="#" class="link-info" onClick='writeQuery(query_3)'>Versetti
|
||||
4 <a href="#" class="link-info" onClick='writeQuery(query_3)'>Versetti
|
||||
che si ripetono più volte.</a>
|
||||
</p>
|
||||
<p>
|
||||
<a href="#" class="link-info" onClick='writeQuery(query_15)'>Le
|
||||
5 <a href="#" class="link-info" onClick='writeQuery(query_15)'>Le
|
||||
parole che compaiono in due libri, con il numero di occorrenze.</a>
|
||||
</p>
|
||||
<p>
|
||||
<a href="#" class="link-info" onClick='writeQuery(query_12)'>Le
|
||||
6 <a href="#" class="link-info" onClick='writeQuery(query_12)'>Le
|
||||
parole di un libro, che non compaiono in un altro libro.</a>
|
||||
</p>
|
||||
<p>
|
||||
<h5>Esempi di query sul 'livello linguistico'</h5>
|
||||
</p>
|
||||
<p>
|
||||
<a href="#" class="link-info" onClick='writeQuery(query_4)'>Cerco
|
||||
7 <a href="#" class="link-info" onClick='writeQuery(query_4)'>Cerco
|
||||
in un libro le forme associate ad un lemma.</a>
|
||||
</p>
|
||||
<p>
|
||||
<a href="#" class="link-info" onClick='writeQuery(query_5)'>Cerco
|
||||
8 <a href="#" class="link-info" onClick='writeQuery(query_5)'>Cerco
|
||||
in tutta l'opera le forme associate ad un lemma.</a>
|
||||
</p>
|
||||
<p>
|
||||
<a href="#" class="link-info" onClick='writeQuery(query_8)'>Cerco
|
||||
9 <a href="#" class="link-info" onClick='writeQuery(query_8)'>Cerco
|
||||
i verbi (lila:verb) presenti in un libro.</a>
|
||||
</p>
|
||||
<p>
|
||||
<a href="#" class="link-info" onClick='writeQuery(query_17)'>I verbi più frequenti in un libro.</a>
|
||||
10 <a href="#" class="link-info" onClick='writeQuery(query_17)'>I verbi più frequenti in un libro.</a>
|
||||
</p>
|
||||
<p>
|
||||
<a href="#" class="link-danger" onClick='writeQuery(query_6)'>Cerco
|
||||
11 <a href="#" class="link-danger" onClick='writeQuery(query_6)'>Cerco
|
||||
i versetti di un libro in cui una parola in una specifica
|
||||
posizione abbia categoria grammaticale 'lila:verb' (query
|
||||
distribuita sul dataset di LiLa).</a>
|
||||
</p>
|
||||
<p>
|
||||
<a href="#" class="link-danger" onClick='writeQuery(query_14)'>Cerco
|
||||
12 <a href="#" class="link-danger" onClick='writeQuery(query_14)'>Cerco
|
||||
i versetti di un libro in cui compaiano due parole consecutive
|
||||
che hanno rispettivamente categoria grammaticale 'lila:verb' e
|
||||
'lila:noun'</a>
|
||||
</p>
|
||||
<p>
|
||||
<a href="#" class="link-danger" onClick='writeQuery(query_19)'>
|
||||
13 <a href="#" class="link-danger" onClick='writeQuery(query_19)'>
|
||||
Le occorrenze delle categorie verbali (lila:POS) delle prime 4 parole dei versetti del libro 'Genesis'.
|
||||
</a>
|
||||
</p>
|
||||
<p>
|
||||
<a href="#" class="link-danger" onClick='writeQuery(query_18)'>
|
||||
14 <a href="#" class="link-danger" onClick='writeQuery(query_18)'>
|
||||
TEST! Le occorrenze delle categorie verbali (lila:POS) nelle sequenze di 4 parole nei versetti del libro 'Genesi'.
|
||||
</a>
|
||||
</p>
|
||||
<p>
|
||||
<a href="#" class="link-danger" onClick='writeQuery(query_13)'>Cerco
|
||||
15 <a href="#" class="link-danger" onClick='writeQuery(query_13)'>Cerco
|
||||
le forme derivate da un lemma secondo le regole definite
|
||||
dall'ontologia "Word Formation Latin" (WFL)</a>
|
||||
</p>
|
||||
<p>
|
||||
<a href="#" class="link-danger" onClick='writeQuery(query_7)'>Termini
|
||||
16 <a href="#" class="link-danger" onClick='writeQuery(query_7)'>Termini
|
||||
con la stessa radice basati sulla proprieta lila:hasBase del
|
||||
lemma cercato.</a>
|
||||
</p>
|
||||
<p>
|
||||
<a href="#" class="link-danger" onClick='writeQuery(query_16)'>Cerca
|
||||
17 <a href="#" class="link-danger" onClick='writeQuery(query_16)'>Cerca
|
||||
le forme associate ai lemmi appartenenti ad un SynSet della
|
||||
risorsa Latin WordNet pubblicata su LiLa</a>
|
||||
</p>
|
||||
<p>
|
||||
<a href="#" class="link-danger" onClick='writeQuery(query_9)'>Cerco
|
||||
18 <a href="#" class="link-danger" onClick='writeQuery(query_9)'>Cerco
|
||||
i verbi (lila:Verb) presenti in un libro e per ciascun lemma
|
||||
visualizzo la definizione nel dizionario Lewis & Short.</a>
|
||||
</p>
|
||||
<p>
|
||||
<a href="#" class="link-danger" onClick='writeQuery(query_10)'>Cerco
|
||||
19 <a href="#" class="link-danger" onClick='writeQuery(query_10)'>Cerco
|
||||
in un capitolo di un libro le forme che hanno una particolare
|
||||
stringa nella definizione del dizionario Lewis & Short.</a>
|
||||
</p>
|
||||
|
|
Loading…
Reference in New Issue