Skip to content

Instantly share code, notes, and snippets.

View rubensworks's full-sized avatar
💭
🚀Power-coding

Ruben Taelman rubensworks

💭
🚀Power-coding
View GitHub Profile

We require three new handles:

  • InsertHandler: binds to add.
  • DeleteHandler: binds to delete.
  • UpdateHandler (optional): binds to set and replace.

Getting random values

await user.friends.friends.random // returns a random friend
interface Queryable<SourceType> {
query(query: string, context?: QueryStringContext<SourceType>): Promise<QueryResult>
}
interface QueryableAlgebra<SourceType> {
query(query: Algebra, context?: QueryAlgebraContext<SourceType>): Promise<QueryResult>
}
// TODO: what about update queries?

This document describes the steps to use a prerelease of Comunica 2.x.

Intended release date: Somewhere in the week of Monday 28 February

Warnings:

  • This is major update with breaking changes, which means that old invocations of Comunica will have to be changed slightly.
  • The READMEs and documentation on comunica.dev have not been updated yet, so you will have to discover the usage of the new API via autocompletion of an IDE with TypeScript support.
  • The Comunica prereleases depend on the new RDF/JS typings (@rdfjs/types@1.1.0).

Getting started:

This is a short guide that explains how you can execute a federated query with Comunica.

Command line

We will execute a query to find all books in the Harvard Library that were written by people who were born in Ghent. We do this by federating over DBpedia (SPARQL), the Harvard library (TPF) and the VIAF dataset (TPF).

  1. Make sure Node.js (>=8.0.0) is installed: https://nodejs.org/en/
  2. Install Comunica: npm install -g @comunica/actor-init-sparql
  3. Execute the following command:

GraphQL-LD

GraphQL-LD is a way to query Linked Data using GraphQL.

Instead of querying GraphQL interfaces, Linked Data interfaces are queried, such as SPARQL endpoints, TPF interfaces, Linked Data documents, ... This is done by semantifying GraphQL queries using a JSON-LD context.

Try it out from your browser: http://query.linkeddatafragments.org/

Alternatively, install GraphQL-LD or Comunica SPARQL and execute GraphQL-LD queries on your machine