Comunica Tutorial - Basics

Joachim Van Herwegen, Ruben Taelman

Portorož, Slovenia, 3 June 2019

Comunica Tutorial - Basics

Ghent University – imec – IDLab, Belgium

Tutorial Website: http://bit.ly/eswcquery

Comunica Tutorial

Linked Data on the Web is complex

Comunica is many things

Comunica is a meta-query engine created to handle this complexity

Motivation

Triple Pattern Fragments as an alternative RDF interface

TPF has many extensions

Different branches/clients to support these features

Modular system

Experiment data

Modularity using the actor model

Logic is separated into different actors

Each actor independently performs a specific task.

Actors can be combined for solving more complex tasks

Actors are grouped in task-specific buses.

Mediators are responsible for selecting an actor to solve a certain task.

Example: Parse as fast as possible

Modules are wired together through semantic configuration files

Components.js: a semantic dependency injection framework.

Configuration files declare and parameterize actors, mediators and buses.

Links all the building blocks together, without having to do this in the code!

This will be covered more in-depth in the next presentation.

Implementation details

Current features

Query from the Command Line

After installing the @comunica/actor-init-sparql package

Outputs the resulting bindings

comunica-sparql <datasource-url(s)> <query>
      
comunica-sparql http://fragments.dbpedia.org/2015-10/en \
            "SELECT * WHERE { ?s ?p ?o } LIMIT 100"
      
[
  {"?s":"ex:test","?p":"dbpprop:date","?o":"\"Summer 1998\""},
  {"?s":"ex:test","?p":"dbpprop:first","?o":"\"Raymond\""},
  {"?s":"ex:test","?p":"dbpprop:format","?o":"\"DjVu\""},
  ...
      

Set up a SPARQL endpoint

After installing the @comunica/actor-init-sparql package

Provides a functioning SPARQL endpoint

comunica-sparql-http <context>
      
comunica-sparql-http \
    '{ "sources": [{ "type": "auto", "value" : \
        "http://fragments.dbpedia.org/2015/en" }]}'
      

Query through your browser

Running Comunica engine in the browser

http://query.linkeddatafragments.org/

Host custom engines yourself: https://github.com/comunica/jQuery-Widget.js/

Hands-on: querying data using Comunica

Goal: Cover the different ways Comunica can be used to query data

This tutorial will introduce both command-line tools and code-based querying

No advanced JavaScript knowledge required, we start from scratch

Hands-on: requirements

Hands-on: five steps

  1. Querying from the command line: Query existing sources.
  2. Querying from different sources: Create a local source.
  3. Querying from JavaScript applications: Add querying to your application.
  4. Setting up a SPARQL endpoint: Use Comunica as a proxy.
  5. Setting up a Web client: Provide your own interface.