tentativo query
This commit is contained in:
parent
8bc3e1600b
commit
42feb30903
|
@ -162,10 +162,10 @@
|
|||
</div>
|
||||
|
||||
|
||||
|
||||
<!--
|
||||
<div class="tabs mw8 center mt5">
|
||||
<div class="tabs__menu flex mb5 bb b--black-20">
|
||||
<!-- <label for="section1" class="tabs__menu-item w-25-ns tc bg-white pt4 pb4 bg-animate hover-bg-white pointer red">Query</label>-->
|
||||
<label for="section1" class="tabs__menu-item w-25-ns tc bg-white pt4 pb4 bg-animate hover-bg-white pointer red">Query</label>
|
||||
<label for="section1"
|
||||
class="tabs__menu-item w-25-ns tc pt4 pb4 bg-animate hover-bg-white pointer">Query</label>
|
||||
<label for="section2"
|
||||
|
@ -225,7 +225,8 @@
|
|||
</div>
|
||||
|
||||
|
||||
|
||||
-->
|
||||
|
||||
<!-- TEMPLATE FILTRO -->
|
||||
|
||||
<div class="flex items-center justify-center pa1 bl br bt bb b--green"
|
||||
|
@ -1379,6 +1380,98 @@ main.redefine("querytxt", writesearchValue(mform));
|
|||
|
||||
</script>
|
||||
-->
|
||||
</body>
|
||||
|
||||
|
||||
<!-- Da index_Luk_Q_.html -->
|
||||
|
||||
|
||||
<div class="container p-2 my-3 border bg-light">
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<ul class="nav nav-tabs" id="result-list" role="tablist">
|
||||
<li class="nav-item active" role="presentation">
|
||||
<a class="nav-link active" id="result1-tab" data-toggle="tab" href="#result1" role="tab" aria-controls="result1" aria-selected="true"><span class="small text-secondary"><ion-icon name="archive"></ion-icon></span><span class="text-dark font-weight-bold"> Risultati</span></a>
|
||||
</li>
|
||||
<li class="nav-item" role="presentation">
|
||||
<a class="nav-link" id="result2-tab" data-toggle="tab" href="#result2" role="tab" aria-controls="result2" aria-selected="true"><span class="small text-dark font-weight-bold">Testo</span></a>
|
||||
</li>
|
||||
<li class="nav-item" role="presentation">
|
||||
<a class="nav-link" id="result3-tab" data-toggle="tab" href="#result3" role="tab" aria-controls="result3" aria-selected="true"><span class="small text-dark font-weight-bold">Query Sparql</span></a>
|
||||
</li>
|
||||
</ul>
|
||||
<div class="tab-content border-right border-left border-bottom" id="result-TabContent">
|
||||
<div class="tab-pane fade show active p-2 bg-white" id="result1" role="tabpanel" aria-labelledby="result1-tab">
|
||||
<div class="form-outline text-muted font-weight-normal p-1" id="showrisultati">
|
||||
<div class=" text-muted table-responsive" id="resultsId1">
|
||||
<div class="p-2 border">Nessun risultato
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="tab-pane fade p-2 bg-white" id="result2" role="tabpanel" aria-labelledby="result2-tab">
|
||||
|
||||
<div class="row p-1">
|
||||
<div class="col-sm-12 col-md-6 text-muted font-weight-normal align-text-bottom">
|
||||
<label class="form-label m-0 mt-2" for="risultatitesto">Risultati testuali della ricerca:</label>
|
||||
</div>
|
||||
<div class="col-sm-12 col-md-6 text-right float-right">
|
||||
<div class="btn-group text-right float-right" role="group" aria-label="Tasto copia testo">
|
||||
<label class="input-group-text"><ion-icon name="copy"></ion-icon></label>
|
||||
<button class="btn btn-outline-danger btn-sm text-right float-right" tabindex="0" id="copiaTesto" aria-controls="resultQuery" type="button">Copia</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-outline small text-muted font-weight-normal p-1 pt-2" id="showtext">
|
||||
<textarea class="form-control small text-muted bg-white" id="risultatitesto" rows="4" placeholder="Nessun risultato" readonly></textarea>
|
||||
</div>
|
||||
</div>
|
||||
<div class="tab-pane fade p-2 bg-white" id="result3" role="tabpanel" aria-labelledby="result3-tab">
|
||||
<div class="row p-1">
|
||||
<div class="col-sm-12 col-md-6 text-muted font-weight-normal align-text-bottom">
|
||||
<label class="form-label m-0 mt-2" for="sparqlquery">La query SPARQL è:</label>
|
||||
</div>
|
||||
<div class="col-sm-12 col-md-6 text-right float-right">
|
||||
<div class="btn-group text-right float-right" role="group" aria-label="Tasto copia query">
|
||||
<label class="input-group-text"><ion-icon name="copy"></ion-icon></label>
|
||||
<button class="btn btn-outline-danger btn-sm text-right float-right" tabindex="0" id="copiaQuery" aria-controls="resultQuery" type="button">Copia</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-outline small text-muted font-weight-normal p-1 pt-2" id="showsparqlquery">
|
||||
<textarea class="form-control small text-muted bg-white" id="sparqlquery" rows="4" placeholder="Nessuna query" readonly></textarea>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="container pb-3 px-3 my-3 border bg-lidaBG1">
|
||||
<div class="row align-items-end p-2 halfOpacity">
|
||||
<div class="col shadow bg-lida8"> </div>
|
||||
<div class="col shadow bg-lida9"> </div>
|
||||
<div class="col shadow bg-lida3"> </div>
|
||||
<div class="col shadow bg-lida4"> </div>
|
||||
<div class="col shadow bg-lida5"> </div>
|
||||
</div>
|
||||
<p class="text-right">
|
||||
<cite class="font-italic text-lida5">Info & Copyright</cite>
|
||||
<cite class="font-italic text-secondary font-weight-lighter">(idem)</cite>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script type="module" src="https://unpkg.com/ionicons@5.5.2/dist/ionicons/ionicons.esm.js"></script>
|
||||
<script nomodule src="https://unpkg.com/ionicons@5.5.2/dist/ionicons/ionicons.js"></script>
|
||||
|
||||
|
||||
|
||||
<!-- Da index_Luk_Q_.html -->
|
||||
|
||||
</body>
|
||||
<div class="modal-busy" id="loader" style="display: none">
|
||||
<div class="center-busy" id="test-git">
|
||||
<img alt="" src="lida-loader.gif" />
|
||||
</div>
|
||||
</div>
|
||||
</html>
|
||||
|
|
|
@ -558,11 +558,62 @@ $(document).ready(function() {
|
|||
|
||||
async function execMySparqlQuery (spQuery){
|
||||
const sparqlGenerator = sparqljs.Generator;
|
||||
|
||||
$("#loader").show();
|
||||
alert (new sparqlGenerator().stringify(spQuery));
|
||||
bindingsStream = await myEngine.queryBindings(spQuery, { sources: [ { type: 'sparql', value: sparqlEndpoint }, ], });
|
||||
|
||||
|
||||
$("#sparqlquery").val(spQuery);
|
||||
$("#copiaQuery").prop("disabled", false);
|
||||
var resultTablePart1a = '<table id="resultTable" class="table table-striped table-bordered responsive nowrap"><thead><tr>';
|
||||
var resultTablePart1 = '<table id="resultTable" class="table table-striped table-bordered"><thead><tr>';
|
||||
var resultTablePart2 = '<th scope="col">#</th>';
|
||||
var resultTablePart3 = '</tr></thead><tbody>';
|
||||
var resultTablePart4 = '';
|
||||
var resultTablePart5 = '</tbody></table>';
|
||||
var resultTable = '';
|
||||
var rowNum = 1;
|
||||
for (var i = 0; i < queryFields.length; i++) {
|
||||
resultTablePart2 = resultTablePart2 + '<th scope="col">' + queryFields[i] + '</th>';
|
||||
};
|
||||
var resultTable = resultTablePart1 + resultTablePart2 + resultTablePart3;
|
||||
$('#resultsId1').empty();
|
||||
$('#resultsId1').addClass("small pb-2")
|
||||
$("#risultatitesto").empty();
|
||||
$("#risultatitesto").append("[\n");
|
||||
bindingsStream.on('data', (binding) => {
|
||||
//console.log(binding.toString()); // Quick way to print bindings for testing
|
||||
//console.log(binding.has('sub')); // Will be true
|
||||
resultTablePart4 = '<tr><th scope="row" class="text-muted">' + rowNum++ + '</th>';
|
||||
for (var i = 0; i < queryFields.length; i++) {
|
||||
resultTablePart4 = resultTablePart4 + '<td class="text-muted">' + binding.get(queryFields[i]).value + "</td>";
|
||||
};
|
||||
resultTable = resultTable + resultTablePart4 + '</tr>';
|
||||
$("#risultatitesto").append(binding.toString() + ",\n");
|
||||
$("#loader").hide();
|
||||
//console.log(binding.get('form').value);
|
||||
//console.log(binding.get('form').termType);
|
||||
//console.log(binding.get('pred').value);
|
||||
//console.log(binding.get('obj').value);
|
||||
});
|
||||
bindingsStream.on('end', () => {
|
||||
resultTable = resultTable + resultTablePart5;
|
||||
$("#resultsId1").append(resultTable);
|
||||
$("#risultatitesto").append("]");
|
||||
$("#copiaTesto").prop("disabled", false);
|
||||
$('#resultTable').DataTable( {
|
||||
colReorder: true,
|
||||
language: {
|
||||
url: 'dataTables.it-IT.json'
|
||||
},
|
||||
//dom: 'Blfrtip',
|
||||
dom: "<'row'<'col-sm-12 col-md-6'l><'col-sm-6 col-md-3'f><'col-sm-6 col-md-3 text-right'B>>" + "<'row'<'col-sm-12'tr>>" + "<'row'<'col-sm-12 col-md-5'i><'col-sm-12 col-md-7'p>>",
|
||||
buttons: [ 'copy', 'excel', 'print' ]
|
||||
});
|
||||
setTimeout(function(){
|
||||
buttonDiv = $("#resultsId1").find(".buttons-copy");
|
||||
$('<label class="input-group-text"><ion-icon name="copy"></ion-icon></label>').insertBefore(buttonDiv);
|
||||
},300);
|
||||
});
|
||||
}
|
||||
function AggiornaFiltro(filtroId) {
|
||||
|
||||
|
|
Loading…
Reference in New Issue