URI Data Services
Linked Data Finland
In addition to SPARQL Services, LDF.fi provides the users with various additional services described below.
Viewing an RDF Description in RDF
A recurring task in Linked Data application development is to find out what a URI means, i.e., how it is described in terms of RDF properties. For URIs defined at the LDF.fi domain, the URI format is
where ID is the local name (e.g., p166) of the URI in a graph GRAPH of a dataset DATASET. For example: http://ldf.fi/history/histo/p166.
The RDF description of such URIs can be obtained easily by using the following URL templates in an ordinary web browser:
- URI.ttl URI description in Turtle format
- URI.xml URI description in XML format
- URI.json URI description in JSON format
- URI.n3 URI description in N3 format
- URI.nt URI description in N-triples format
If the URI is external and not defined in the LDF.fi namespace, but has a description in an LDF.fi service dataset, then this descripion can be viewed by using the data and page services of the dataset, using the following URL patterns:
- http://SERVICE/data?uri=URI (RDF description, where URI is a URI)
- http://SERVICE/page?uri=URI (RDF description in HTML, where URI is a URI)
When using the data service URL http://SERVICE/data?uri=URI in a browser the result is interpreted to be an RDF file by default. The browser therefore asks for permission to open or save it. To see the result immediately as a web page in the browser, an additional parameter "force-accept" with value "text/plain" should be used:
Page and data services can be used for LDF.fi-based URIs, too, but are more verbose than the shorthand format-based URL patterns above.
Viewing an RDF Description in HTML
When a URI is used in a context, it may refer to three things: 1) the actual idenfier, 2) the RDF description of the resource, or 3) a HTML page illustrating the RDF, where resources are rendered using their human readable labels. This means that a resource is actualy assoated with three different URIs: 1) the URI identifier, 2) URI for its RDF description, and 3) URI for the HTML representation of the RDF desription. In DBpedia, for example, the concept of Helsinki has the following three URIs:
- http://dbpedia.org/resource/Helsinki (identifier)
- http://dbpedia.org/data/Helsinki (RDF description)
- http://dbpedia.org/page/Helsinki (RDF description in HTML)
If a HTTP request for more information about an identifier URI is sent to a dataservice, then it is not clear whether the RDF data or a HTML page depicting the RDF data should be returned. To make the decision, HTTP headers and content negiation are used in Linked Data. For example, if the URI is input in a browser, then the HTML representations of an RDF description is returned, not the RDF itself. In LDF.fi, a Linked Data HTML viewer, such as URIBurner or our own tool SAHA, is used for rendering RDF descriptions in a browser. The choice of the viewer depends on whether the URI is defined in the LDF.fi domain or not.
A befefit of viewing RDF in HTML form is that the HTML page contains links to related resources which facilitates Linked Data browing between resources whose descriptions may be hosted at different data services. As a technical solution for serving LD browsing, we use URIBurner. Here the URL above is redirected to URIBurner (using Varnish) with information about the original URI, and URIBurner renders the RDF description of the URI in HTML. When the user clicks on a link there, URIBurner asks LDF or some data service based on the URI, what the corrresponding resource means in RDF, renders a new human readable page about it, and so on. Using the same process, URI decriptions in other name spaces and data services, such as DBpedia, are rendered. Linked Data browsing is an example of a system, where machines make use of RDF descriptions of resources obtained across the Semantic Web.
Getting an RDF Description for Machine Use
The description of a resource can be read by a machine by using an HTTP request to a URI. The request can be parametrized using the HTTP header. For example, creating a request with Wget
wget --header='accept: application/rdf+xml' http://ldf.fi/history/histo/p166
would return the RDF description of the given URI. It is also possible to use the LDF.fi data service for getting RDF data
where SERVICE=ldf.fi/DATASET. For example:
A virtue of using this method is that here it is possible to specify the request by additional GET/POST parameters easily. For example, the URL
would return the RDF description of the URI, given as the "uri" parameter, in Turtle format (ttl). The parameters available depend on the underlying RDF data server that in our case is Fuseki.
Alternative URI patterns for RDF formats
In summary, LDF.fi provides the following URI patterns for different RDF formats:
|Default (Turtle)||Turtle||RDF/XML||JSON-LD||RDF/JSON||N3||N-Triples||Force content type as text/plain|
|URI + Accept header||URI||text/turtle||application/rdf+xml||application/ld+json||application/rdf+json||-||application/n-triples||(not possible)|
|URI + extension||URI||.ttl||.xml||.json||.rj||.n3||.nt||(always forced)|
|URL template + GET parameter||http://ldf.fi/data?uri=URI||&format=ttl||&format=xml||&format=json||&format=json-rdf||&format=text/n3||&format=application/n-triples||&force-accept=text/plain|
|URL template + GET parameter (for URIs not in http://ldf.fi namespace)||http://SERVICE/data?uri=URI|