Improve this doc View source

SparqlService
service in module sparql

Description

Service for querying a SPARQL endpoint.

Usage

new SparqlService(configuration);

Parameters

ParamTypeDetails
configurationObjectstring

object or the SPARQL endpoit URL as a string. The object has the following properties:

  • endpointUrl - {string} - The SPARQL endpoint URL.
  • usePost - {boolean} - If truthy, use POST instead of GET. Default is false.

Methods

Example

var endpoint = new SparqlService({ endpointUrl: 'http://dbpedia.org/sparql', usePost: false });
// Or using just a string parameter:
endpoint = new SparqlService('http://dbpedia.org/sparql');

var qry =
'PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> ';
'SELECT * WHERE { ' +
' ?id a <http://dbpedia.org/ontology/Writer> . ' +
' OPTIONAL { ?id rdfs:label ?label . } ' +
'}';

var resultPromise = endpoint.getObjects(qry);