Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

132
Visualizações
Execute SPARQL Query with vue.js

I want to make a website by implementing the use of sparql in vue js. The scenario I want is to create a special place to write Sparql Query and then execute it with vue.js. Is all that possible? if possible how should i start it? if not possible, is there any other alternative than using vue.js? Please help.

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

I am not a JS pro by any means. Anyway, for a similar problem, I used axios for the HTTP request. This worked fine for my use case. Anyway, you will find a precise description of the JSON format at https

var params = new URLSearchParams();
// queryArtistsByNameTpl contains the actual SPARQL query,
// with $artistName as a placeholder
let similarGroupsQuery = queryArtistsByNameTpl.replace("$artistName", this.artistName);
params.append('query', similarGroupsQuery);
let getArtistsHandler = sparqlResponseHandler(this, 'artistList');
axios.post(sparqlEndPoint, params).then(getArtistsHandler);

function sparqlResponseHandler(currentObj, currList) {
  return function(response) {
    const rows = response.data.results.bindings;
    currentObj[currList] = [];
    if (rows.length > 0) {
      rows.forEach(function(item, index) {
        var record = {};
        for (var prop in item) {
          if (item.hasOwnProperty(prop)) {
            record[prop] = item[prop].value;
          }
        }
        currentObj[currList].push(record);
      })
    } else {
      console.log("no data from SPARQL end point");
    }
  }
}

The JSON resturned by SPARQl endpoints is specified in https://www.w3.org/TR/sparql11-results-json/ , which is rather short and very understandable.

The code can certainly be improved by someone more knowledgeable then me, but it was fine for the tech demo we used it for.

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda