Daten nachnutzen
How to fetch the data in this wiki by machine — query service, interface, addresses, examples.
The data in this wiki is released under CC0 1.0 and may be reused without condition; details and image rights are on the page Copyright and licence. This page says how to get at the data.
The shortest way: the query console
query.spielkarten.wiki opens a console where you can type a query in SPARQL and run it immediately — no login, no key. If you don't know SPARQL yet: the examples below run as soon as you paste them in.
For programs, the same service is at
https://query.spielkarten.wiki/sparql. It accepts GET and
POST with the parameter query and answers in JSON, XML, CSV or
TSV, depending on the Accept header.
The addresses, and a trap
| What | Address |
|---|---|
| Wiki | https://spielkarten.wiki
|
| An entry | https://spielkarten.wiki/entity/Q1900
|
| Query service | https://query.spielkarten.wiki/sparql
|
| Query console | https://query.spielkarten.wiki/
|
| MediaWiki/Wikibase interface | https://spielkarten.wiki/w/api.php
|
Watch the prefixes. Unlike Wikidata, our RDF prefixes are named after our own address. A query using Wikidata's prefixes runs here without an error and returns zero results — it looks as if it worked cleanly. These six lines therefore belong before every query:
PREFIX wd: <https://spielkarten.wiki/entity/> PREFIX wdt: <https://spielkarten.wiki/prop/direct/> PREFIX p: <https://spielkarten.wiki/prop/> PREFIX ps: <https://spielkarten.wiki/prop/statement/> PREFIX pq: <https://spielkarten.wiki/prop/qualifier/> PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
The query console already has them set.
Third-party identifiers: what they become in RDF
Many entries carry an identifier from an external directory — a Wikidata number, a GND number, a DOI. In the wiki you see it as a clickable link. In the RDF it appears twice: once as a plain string and once as a full, resolvable address. The second form is what connects our data to external datasets.
| Identifier | Property | Address in RDF |
|---|---|---|
| Wikidata | P38 |
http://www.wikidata.org/entity/…
|
| GOV (CompGen) | P39 |
http://gov.genealogy.net/…
|
| GeoNames | P40 |
https://sws.geonames.org/…/
|
| GND (German National Library) | P84 |
https://d-nb.info/gnd/…
|
| ISSN | P86 |
https://portal.issn.org/resource/ISSN/…
|
| DOI | P87 |
https://doi.org/…
|
The string is under the prefix wdt:, the address under wdtn:
(the same with ps: and psn: at the statement node). You can
check this on the RDF of a single entry:
https://spielkarten.wiki/wiki/Spezial:Objektdaten/Q3996.ttl wdt:P84 "1030800-3" ; wdtn:P84 <https://d-nb.info/gnd/1030800-3> ;
ISBN (P85) is missing from this table, deliberately. There is no
neutral, permanent resolver for an ISBN — the usual candidates are booksellers, and we
do not want to link there. The ISBN therefore appears only as a string.
Not yet in the query service. These addresses are in the RDF of every entry from
now on. They will move into the query service's index only with the next full rebuild;
until then you find them via Spezial:Objektdaten, not via wdtn:
in SPARQL.
How the data model is built
Every object is an entry with a Q-number, and every statement about it uses a
property with a P-number. An entry's class is given by the property
ist ein (P3, "is a"):
| Class | Number | What it holds |
|---|---|---|
| Pack | Q1 |
a pack of playing cards as an object |
| Person | Q3 |
a card maker, engraver, publisher |
| Firm | Q4 |
a card factory or company |
| Tax system | Q6 |
a stamp duty regime |
| Tax stamp | Q8 |
a single stamp |
| Place | Q15 |
a place |
| Source | Q16 |
a book, an article, a catalogue |
| Collection | Q1388 |
a museum or a private collection |
The most important links between classes:
| Property | Number | From → to |
|---|---|---|
Hersteller (maker) |
P6 | Pack → Person/Firm |
tätig in (active in) |
P13 | Person/Firm → Place, with a time span as a qualifier |
trägt Stempel (bears stamp) |
P9 | Pack → Tax stamp |
Teil von (part of) |
P5 | Tax stamp → Tax system |
ist beschrieben in (is described in) |
P78 | anything → Source, with catalogue number and page |
befindet sich in Sammlung (held in collection) |
P80 | Pack → Collection, with inventory number |
historisch Teil von (historically part of) |
P60 | Place → historical region → country |
liegt heute in (today lies in) |
P68 | Place → present-day region → present-day state |
The full list is on the page Terminology and data model.
Four queries to get started
All four run unchanged in the query console.
Packs with their year of publication
SELECT ?spiel ?name ?jahr WHERE {
?spiel wdt:P3 wd:Q1 ; rdfs:label ?name ; wdt:P24 ?jahr .
FILTER(LANG(?name) = "de")
}
LIMIT 50
All makers active in Prague (Q988)
SELECT ?person ?name WHERE {
?person wdt:P13 wd:Q988 ; rdfs:label ?name .
FILTER(LANG(?name) = "de")
}
Packs in a collection, with inventory number — here the Kranich Collection (Q8305)
SELECT ?spiel ?name ?inventarnummer WHERE {
?spiel p:P80 ?aussage .
?aussage ps:P80 wd:Q8305 .
OPTIONAL { ?aussage pq:P82 ?inventarnummer }
?spiel rdfs:label ?name .
FILTER(LANG(?name) = "de")
}
Tax stamps with their period of validity
SELECT ?stempel ?name ?von ?bis WHERE {
?stempel wdt:P3 wd:Q8 ; rdfs:label ?name .
OPTIONAL { ?stempel wdt:P25 ?von }
OPTIONAL { ?stempel wdt:P26 ?bis }
FILTER(LANG(?name) = "de")
}
A note on wdt: versus p:. wdt: only returns
the currently valid statements. p: goes via the statement node and also
returns statements we have explicitly marked as deprecated — for instance an
attribution to a maker that research has since disproved. If you need p: for
the qualifiers, check the rank as well.
Federated queries against Wikidata
The query service can federate with Wikidata. This lets you connect our entries to the data there via their authority-control anchors:
SELECT ?ding ?wikidataLabel WHERE {
?ding wdt:P38 ?wdId .
BIND(IRI(CONCAT("http://www.wikidata.org/entity/", ?wdId)) AS ?wd)
SERVICE <https://query.wikidata.org/sparql> {
?wd rdfs:label ?wikidataLabel . FILTER(LANG(?wikidataLabel) = "en")
}
}
LIMIT 20
The wiki's own interface
Besides the query service, the ordinary MediaWiki/Wikibase interface is available at
https://spielkarten.wiki/w/api.php. You can fetch a single entry like this:
https://spielkarten.wiki/w/api.php?action=wbgetentities&ids=Q1900&format=json
For RDF, the entry's own address is enough; it points on to the machine-readable version.
Please query fairly
The service runs on a single machine paid for by a volunteer association. The front-end proxy throttles requests. If you need larger amounts of data:
- Ask in large queries rather than many small ones.
- Put a recognisable identifier in the
User-Agentheader, ideally with a
contact address — then we can get in touch instead of blocking you.
- If you want the whole dataset, use the dump instead of the query service. See the
next section — one file instead of ten thousand requests.
The whole dataset as one file
At spielkarten.wiki/abzug lies the complete dataset as compressed Turtle. A scheduled job rewrites it every night; the last four versions are kept.
| What | Address |
|---|---|
| always the newest | https://spielkarten.wiki/abzug/spielkarten-wiki-neuester.ttl.gz
|
| a given day | https://spielkarten.wiki/abzug/spielkarten-wiki-JJJJ-MM-TT.ttl.gz
|
| overview with sizes and dates | https://spielkarten.wiki/abzug/
|
The dump contains every entry and property in the same form that
Spezial:Objektdaten outputs — with our prefixes (see above) and the
resolvable addresses of external identifiers. It is therefore also the convenient way to
load our data into your own query service.
Consider this an explicit invitation: load the dump instead of hammering the query service. If something is missing for you, write to us at info@talon.cc.
Linking to us
An entry's address, built from its Q-number, is stable and may be cited — see the section on addresses on the page Copyright and licence. If you anchor our entries in your own database, we would be glad to hear from you at info@talon.cc; then we can link back to you in return.