SPARQL Builder API Specification

This page introduces the specification of SPARQL Builder API used by SPARQL Builder GUI.

Endpoint list

http://sparqlbuilder.org/api/eplist

You can get the list of SPARQL endpoints as a json array as follows:

["http://www.ebi.ac.uk/rdf/services/biomodels/sparql","http://www.ebi.ac.uk/rdf/services/biosamples/sparql","http://www.ebi.ac.uk/rdf/services/reactome/sparql","http://www.ebi.ac.uk/rdf/services/atlas/sparql","http://www.ebi.ac.uk/rdf/services/chem
bl/sparql"]

Class list

http://sparqlbuilder.org/api/clist

If you input the  URL of sparql endpoint with parameter “ep”, the class list will return as a json array of json objects including “uri” for a class and a string “display” of a label and the number of instances as follows:

Input: http://sparqlbuilder.org/api/clist?ep=http://www.example.org/sparql
Output:
[{"uri":"http://www.example.org/class1","label":"Gene","number":"11252"},{"uri":"http://www.example.org/class2","label":"Protein","number":"3528"},{"uri":"http://www.example.org/class3","label":"Compound","number": 8235"}

Path list

http://sparqlbuilder.org/api/plist

For the  URL of sparql endpoint with parameter “ep”, the URL of a class with parameter “startClass”, and the URL of a class with parameter “endClass”, you can get the list of paths between the two classes  sorted by the number of triples as json object as follows:

Input: http://sparqlbuilder.org/api/plist?ep=http://www.example.org/sparql&startClass=http://www.example.org/class1&endClass=http://www.example.org/class2
Output:[{"startClass":"http://www.example.org/class1","label":"Gene","classLinks":[{"predicate":"http://www.example.org/pre1","linkedClass":"http://www.example.org/class3","direction":"forward","label":"Compound"},...]},...]}

Note that parameter “direction'” can be “forward” or “reverse”. To know details for paths and class links, please see here.

SPARQL generation from a path

http://sparqlbuilder.org/api/sparql

For a path with a parameter “path” described as a json object as shown in the example of Path list, you can get a SPARQL query as a string.

Input: http://sparqlbuilder.org/api/sparql?path={"startClass":"http://www.example.org/class1","label":"Gene","classLinks":[{"predicate":"http://www.example.org/pre1","linkedClass":"http://www.example.org/class3","direction":"forward","label":"Compound"},...]}
Output: A SPARQL query