Linked Data Driven Web Application

Created on March 13, 2013, 8:33 p.m. by Hevok & updated by Hevok on May 2, 2013, 5:15 p.m.

To build a Linked-Data driven Web Application one has usually to consider some Local RDF Store where one caches the results and that one uses as a permanent storage for the Application. Then the Logic (Controller) and the User Interface (Business Logic) is not specific to Linked Data Applications and it makes in the end the Application. One need some kind of a Data Integration Component which can have access directly to the Linked Data Cloud or to some kind of Semantic Indexer, i.e. to one of the Semantic Web Search Engines. If one not only want to use Linked Data, but also publish new Linked Data then one has to consider a Data Republishing Component to write back Application dependent Data back into the Web of Data [M. Hanseblas: Linked Data Applications DERI Technical Report, 2009].

Usually one has to access SPARQL Endpoints for the Linked Data driven Application and for this W3C provides a list of all the currently alive Endpoints. SPARQL Endpoints are RESTful Web Services which means one can access some via simple HTTP Get Request and a SPARQL Query can be formulated with HTTP and send to a SPARQL Endpoint. The result will be given in different Formats how one wants the Results be back. This ca be guided and is driven by the Parameters that one uses in the SPARQL Query. This can be XML, JSON, plaintext, it can even be RF/XML, NTriples, Turtle N3 and any kind of Format which is determined by the Accept Header via the Parameters one uses.

The easiest way to make one of these Application is to use one of these Linked Data or Semantic Web Libraries. For example there is a SAPRQL Library for JavaScript, PHP, Java and Python and there are many more. Look them up and choose the Programming Language that you are used to, apply and then one can make use of SPARQL Endpoints and Linked Data Applications that one programs.

An example for a rather small Program that uses Linked Data on the Web is Python based. There one imports the Library one needs. Then one defines the Service one wants to access, i.e. the SPARQL Endpoint. Then one defines the Query String with a SELECT or CONSTRUCT that one uses here in SPARQL. Then one sets the return Format and subsequently executes the query as well converts the result. Lastly one can simply iterate through the Result List where one returns single Query solutions which are one row/line of the result which one might further process.

This is really the simplest way to access Linked Data on the Web.

from SPARQLWrapper import SPARQLWrapper, JSON

sparql = SPARQLWrapper("http://dbpedia.org/sparql")
sparql.setQuery("""
    PREFIX rdfs: 
    SELECT ?label
    WHERE {  rdfs:label ?label }
""")
sparql.setReturnFormat(JSON)
results = sparql.query().convert()

for result in results["results"]["bindings"]:
    print(result["label"]["value"])
Image-3-Round-Stones.jpg

Tags: links, web, deploy, implementation, application, information, semantics, data
Categories: Concept, reST
Parent: Linked Data

Update entry (Admin) | See changes

Comment on This Data Unit