Introduction

The web API is implemented over HTTP and is based on the principles of REST architecture. The aim is to allow innovative web applications to build smarter tools on the top of L.E.D. API. Moreover, being available on the Internet, it can be used by anyone for comparison with other metrics for different purposes, such as tag cloud enrichment, ranking of RDF graphs (in particular DBpedia), contextual tagging.

The L.E.D. API consists of two methods on a REST endpoint (http://sisinflab.poliba.it/led/api/). To perform an action using the L.E.D. API, a request to the endpoint has to be sent specifying a method and its arguments. The response can be formatted either in JSON or in XML. Clients can also exploit the L.E.D. API through Javascript and bypass the same origin policy requesting the response, thanks to JSONP.

Methods

get/tags

It fetches all tags related to a general keyword. This method returns a list of DBpedia resources that contain the searched keyword either in their rdfs:label or in their dbpedia-owl:abstract.

ParameterValueDescription
q string (required) The query to search for. It can be a whole phrase, a keyword or just a part of it.
key string (required) A valid key. Please contact Roberto Mirizzi to obtain a new one.
limit integer: default 10 The maximum number of results to return. If not specified it is set to 10.
format string {JSON or XML}: default JSON The format of the response. If not specified the output will be JSON.
callback string The name of the callback function to wrap around the JSON data. It has to be used only if format is JSON. If not specified, the response is plain JSON.

Response:
JSON:
  {
   "query":"q",
   "results":[
     {"label":"label1","uri":"http://dbpedia.org/resource/uri1"},
     {"label":"label2","uri":"http://dbpedia.org/resource/uri2"},
     ...
   ],
   "total":n
  }

XML:
  <led>
   <query>q</query>
   <results>
    <label>label1</label>
    <uri>http://dbpedia.org/resource/uri1</uri>
   </results>
   <results>
    <label>label2</label>
    <uri>http://dbpedia.org/resource/uri2</uri>
   </results>
   ...
   <total>4</total>
  </led>


Examples:
http://sisinflab.poliba.it/led/api/get/tags?q=php&key=demo&format=json&callback=foo
http://sisinflab.poliba.it/led/api/get/tags?q=rdf&key=demo&limit=4&format=xml

It fetches all the tags related to the selected one. This method returns a list of DBpedia resources that are related to a given resource. The user can get either any resource that is somehow related to the given one or only the resources that are ancestors of the given one, i.e., resources that are more general than the selected one. These last resources correspond to Wikipedia Categories.

ParameterValueDescription
q string OR array of strings (required) The uri of the DBpedia resource to explore. If an array of strings is passed, the method returns the most relevant resources w.r.t. all the ones specified in the array.
key string (required) A valid key. Please contact Roberto Mirizzi to obtain a new one.
showAll integer {0 or 1}: default 0 If set to 1, it returns all the related resources, even if they have the same label, e.g., dbpres:PHP and dbpres:Category:PHP have the same label even if they refer to different DBpedia resources.
parents integer {0 or 1}: default 0 If set to 1, it returns a list of the ancestors of the selected resource, i.e., DBpedia resources that are more general than the selected one.
format string {JSON or XML}: default JSON The format of the response. If not specified the output will be JSON.
callback string The name of the callback function to wrap around the JSON data. It has to be used only if format is JSON. If not specified, the response is plain JSON.

Response:
JSON:
  {
   "records":{"system":n,"users":m},
   "maxRelevance":maxR,
   "main":{
    "uri":"http://dbpedia.org/resource/uriQ",
    "label":"labelQ",
    "description":"descQ"
   },
   "system":[
    {
     "uri":"http://dbpedia.org/resource/res1",
     "label":"label1",
     "description":"desc1",
     "relevance":r1,
     "normalizedRelevance":k1
    },
    {
     "uri":"http://dbpedia.org/resource/res2",
     "label":"label2",
     "description":"desc2",
     "relevance":r2,
     "normalizedRelevance":k2
    },
    ...
   ]
  }

XML:
  <led>
   <records>
    <system>n</system>
    <users>m</users>
   </records>
   <maxRelevance>maxR</maxRelevance>
   <main>
    <uri>http://dbpedia.org/resource/uriQ</uri>
    <label>labelQ</label>
    <description>descQ</description>
   </main>
   <system>
    <uri>http://dbpedia.org/resource/res1</uri>
    <label>label1</label>
    <description>desc1</description>
    <relevance>r1</relevance>
    <normalizedRelevance>k1</normalizedRelevance>
   </system>
   <system>
    <uri>http://dbpedia.org/resource/res2</uri>
    <label>label2</label>
    <description>desc2</description>
    <relevance>r2</relevance>
    <normalizedRelevance>k2</normalizedRelevance>
   </system>
   ...
  </led>


Examples:
http://sisinflab.poliba.it/led/api/get/related-tags?q=<http://dbpedia.org/resource/RDFa>&key=demo&format=json
http://sisinflab.poliba.it/led/api/get/related-tags?q[]=<http://dbpedia.org/resource/PHP>&q[]=<http://dbpedia.org/resource/Zend_Framework>&key=demo&format=xml