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
http://berkeleybop.org/
(510) 486 4170

5 Likes

This looks amazing! Thank you so much for sharing it. Last night I was just wondering about how I was going to introduce SPARQL queries to a new project, good timing!

1 Like

I think this pack is for Linux? Installation is requiring MinGW and/or MSYS on a Windows 10 … so I’ll try this in Linux.

I develop on a Mac, and it’s also tested on linux via the swipl 8.0.3 docker container, I’m afraid I don’t have any way of testing on Windows, and I don’t really know what exactly happens with pack_install on Windows, sorry.