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.
THE WEBSITE has changed! Once upon a time this was a dynamically generated website, now it's all static pages. Why would I, an experienced web developer, shun the trends and make a website using technology that I've heard likened to coming from the age of the dinosaurs? Let's find out.
FOR SOME strange reason developers seem surprised when I tell them I love using Prolog for web development. I understand it's not a popular choice, but it is a suitable one. In this post I explain why I think Prolog is great for web development, and introduce Simple Web, which I developed to lower the barrier to entry.
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.
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.
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.
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.
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.
THERE WAS a time, long ago, before SVMs and Neural Nets, when AI was all rule based. Nowadays, with the prevalence of "curve-fitting" AI, these techniques are known as GOFAI, or "Good Old Fashioned Artificial Intelligence". In this post we look at a super simple example and consider why you'd use this instead of a more modern method.
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!
A KEY idiom in Prolog is the idea that it runs both forwards and backwards. If you've never programmed in Prolog before, this can be mind-blowing! You can write one "function" and get many different uses out of it. In this post we'll take a look at what this means as a teaser that might tempt you into giving Prolog a go.
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.
USE THE internet as a database. Across the internet, some generous providers make their data available not only as RDF/OWL, but via a SPARQL endpoint that you can send queries to. It's like an API, but instead of getting a response with all the data the developer thought you might like, you get the results of the query you want. It's even possible to query across multiple endpoints in a single query. SPARQL is similar enough to SQL to be easy to learn. In this post, we start out looking at SELECT queries against DBpedia.
MANY OF the unusual symbols we use when writing Description Logics are sadly not found on the keyboard. I wrote myself a little cheat sheet to remind myself of the correct unicode or LaTeX for the common symbols and added a short description of each symbol as well. It's very useful to print out and keep near your keyboard so you can type Description Logics quickly and painlessly.
PYWEEK CHALLENGE 25: Two Worlds, Complete. My entry is submitted, it works, now my real work begins. I intended to create a game similar to the original Rogue, but divided into normal and magical realms. I feel I have achieved this. Now it's time to make it better.
DAY 5 of the PyWeek TwoWorlds challenge, and we have a game. It's not perfect, but it is complete. I still have lots to do, and I'll keep working on it before the challenge ends, but it is in a state where it could be submitted. We have monsters, traps, scrolls, potions, wands, weapons, armour, normal levels, magic levels, and the Amulet of Yendor!
DAY 4 of PyWeek. If it looks like a game, and plays like a game, it's a game! Rogue: Through The Veil is starting to look and play like a game now. It's got monsters, combat, potions, scrolls, weapons and armour. Plus we can now go "through the veil" and pass between magic and normal worlds.
DAY 3 of the PyWeek 25, Two Worlds challenge, and progress is being made. Today we've got more monsters, weapons, armour, scrolls, menus and an improved melee combat system. Lots done, some incomplete and lots still to do. Feeling rushed, worrying about code getting messy.
DAY 2 of the PyWeek Challenge. Combat and creativity was harder than anticipated, but we've got monster generation, they move and melee combat is implemented. Plus there's a nicer GUI with basic HUD. We can also go down the dungeon through the normal world, and to make testing easy, you can never die!
BEGINNING A PyWeek25 entry. The theme is "Two Worlds" and I'm loving Rogue at the moment, so I decided to make a roguelike with a distinction between normal dungeons and magic dungeons. On day 1 I've made a dungeon generator and can explore it with a player. Making use of the tcod Python library.
GOOGLE MAKES extensive use of Semantic Web technologies, although they prefer the term Knowledge Graph. In this post I'll show you how to add structured data to a Flask Blog app, with JSON-LD and Jinja2 templates to help Google understand your content, which in turn should improve SEO.
TWITTER USE the Semantic Web. More specifically they use RDFa markup to define Twitter Cards, which they use to make your website look good when someone tweets it. In this post I'll show you how to include this in a Flask blog application with a Jinja2 template.
FACEBOOK USE the Semantic Web. They have an ontology called "Open Graph" that links your webpage into their social graph. This means when someone shares your webpage on Facebook, it'll look how you've specified. In this post I'll show you how to include this in a Flask blog application with a Jinja2 template.
AN INTRODUCTION to programming the Semantic Web using Python and Flask. We'll make an RDF file to describe ourselves, serve it via Flask, use data from it in a template, encode it into our HTML, and link to it from our HTML.
PYTHON HAS support for lambda functions, Haskell is built upon lambda calculus. The two are not the same and this is the reason why lambda should have been removed in Python3. This post examines the differences, reviews the use in Python, and offers a more pythonic, honest syntax.
IN THE age of the internet with a plethora of mud-bloods revealing the secrets of magic to all and sundry, you must do magic that no-one else knows. I'll tell you how to make your magic 'Google proof'.
OF ALL the functional programming inspired features in Python, partial application must be the best kept secret that you really need to know. Partial application lets you create highly abstract functions and make them more specific for use, pass a function arguments without calling it yet, and so much more.
PEOPLE ALWAYS ask how I learnt magic. Well, I started with one of the best magic books ever written and one that is commonly recommended to beginners, called "Modern Coin Magic" by J.B.Bobo. It's an excellent resource for those wishing to learn sleight-of-hand. There's a few routines in particular that are worth studying.
MAKE USE of functional programming techniques to improve your iteration in Python. By abstracting the function from the iteration you'll have greater code reuse, easier parallelisation, and lower memory usage.