Comment

Comment by kroltan

Wikidata, SPARQL, and RDF in general. And I guess semi-relatedly things like Prolog? I recently decided to fiddle with Wikidata, and it is fascinating to be able to query for any part of a statement, not just the value!

In SPARQL you write statements in the form

    <thing> <relation> <thing>
But the cool part is that any of those three parts can be extracted, so you can ask things like "what are the cities in <country>", or "what country harbors the city <city>", but most importantly, "how does <city> relate to <country>".

For example, if you wanted to find out all the historical monuments in state capitals of a country (using my home country as an example, also pseudocode for your time's sake):

    fetch ?monumentName, ?cityName given
    ?monument "is called" ?monumentName.
    ?monument "is located within" ?city.
    ?city "is capital of" ?state.
    ?city "is called" ?cityName.
    ?city "is located within" "Brazil".
parent kroltan 5 years ago

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton