Create sparql requests, and perform the request to an endpoint.
JavaScript
Switch branches/tags
Nothing to show
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
.gitingnore
LICENSE
README.md
component.json
index.html
sparql.js

README.md

SPARQL - JS - JQUERY

With this JavaScript class you can easily create sparql requests, and perform the request to an endpoint.

Example

Here is a quick and easy request. Other examples are in the index.html file.

var request = new SPARQL();
request.info = "hello world";

request.variable("?x").variable("?y").where("<http://dbpedia.org/resource/Metallica>", "?x", "?y");
		
request.execute(function(data, info){
	
	console.log(data); //Json by default
	console.log(info); //Print hello world
	
});

Methods

prefixe(namespace, url)

distinct(trueOrFalse)

select(aGraphURIToSelect)

insert(aGraphURIToInsert)

delete(aGraphURIToDelete, condtion)

variable(aVariableName)

vars(anArrayOfVariableNames)

where(subject, predicate, object)

optionalWhere(subject, predicate, object)

union(SPARQLobject)

filter(filter)

orderBy(order)

groupBy(variable)

limit(limitNumber)

offset(offsetNumber)

Defaults

There are some values set by default in this classe :

baseUrl //dbpedia endpoint

format //json

method // GET

queryParam //parameter name for the query (GET or POST)

formatParam //parameter name to ask the returned format

formatAjax //dataType for Jquery's Ajax request