Bismarck Towers
Bismarck has been an important person in the german history. He was one important force that finally united the german territories to one country. Soon after his death some kind of Bismarck cult started to come up. Bismarck towers were erected at many places throughout Germany. I am not so much a fan of Bismarck itself but do like the towers mainly for the possibility to climb on these and have a nice view into the country side.
To see how many towers there are and where these are located, we must get a list of them. A good source would be some travel guide or history book or in this case the Wikipedia. The latter has many pages about landmarks and among these of course also many pages about Bismarck towers.
Wikidata
A lot of pages at the Wikipedia contain an information box at the top right of the page containing the most important information about an entity. This data would be also good for querying and find entities of similar characteristics. This is where the Wikidata project jumps in. The folks behind the Wikidata project developed a toolset to parse the wikipages and collect this abstract information and put it into a database. This database can be queried.
Run a sparql query for Bismarck towers at the endpoint to wikidata:
at: https://query.wikidata.org/
SELECT ?item WHERE {
?item wdt:P31 wd:Q44844 .
SERVICE wikibase:label { bd:serviceParam wikibase:language "de" } .
}
This is a simple query that returns all instances for Q44844 (Bismarck towers). How did I get to the relation and the ominous page? At the main page of www.wikidata.org there is a search field in the right top corner. Just type Bismarck and you will get some results in the drop down list. I clicked at Bismarck tower (tower in Constance). Clicking on that entry will get you to Q866542. What we can see is that this is an instance of what we are looking for. The page contains a list of statements (relations) that it contains and where the item is a subject of. The very first relation is called instance of. Just move the mouse over it and look at the link target. This reveals the property P31 that we are looking for. Next to it there is the page Q44844 named "Bismarck tower". Now we have the information so that we can search for triples with the property P31 and the object Q44844.
Refine the query
The above query returns all instances of Bismarck towers. We need to refine
the query in a way that we select Bismarck towers in Germany only and that we
also select instances that have a geographic location. This should really
limit the results to the wanted towers only and hopefully doesn't include
any other thing.
The search for towers in Germany is done with the statement
"?item wdt:P17 wd:Q183" which reads as "sovereign state of this item is
Germany". Here are the pages of the property and the object (Germany):
To get this information look at a few instances from the previous search and check its relation. The other way would be via the search at the main page again.
We also want the geographic location of the item, done with ?item wdt:P625
?location. The location is also supposed to be contained in the results.
Therefore, we add it to the select statement.
In addition, we want the label of the subject and a description of the subject. The latter is empty by most items while the label is defined for every result. If the label would be empty as well, we would get back the page identifier, something like Q15788796. If you switch the language to english you will see that most of the results will have no english label. That might be because in the english wikipedia there are a few pages for Bismarck towers only while the German wikipedia has a lot more pages for that specific topic (it actually depends on where wikidata retrieved the data from).
The complete query looks like this:
SELECT ?item ?location ?itemLabel ?itemDescription WHERE {
?item wdt:P31 wd:Q44844 .
?item wdt:P17 wd:Q183 .
?item wdt:P625 ?location
SERVICE wikibase:label {
bd:serviceParam wikibase:language "de"
} . # "de" shows the labels in German
}
The next query is almost the same as the previous one, except that it also contains a link to the page in the german wikipedia.
SELECT ?item ?location ?itemLabel ?itemDescription ?article WHERE {
?item wdt:P31 wd:Q44844 .
?item wdt:P17 wd:Q183 .
?item wdt:P625 ?location .
?article schema:about ?item .
?article schema:isPartOf <https://de.wikipedia.org/>.
SERVICE wikibase:label { bd:serviceParam wikibase:language "de" } .
}
The above queries return 106 results (at the time of writing this). These are too few. According to the German Wikipedia there are 146 towers in Germany. To examine the missing instances, a good start would be to have the towers grouped by the german federal states:
SELECT ?item ?itemLabel ?stateLabel WHERE {
?item wdt:P31 wd:Q44844 .
?item wdt:P131 ?place {
?place wdt:P131 ?state {
?state wdt:P31 wd:Q1221156
}
} .
SERVICE wikibase:label { bd:serviceParam wikibase:language "de" . }
}
Even better would be a count by federal state:
SELECT ?stateLabel (COUNT (*) AS ?count) WHERE {
?item wdt:P31 wd:Q44844 .
?item wdt:P131 ?place {
?place wdt:P131 ?state {
?state wdt:P31 wd:Q1221156
}
} .
SERVICE wikibase:label { bd:serviceParam wikibase:language "de" . }
} GROUP BY ?stateLabel
However we already see that there are fewer instances than the above 106 results. This is because only a very few instances of Bismarck towers are located in (P131) some municipality or town which itself located in (P131) a state of Germany (Q1221156). Most instances (such as Q866480 - a tower near Apolda) have no further statements as the obvious ones like the coordinate location (P625) and the country (P17). So this doesn't get us any closer.
DBpedia
Here we do the same with another endpoint at DBpedia:
SELECT ?tower WHERE {
?tower <http://purl.org/dc/terms/subject> <http://dbpedia.org/resource/Category:Bismarck_towers>
}
SELECT ?tower, ?loc WHERE {
?tower <http://purl.org/dc/terms/subject> <http://dbpedia.org/resource/Category:Bismarck_towers> .
?tower <http://www.georss.org/georss/point> ?loc
}
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
SELECT ?tower WHERE {
?tower rdf:type <http://dbpedia.org/class/yago/WikicatBismarckMonuments>
}
The queries look quite more readable than the pendants from Wikidata. However, since DBpedia is extracting the data from the English Wikipedia the results are a few only because the English Wikipedia lacks information that is contained in the German Wikipedia about Bismarck towers. In general the problem will not be so evident since the English Wikipedia is the most comprehensive version than any other Wikipedia in another language. However, if you are interested in a certain regional or language specific topic the English Wikipedia might have has less information about it and maybe even missing pages for that topic. Then you end up with fewer results than if the query would go to the Wikipedia that contains this information, like in the example above.
Conclution
If you need a complete list of al towers, querying Wikidata or DBPedia is a great way to get to data. However the data needs to be checked carefully and maybe enriched manually by looking up other resources that may not be queried automatically.
DBPedia vs. Wikidata
Other people have already put effort in checking out the differences of Wikidata and DBpedia. So I will not do this here instead name two links with further information: