1

So me and my friends are trying to display data from a sparql query from graphDB. If we run this query in graphDB we get all the needed data displayed. However, we are trying to run it in an HTML file linked with a Javascript file. If we run this code we get the following error:

enter image description here

We've tried this with another sparql endpoint and it worked but if we use our endpoint generated from our graphDB repository, it does not work somehow. Does anyone know how to fix this error?

<html>
  <head>
    <script type="text/javascript" src="https://ajax.aspnetcdn.com/ajax/jQuery/jquery-3.2.1.min.js"></script>
    <script type="text/javascript" src="https://www.google.com/jsapi"></script>
    <script type="text/javascript" src="sgvizler.js"></script>
    <script>
      $(document).ready(
          function (){ sgvizler.containerDrawAll(); }
      );
    </script>
  </head>
    <div id="example"
         data-sgvizler-endpoint="http://10.11.17.26:7200/repositories/DESPERATE"
         data-sgvizler-query="PREFIX rdf: http://www.w3.org/1999/02/22-rdf-syntax-ns#
PREFIX ex: http://example/base/
PREFIX : http://www.semanticweb.org/cjtya/onto/


select ?name ?age ?height ?weight where { 
        ?player rdf:type :Boston_Celtics_players ; #change the object to needed team
            ex:has_name ?name ;
            ex:has_age ?age ;
             ex:has_height ?height ;
            ex:has_weight ?weight . 
}"
         data-sgvizler-chart="google.visualization.Table"
         style="width:800px; height:400px;"></div>
  </body>
</html>

If we try to access the sparql endpoint through our browser (microsoft Edge or chrome) we get the following:

missing parameter: query

  • Can you show the actual (relevant part of) the code, including the complete URL you use to connect to the endpoint? – Jeen Broekstra Oct 25 '20 at 21:07
  • Pasting code into a comment is nearly unreadable. Try to [edit] your question. See [ask] for some more tips on how to make your question answerable. That being said though: at first glance that url at least looks fine. – Jeen Broekstra Oct 25 '20 at 21:32
  • 1
    We have pasted our code in the question just now! – Captain Somma Oct 25 '20 at 21:46
  • Thanks for that. Client-side code looks fine to me at first glance. GraphDB apparently responds with a 400 ("bad request") error, which may indicate that the sgvizler component you're using is sending something odd. Two things you can check: 1) in the Network tab of your browser dev tools, look at the details of the request your frontend sends to GraphDB (is it a GET or POST, what's the payload and parameters look like?), and 2) have a look at GraphDB's own logs, see if there's any or warning about why it fails on the request. – Jeen Broekstra Oct 25 '20 at 22:50
  • We have looked at the details of the frontend and this is what we found: Request Method: GET Status Code: 400 Remote Address: 10.11.17.26:7200 – Captain Somma Oct 25 '20 at 23:12
  • Please post the complete request and response (Chrome can save a "HAR" file with that data). It might also be a CORS problem, see https://graphdb.ontotext.com/documentation/standard/workbench-user-interface.html#workbench-configuration-properties – Vladimir Alexiev Feb 12 '21 at 12:38
  • Curious: are you using sgvizler for a student assignment? GraphDB Workbench has equivalent charts (and more), and is open sourced... – Vladimir Alexiev Feb 12 '21 at 12:38

0 Answers0