Changeset 28737 for main/trunk


Ignore:
Timestamp:
2013-12-03T11:20:54+13:00 (10 years ago)
Author:
davidb
Message:

Next stage of development

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/trunk/model-sites-dev/von-sparql/transform/pages/home.xsl

    r28688 r28737  
    1515    <script type="text/javascript" src="ext/jena/sgvizler/jsapi"><xsl:text> </xsl:text></script>
    1616    <script type="text/javascript" id="sgvzlr_script" src="ext/jena/sgvizler/sgvizler.js"><xsl:text> </xsl:text></script>
     17    <script type="text/javascript" src="ext/von-sparql/von-sparql-script.js"><xsl:text> </xsl:text></script>
     18<div>
     19<div id="sgvzl_PredicateOverview"
     20      data-sgvizler-endpoint="http://localhost:3030/greenstone/query"
     21      data-sgvizler-chart="gTable"
     22      data-sgvizler-loglevel="2"
     23      data-sgvizler-chart-options="title=Items by Language"
     24      width="100"
     25      style="width:450px; height:250px;display:inline-block;float:left" >
     26  <xsl:attribute name="data-sgvizler-query">
     27      SELECT ?Predicate (COUNT (?Predicate) AS ?Count) (COUNT (DISTINCT ?o) AS ?Distinct_Values)
     28      WHERE{
     29        ?s ?Predicate ?o
     30      }
     31      GROUP BY ?Predicate
     32      ORDER BY DESC (?Predicate)
     33  </xsl:attribute>
     34  <xsl:comment>Filler</xsl:comment>
     35</div>
     36<div id="queryContainer"
     37     style="
     38     border:1px solid #DFD9C3;
     39     width:450px;height:250px;
     40     float:left;
     41     margin-left:15px;
     42     padding:10px;
     43     overflow-y:scroll;"
     44     >
     45     <span>SPARQL Query:</span>
     46     <br/>
     47     <span id="span_sparqlQuery"
     48           style="font-size:10pt;">
     49     <xsl:comment>Filler</xsl:comment>
     50     </span>
     51</div>
     52</div>
     53<br/>
     54<div style="margin-top:20px;margin-bottom:10px;display:inline-block;">
     55    <label for="sel_Predicate">View Predicate:</label>
     56    <select id="sel_Predicate">
     57        <option value="None"></option>
     58    </select>
     59    <br/>
     60    <div style="margin-left:20px;margin-bottom:20px;margin-top:5px">
     61        <input type="checkbox" id="cb_RefineSearch"/> <label for="cb_RefineSearch">Refine search to:</label>
     62        <br/>
     63        <label for="sel_RefineObject">?o</label>
     64        <select id="sel_RefineObject" enabled='false'>
     65            <option value="None">Select predicate above</option>
     66        </select>
     67        <br/>
     68        <label for="sel_RefinePredicate">?p</label>
     69        <select id="sel_RefinePredicate" enabled='false'>
     70            <option value="None">Select ?o above</option>
     71        </select>
     72    </div>
    1773
     74    <select id="sel_Limit">
     75        <option value="None">No Limit</option>
     76        <option value="10">10</option>
     77        <option value="25">25</option>
     78        <option value="50">50</option>
     79        <option value="75">75</option>
     80        <option value="100">100</option>
     81    </select>
     82    <select id="sel_ChartType">
     83        <option value="gTable">Table</option>
     84        <option value="gPieChart">Pie Chart</option>
     85        <option value="gBarChart">Bar Chart</option>
     86    </select>
     87    <button type="button" id="btn_ShowChart">Execute Query</button>
     88</div>
     89<script type="text/javascript">
     90      <xsl:text disable-output-escaping="yes">
     91      var overviewSparqlQuery;
     92      function sgvizlerGo (){
     93         overviewSparqlQuery = $('#sgvzl_PredicateOverview').attr("data-sgvizler-query");
     94         sgvizler.go();
    1895
    19     <script type="text/javascript">
    20       <xsl:text disable-output-escaping="yes">
    21       sgvizler.option.namespace.mo ='http://purl.org/ontology/mo/';
    22       sgvizler.option.namespace.salami = 'http://nema.lis.illinois.edu/salamiEndpoint/';
     96         //Load possible predicate values into selector
     97         updatePredicateSelector();
    2398
    24       sgvizler.option.namespace.salami = 'http://nema.lis.illinois.edu/salamiEndpoint/';
    25      
     99         //Ensure search refinement elements are greyed
     100         toggle_RefineSearch(0);   
     101         $('#cb_RefineSearch').prop('checked',false);
     102      }
    26103      sgvizler.option.namespace.dc = 'http://purl.org/dc/elements/1.1/';
    27104      sgvizler.option.namespace.gsembedded = 'http://greenstone.org/gsembedded#'
    28105      sgvizler.option.namespace.greenstonedata = 'http://localhost:3030/greenstone/data/'
    29       $(document).ready(sgvizler.go());
     106      $(document).ready(sgvizlerGo());
     107
     108      $("#btn_ShowChart").click(function(){
     109        newPredQuery("sgvzl_container", $('#sel_ChartType').val())
     110      });
     111      $("#cb_RefineSearch").click(function(){
     112        if(document.getElementById("cb_RefineSearch").checked==false)
     113            toggle_RefineSearch(0);
     114        else
     115            toggle_RefineSearch(1);
     116
     117        generateQuery();
     118      });
     119      $("#sel_Predicate").change(function(){
     120        updateRefineObjectSelector($("#sel_Predicate").val());
     121        generateQuery();
     122      });
     123      $("#sel_RefineObject").change(function(){
     124        updateRefinePredicateSelector($("#sel_RefineObject").val());
     125        generateQuery();
     126      });
     127      $("#sel_RefinePredicate").change(function(){
     128        generateQuery();
     129      });
     130      $("#sel_Limit").change(function(){
     131        generateQuery();
     132      });
    30133      </xsl:text>
    31     </script>
     134</script>
    32135
     136<div id="sgvzl_container"
     137     style="width:auto; height:400px; margin-top:10px; ">
     138</div>
     139</xsl:template>
    33140
    34 <div id="sgvzl_example1"
    35       data-sgvizler-endpoint="http://localhost:3030/greenstone/query"
    36 
    37       data-sgvizler-chart="gPieChart"
    38       data-sgvizler-loglevel="2"
    39       data-sgvizler-chart-options="title=Items by Language"
    40       style="width:900px; height:400px; margin-left: auto; margin-right: auto">
    41   <xsl:attribute name="data-sgvizler-query">
    42      SELECT (?langTag) (COUNT(?langTag) AS ?freqCount)
    43      WHERE {
    44        GRAPH &lt;http://localhost:3030/greenstone/data/hathitrust-tab&gt;  {
    45          ?s &lt;http://purl.org/dc/elements/1.1/Language&gt; ?langTag .
    46        }
    47      }
    48      GROUP BY ?langTag
    49   </xsl:attribute>
    50 </div>
    51 
    52 
    53 
    54 
    55   </xsl:template>
    56141
    57142    <!-- the page content -->
Note: See TracChangeset for help on using the changeset viewer.