如何在axios.get()中添加前缀sparql

时间:2019-04-03 20:56:25

标签: vue.js axios sparql

当我不添加前缀时,一切都很好,但是我添加了前缀,在控制台中显示了错误:

400 (Parse error: ? PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns??Encountered " "<" "< "" at line 1, column 19.??Was expecting:??

这是我在Vue js中的代码:

methods:{
getUrl(){
  axios.get(`
  http://localhost:3030/demo/sparql?format=json&query=
  PREFIX    rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
    SELECT *   
    WHERE {
            ?s ?p ?o
    } LIMIT 10 `).then((response) =>{
      this.loading = false;
      const result = response.data.results.bindings;
      this.data = result;
      console.log(result)
    })
}

这是控制台中的错误:

xhr.js?b50d:178 GET http://localhost:3030/demo/sparql?format=json&query=%20%20%20%20%20%20PREFIX%20rdf:%20%3Chttp://www.w3.org/1999/02/22-rdf-syntax-ns 400 (Parse error: ? PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns??Encountered " "<" "< "" at line 1, column 19.??Was expecting:?? <IRIref> ...??)

Error in Console

0 个答案:

没有答案