Announcement: sparqlprog, a pack for federated logic programming over SPARQL endpoints

Hi all,

I would like to announce something I have been working on for a while, a way of executing logic program queries over a SPARQL endoint. This is similar to Samer Abdallah’s sparkle, but extends on it a number of ways.

You can get it from:

The basic idea is that you can write logic programs, and so long as you stay within a specified subset (essentially datalog) and leverage the use of the semweb rdf/3 and related predicates, then you can make normal prolog queries that are compiled down to SPARQL and executed remotely.

For example, we can write:

has_shared_band_member(B1,B2,A) :-
      rdf(A,dbo:associatedBand,B1),
      rdf(A,dbo:associatedBand,B2),
      B1\=B2.

And ask has_shared_band_member(dbr:Deep_Purple, OtherBand, SharedMember)

It’s also possible freely mix execution within the prolog engine and remote execution on the SPARQL server in a way that avoids the impedance mismatches of an imperative language.

I want to credit Sam Neaves for the ideas here, nicely described in Reactome Pengine: a web-logic API to the Homo sapiens reactome

And because Prolog is sometimes a hard sell, there is a Python wrapper, plus some example Jupyter notebooks: sparqlprog-python. (A sparqlprog service can easily be run via Docker, communication is via Pengines).

I’m going to be working on this as part of a Biohackathon in Japan the first week of September. There is a not currently very active sparqlprog gitter room which I promise to monitor during this week, if others want to join me remotely! (Will Byrd of “The Reasoned Schemer” and miniKanren fame will also be at the hackathon).


Chris Mungall, PhD
Department Head, Molecular Ecosystems Biology, Lawrence Berkeley National Laboratory
717 Potter Street,
Berkeley, CA 94710


(510) 486 4170

5 Likes