Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

130
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda