Blog

Reflexive, Symmetric and Transitive Relations in Prolog

When we start doing knowledge representation in Prolog, we start needing to describe the properties of relations so we can infer more than is in our recorded data. Symmetry, reflexivity and transitivity are the three main relationship properties you'll end up using. In this interactive post we take a look at how they can be encoded.

Starting with Knowledge Graphs

Knowledge Graphs are a hot topic, no wonder considering how powerful they can be. However, learning how to create, develop, and use them can be a bit of a minefield. In this post we provide a high-level overview and recommend some learning resources.

Architecture Considerations for Prolog

Software architecture is a tricky subject at the best of times, often mitigated by following a framework. However, when you find yourself in the wilds of Prolog, there’s not much guidance out there, and not many templates to follow. In this post, I’ll provide some guidance built on the principal of substitution.

Rock, Paper, Scissors, Prolog!

Simple, classic games like Rock, Paper, Scissors are good to code when learning a new language. The lovely thing about making this game in Prolog is you’re just encoding what it is, not how it is. It’s a subtle difference, but I’ll point it out during this explanation.

Getting JSON data from an API in SWI-Prolog

Some folks don’t make their data available through RDF formats, or nice SPARQL endpoints, instead they provide a (REST/RESTFUL) API and will return JSON data for your request. It can be a little tricky figuring out how to get this data into your SWI-Prolog program. So in this post I demonstrate with a simple example.

Setting Up Unit Testing In SWI-Prolog

Reading the docs for plunit, it can be quite tricky to figure out how to setup a nice unit testing environment and actually run those tests. In this post I demonstrate how I do it, keeping my tests separate from my code, and running them with a handy command.

All Hail The Mighty Vim

Vim is a cruel learning curve, it’s a long way from modern text editors, and yet it is still a popular choice for programmers. Why?! Because it’s worth it. There are many things Vim does well, many things that I could use to show it off. But for this post, I had to choose only one thing, which is evaluating commands.

Python Generators, yield and send

Another little known Python feature that deserves more love. This time we’re looking at the send function that lets you input values into your generator as it’s running. It works through yield and is awesome!

RDFLib Graph with RDBS

It’s tricky to find out how to set up RDFLib Graph to use a RDBS backend, but it can be done using SQLAlchemy and RDFLib-SQLAlchemy. This means it’ll support all the engines SQLAlchemy does, including MySQL and Postgres. I’ll highlight two gotchas to look out for when using RDFLib-SQLAlchemy and walk you through getting setup using a wrapper class to RDFLIB Graph.