Skip to content

Commit 92eee8d

Browse files
author
Gaurav SinghaRoy
committed
showing 3 different JSON download
1 parent bd2e6e3 commit 92eee8d

4 files changed

Lines changed: 45 additions & 7 deletions

File tree

app/assets/javascripts/query.js.coffee

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@
7575
if SPARQL.textbox.is_valid()
7676
$("#sparql_download_modal").modal("show")
7777
QueryBuilder.convert.configured.hide_download()
78+
QueryBuilder.convert.json.hide_download()
7879

7980
@get_uri_element_val =(uri)->
8081
break_index = null

app/assets/javascripts/resources/querybuilder.js

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -887,8 +887,26 @@ QueryBuilder = {
887887
$("#btn_group_download").show();
888888
}
889889
}
890-
} // end configured
891-
}, // end convert
890+
}, // end QueryBuilder.convert.configured
891+
json:{
892+
initiate_download : function(){
893+
$("#btn_group_download").hide("fast");
894+
$("#div_json_download").show("fast");
895+
896+
},
897+
hide_download : function(motion){
898+
if(motion != undefined && motion != ""){
899+
$("#div_json_download").hide("fast");
900+
$("#btn_group_download").show("fast");
901+
}
902+
else{
903+
$("#div_json_download").hide();
904+
$("#btn_group_download").show();
905+
}
906+
}
907+
908+
}//end QueryBuilder.convert.json
909+
}, // end QueryBuilder.convert
892910
equivalent_query : {
893911
handle_checked_properties : function(response){
894912
$("#hdn_show_checked_properties").val(response);

app/assets/javascripts/resources/sparql.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -73,10 +73,7 @@ SPARQL = {
7373
pdf : function(){
7474
Utils.alert("The PDF download feature has not been implemented yet.");
7575
},
76-
json :{
77-
initiate : function(){
78-
79-
},
76+
json :{
8077
sesame : function(){
8178
var query = $("#txt_sparql_query").val();
8279
if(QueryBuilder.properties.will_show_properties_in_preview() == false){

app/views/query/_search_results.html.erb

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,34 @@
3939
<div class="btn-group " id="btn_group_download">
4040
<button type="button" class="btn btn-default btn-primary" onclick="SPARQL.download.rdb()"><span class="glyphicon glyphicon-list-alt"></span>&nbsp;RDB Script</button>
4141
<button type="button" class="btn btn-default btn-success" onclick="SPARQL.download.csv()"><span class="glyphicon glyphicon-align-justify"></span>&nbsp;CSV</button>
42-
<button type="button" class="btn btn-default btn-info" onclick="SPARQL.download.json.virtuoso()"><span class="glyphicon glyphicon-road"></span>&nbsp;JSON</button>
42+
<button type="button" class="btn btn-default btn-info" onclick="QueryBuilder.convert.json.initiate_download()"><span class="glyphicon glyphicon-road"></span>&nbsp;JSON</button>
4343
<button type="button" class="btn btn-default btn-warning" onclick="SPARQL.download.pdf()"><span class="glyphicon glyphicon-file"></span>&nbsp;PDF</button>
4444
<%if in_query_builder_action?%>
4545
<button class="btn btn-default btn-danger" onclick="QueryBuilder.convert.configured.initiate_download()"><span class="glyphicon glyphicon-glass"></span>&nbsp;Generic</button>
4646
<%end%>
4747
</div>
48+
<div class="row" id="div_json_download" style="display:none;">
49+
<p>
50+
<button class="btn btn-danger btn-xs" type="button" onclick="QueryBuilder.convert.json.hide_download('fast')"><span class="glyphicon glyphicon-chevron-left"></span>&nbsp;back</button>
51+
</p>
52+
<p>
53+
<h4>JSON Download</h4>
54+
</p>
55+
<p>
56+
We have three kinds of JSON output available for you
57+
</p>
58+
<p>
59+
<span class="btn btn-danger" onclick="SPARQL.download.json.sesame()"><span class="glyphicon glyphicon-download-alt"></span>&nbsp;Sesame</span>&nbsp; This output format is provided my Sesame datastores.
60+
</p>
61+
<p>
62+
<span class="btn btn-success" onclick="SPARQL.download.json.virtuoso()"><span class="glyphicon glyphicon-download-alt"></span>&nbsp;Virtuoso</span>&nbsp; This output format is provided my Virtuoso datastores.
63+
</p>
64+
<%if in_query_builder_action?%>
65+
<p>
66+
<span class="btn btn-primary" onclick="SPARQL.download.json.for_class()"><span class="glyphicon glyphicon-download-alt"></span>&nbsp;Experimental</span>&nbsp; This output format is a suggested experimental format which is useful to explore data output when you have queried data which are objects of some class(es).
67+
</p>
68+
<%end%>
69+
</div>
4870
<%if in_query_builder_action?%>
4971
<div class="div-configured-download row" style="display:none;">
5072
<div class="col-md-12">

0 commit comments

Comments
 (0)