Getting started with e-Link
Introduction
E-Link allows enrichment of content with data from proprietary Linked Data datasets and datasets from the LOD cloud. E-Link performs enrichment with help of a templating mechanism. In this tutorial you will learn what a template is, how to enrich a content, and how to manipulate with templates. This tutorial also provides information on the FREME deployed SPARQL and LDF endpoints. Finally, it provides information on how to simplify the output of the enrichment using templates.
Quick links
Pre-requisites
- A pre-defined template(s). You can use some of the existing templates or learn what a template is and create your own.
- An RDF document for enrichment. If you don't have one, you can use the provided one, or you can perform named entity recognition and use that one. Here is an example.
What is a template?
By our definition, template is a SPARQL CONSTRUCT query which is executed for each string in your NIF document which has associated URL. Such SPARQL query is executed against a specified SPARQL (or LDF endpoint) and will usually retrieve some additional information about the string which is usually an entity, term or simply a word or phrase. For example, a template could retrieve the top 5 closests museums to a city which is annotated in your NIF document and identified with e URI (e.g. DBpedia URI). Below is an example of a such template.
{ "id" : 1, "description" : "This template enriches with a list of museums (max 10) within a 50km radius around each location entity.", "query" : "PREFIX dbpedia: <http://dbpedia.org/resource/> PREFIX dbo: <http://dbpedia.org/ontology/> PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> PREFIX geo: <http://www.w3.org/2003/01/geo/wgs84_pos#> CONSTRUCT { ?museum <http://xmlns.com/foaf/0.1/based_near> <@@@entity_uri@@@> . } WHERE { <@@@entity_uri@@@> geo:geometry ?citygeo . OPTIONAL { ?museum rdf:type dbo:Museum . } ?museum geo:geometry ?museumgeo . FILTER (<bif:st_intersects>(?museumgeo, ?citygeo, 50)) } LIMIT 10", "label" : "Find nearest museums", "endpoint" : "http://live.dbpedia.org/sparql/", "endpointType" : "SPARQL" }
Each template consists of: ID that identifies the template, SPARQL query, human readable label, short description, URL to the endpoint, and information about the type of the endpoint, whether its SPARQL or LDF endpoint.
The SPARQL query should have the field @@@entity_uri@@@ which identifies an entity. When performing enrichment, the template is executed for each entity (identified with taIdentRef) in the document. It means, each @@@entity_uri@@@ is replaced with the taIdentRef link from the submitted document for enrichment. So @@@entity_uri@@@ is a reserved field name. However you can always introduce your fields e.g. ... } LIMIT @@@my_limit@@@ and then use this field by submitting my_limit parameter in the request.
In the following examples you can learn how to enrich content with e template, how to manipulate with templates (retrieve, create, update or remove a template). You can also learn about the SPARQL and LDF endpoints deployed by FREME.
Step 1: Enrich NIF content with predefined query templates
First we need to prepare the content for enrichment. The dataset should be provided in RDF.
Content for enrichment
Paste here the content for enrichment. It should be valid RDF in the serialization format as specified bellow.
Serialization format
Specify the RDF serialization format of the input data.
Template ID
The ID of the template which will be used to enrich the data.
Response
Here will show your enriched content.
Step 2: Exploring a resource against a SPARQL or LDF endpoint
E-Link also provides an option to return information about a single resource.
Resource URI
Specify the URI of the resource. E.g. "resource=http://dbpedia.org/resource/Berlin".
Endpoint URL
A URL of the endpoint which should be used to retrieve info about the resource.
Endpoint type
The type of the endpoint. Accepted values: sparql or ldf
Response
Here you will get the results from the named entity recognition using your dataset.
Step 3: Manipulation with templates
E-Link allows users to manipulate the templates - retrieve, create, update, or template.
Retrieve all templates
A client can retrieve all the templates by submitting GET request at /e-link/templates.
Response
Here you will get the results from the named entity recognition using your dataset.
Get one template
To retrieve a single tempate a user can submit a GET request at /e-link/templates/{template-id}.
Template ID
The ID of the template. Accepted values: sparql or ldf
Response
Here you will get the results from the named entity recognition using your dataset.
Create template
E-link also allows users to create templates according to their needs.
Template to create
Paste here the content of the template.
Token
Paste your token. You can retrieve an access token by following this instructions , or read more about the FREME authentication mechanism.
Response
Here you will get the results from the creation of the template.
Update template
E-Link allows to update an existing template.
Template definition
Past the new content of the template.
Token
Paste your token. You can retrieve an access token by following this instructions, or read more about the FREME authentication mechanism.
Template ID to update
Provide the ID of the template you want to update
Response
Here you will get the results from template update.
Remove a template
A template can also be removed.
Template ID to remove
ID of the template you want to remove.
Token
Paste your token. You can retrieve an access token by following this instructions, or read more about the FREME authentication mechanism.
Response
Here you will get the results from the removal of the template.
FREME SPARQL and Linked Data Fragments endpoints
E-Link can work with SPARQL and Linked Data Fragments endpoints. FREME hosts SPARQL endpoint. Linked Data Fragments endpoints can be found at http://linkeddatafragments.org/
Important note: FREME no more hosts a LDF endpoint which was perviously available at http://rv2622.1blu.de:5000/. However, e-Link can further be used with other available LDF endpoints. The information bellow on LDF is left for informational purposes.
- FREME LDF endpoint: The main landing page of the LDF endpoint can be found at http://rv2622.1blu.de:5000/. Via this page a user can access and query the deployed datasets via the e-Link service. E.g. the LDF endpoint of the ORCID datset is http://rv2622.1blu.de:5000/orcid and http://rv2622.1blu.de:5000/cordis for the CORDIS FP7 dataset.
- FREME SPARQL endpoint: FREME also hosts a SPARQL endpoint at http://api.freme-project.eu/sparql. The endpoint is provided via the Virtuoso triple store.
Simplify the output
If you are not familiar with RDF/NIF format, you can retrieve the results from the enrichment in a simplified form (e.g. in CSV) by specifying filter. In the following example we are using the "extract-entities-only" filter which will output the results in CSV. For more on simplifying output using filters you can read in this article.
Filter name
Specify the name of the filter which will be used to simplify the results. E.g. "filter=extract-entities-only".
Content for enrichment
Paste here the content for enrichment. It should be valid RDF in the serialization format as specified bellow.
Serialization format
Specify the RDF serialization format of the dataset.
Template ID
The ID of the template which will be used to enrich the data.
Response
Here you will get the results in simplified form.