GOV/SPARQL: Unterschied zwischen den Versionen

aus wiki, dem genealogischen Lexikon zum Mitmachen.
Zur Navigation springen Zur Suche springen
Zeile 1: Zeile 1:
= GOV =
== KirchenkreiseNordkirche ==
<source lang='bash'>
scripts/govquery KirchenkreiseNordkirche "limit=20" -f mediawiki
</source>
=== query ===
<source lang='sparql'>                                                                                                              SELECT DISTINCT ?kk ?name ?qid                                                                                                      WHERE {                                                                                                                                ?kk gp:hasType/gp:type gt:27 .                                                                                                      ?kk gp:hasName/gp:value ?name .
  ?kk (gp:isPartOf/gp:ref)* gov:object_398036 .
  OPTIONAL {
    ?kk owl:sameAs ?qid .
    FILTER(STRSTARTS(STR(?qid),"http://www.wikidata.org/wiki/"))
  }
}
ORDER BY ?name
LIMIT 20
</source>
[https://gov-sparql.genealogy.net/?query=SELECT%20DISTINCT%20%3Fkk%20%3Fname%20%3Fqid%0AWHERE%20%7B%0A%20%20%3Fkk%20gp%3AhasType/gp%3Atype%20gt%3A27%20.%0A%20%20%3Fkk%20gp%3AhasName/gp%3Avalue%20%3Fname%20.%0A%20%20%3Fkk%20%28gp%3AisPartOf/gp%3Aref%29%2A%20gov%3Aobject_398036%20.%0A%0A%20%20OPTIONAL%20%7B%0A%20%20%20%20%3Fkk%20owl%3AsameAs%20%3Fqid%20.%0A%20%20%20%20FILTER%28STRSTARTS%28STR%28%3Fqid%29%2C%22http%3A//www.wikidata.org/wiki/%22%29%29%0A%20%20%7D%0A%7D%0AORDER%20BY%20%3Fname%0ALIMIT%2020%0A try it!]
=== result ===                                                                                                                      {| class="wikitable" style="text-align: left;"
|+ <!-- caption -->
|-
! kk                                      !! name                    !! qid
wf@z:~/source/python/genwiki2024$ scripts/govquery KirchenkreiseNordkirche "limit=20" -f mediawiki
== KirchenkreiseNordkirche ==
=== query ===
<source lang='sparql'>
SELECT DISTINCT ?kk ?name ?qid
WHERE {
  ?kk gp:hasType/gp:type gt:27 .
  ?kk gp:hasName/gp:value ?name .
  ?kk (gp:isPartOf/gp:ref)* gov:object_398036 .
  OPTIONAL {
    ?kk owl:sameAs ?qid .
    FILTER(STRSTARTS(STR(?qid),"http://www.wikidata.org/wiki/"))
  }
}
ORDER BY ?name
LIMIT 20
</source>
[https://gov-sparql.genealogy.net/?query=SELECT%20DISTINCT%20%3Fkk%20%3Fname%20%3Fqid%0AWHERE%20%7B%0A%20%20%3Fkk%20gp%3AhasType/gp%3Atype%20gt%3A27%20.%0A%20%20%3Fkk%20gp%3AhasName/gp%3Avalue%20%3Fname%20.%0A%20%20%3Fkk%20%28gp%3AisPartOf/gp%3Aref%29%2A%20gov%3Aobject_398036%20.%0A%0A%20%20OPTIONAL%20%7B%0A%20%20%20%20%3Fkk%20owl%3AsameAs%20%3Fqid%20.%0A%20%20%20%20FILTER%28STRSTARTS%28STR%28%3Fqid%29%2C%22http%3A//www.wikidata.org/wiki/%22%29%29%0A%20%20%7D%0A%7D%0AORDER%20BY%20%3Fname%0ALIMIT%2020%0A try it!]
=== result ===
{| class="wikitable" style="text-align: left;"
|+ <!-- caption -->
|-
! kk                                      !! name                    !! qid
|-
| http://gov.genealogy.net/object_398074  || Altholstein              ||
wf@z:~/source/python/genwiki2024$ scripts/govquery KirchenkreiseNordkirche "limit=20" -f mediawiki > /tmp/kk.wiki
wf@z:~/source/python/genwiki2024$ cat /tmp/kk.wiki
== KirchenkreiseNordkirche ==
=== query ===
<source lang='sparql'>
SELECT DISTINCT ?kk ?name ?qid
WHERE {
  ?kk gp:hasType/gp:type gt:27 .
  ?kk gp:hasName/gp:value ?name .
  ?kk (gp:isPartOf/gp:ref)* gov:object_398036 .
  OPTIONAL {
    ?kk owl:sameAs ?qid .
    FILTER(STRSTARTS(STR(?qid),"http://www.wikidata.org/wiki/"))
  }
}
ORDER BY ?name
LIMIT 20
</source>
[https://gov-sparql.genealogy.net/?query=SELECT%20DISTINCT%20%3Fkk%20%3Fname%20%3Fqid%0AWHERE%20%7B%0A%20%20%3Fkk%20gp%3AhasType/gp%3Atype%20gt%3A27%20.%0A%20%20%3Fkk%20gp%3AhasName/gp%3Avalue%20%3Fname%20.%0A%20%20%3Fkk%20%28gp%3AisPartOf/gp%3Aref%29%2A%20gov%3Aobject_398036%20.%0A%0A%20%20OPTIONAL%20%7B%0A%20%20%20%20%3Fkk%20owl%3AsameAs%20%3Fqid%20.%0A%20%20%20%20FILTER%28STRSTARTS%28STR%28%3Fqid%29%2C%22http%3A//www.wikidata.org/wiki/%22%29%29%0A%20%20%7D%0A%7D%0AORDER%20BY%20%3Fname%0ALIMIT%2020%0A try it!]
=== result ===
{| class="wikitable" style="text-align: left;"
|+ <!-- caption -->
|-
! kk                                      !! name                    !! qid
|-
| http://gov.genealogy.net/object_398074  || Altholstein              ||
|-
| http://gov.genealogy.net/object_398072  || Dithmarschen            ||
|-
| http://gov.genealogy.net/object_398078  || Hamburg-Ost              ||
|-
| http://gov.genealogy.net/object_398079  || Hamburg-West/Südholstein ||
|-
| http://gov.genealogy.net/object_398080  || Lübeck-Lauenburg        ||
|-
| http://gov.genealogy.net/object_398060  || Mecklenburg              ||
|-
| http://gov.genealogy.net/object_1085568 || Nordfriesland            || http://www.wikidata.org/wiki/Q114353690
|-
| http://gov.genealogy.net/object_397368  || Ostholstein              ||
|-
| http://gov.genealogy.net/object_398076  || Plön-Segeberg            ||
|-
| http://gov.genealogy.net/object_398061  || Pommern                  ||
|-
| http://gov.genealogy.net/object_398075  || Rantzau-Münsterdorf      ||
|-
| http://gov.genealogy.net/object_398073  || Rendsburg-Eckernförde    ||
|-
| http://gov.genealogy.net/object_398071  || Schleswig-Flensburg      ||
|}
= Wikidata =
= Wikidata =
Das Property [https://www.wikidata.org/wiki/Property:P2503 P2503 GOV-Kennung] dient zur Verknüpfung von Wikidata Einträgen
Das Property [https://www.wikidata.org/wiki/Property:P2503 P2503 GOV-Kennung] dient zur Verknüpfung von Wikidata Einträgen

Version vom 25. Mai 2025, 13:54 Uhr

GOV

KirchenkreiseNordkirche

scripts/govquery KirchenkreiseNordkirche "limit=20" -f mediawiki

query

                                                                                                               SELECT DISTINCT ?kk ?name ?qid                                                                                                       WHERE {                                                                                                                                ?kk gp:hasType/gp:type gt:27 .                                                                                                       ?kk gp:hasName/gp:value ?name .
  ?kk (gp:isPartOf/gp:ref)* gov:object_398036 .

  OPTIONAL {
    ?kk owl:sameAs ?qid .
    FILTER(STRSTARTS(STR(?qid),"http://www.wikidata.org/wiki/"))
  }
}
ORDER BY ?name
LIMIT 20

try it! === result === {| class="wikitable" style="text-align: left;" |+ |- ! kk  !! name  !! qid wf@z:~/source/python/genwiki2024$ scripts/govquery KirchenkreiseNordkirche "limit=20" -f mediawiki

KirchenkreiseNordkirche

query

SELECT DISTINCT ?kk ?name ?qid
WHERE {
  ?kk gp:hasType/gp:type gt:27 .
  ?kk gp:hasName/gp:value ?name .
  ?kk (gp:isPartOf/gp:ref)* gov:object_398036 .

  OPTIONAL {
    ?kk owl:sameAs ?qid .
    FILTER(STRSTARTS(STR(?qid),"http://www.wikidata.org/wiki/"))
  }
}
ORDER BY ?name
LIMIT 20

try it!

result

kk name qid
http://gov.genealogy.net/object_398074 Altholstein

wf@z:~/source/python/genwiki2024$ scripts/govquery KirchenkreiseNordkirche "limit=20" -f mediawiki > /tmp/kk.wiki wf@z:~/source/python/genwiki2024$ cat /tmp/kk.wiki

KirchenkreiseNordkirche

query

SELECT DISTINCT ?kk ?name ?qid
WHERE {
  ?kk gp:hasType/gp:type gt:27 .
  ?kk gp:hasName/gp:value ?name .
  ?kk (gp:isPartOf/gp:ref)* gov:object_398036 .

  OPTIONAL {
    ?kk owl:sameAs ?qid .
    FILTER(STRSTARTS(STR(?qid),"http://www.wikidata.org/wiki/"))
  }
}
ORDER BY ?name
LIMIT 20

try it!

result

kk name qid
http://gov.genealogy.net/object_398074 Altholstein
http://gov.genealogy.net/object_398072 Dithmarschen
http://gov.genealogy.net/object_398078 Hamburg-Ost
http://gov.genealogy.net/object_398079 Hamburg-West/Südholstein
http://gov.genealogy.net/object_398080 Lübeck-Lauenburg
http://gov.genealogy.net/object_398060 Mecklenburg
http://gov.genealogy.net/object_1085568 Nordfriesland http://www.wikidata.org/wiki/Q114353690
http://gov.genealogy.net/object_397368 Ostholstein
http://gov.genealogy.net/object_398076 Plön-Segeberg
http://gov.genealogy.net/object_398061 Pommern
http://gov.genealogy.net/object_398075 Rantzau-Münsterdorf
http://gov.genealogy.net/object_398073 Rendsburg-Eckernförde
http://gov.genealogy.net/object_398071 Schleswig-Flensburg

Wikidata

Das Property P2503 GOV-Kennung dient zur Verknüpfung von Wikidata Einträgen mit GOV Objekten

GOVOrte

scripts/wdquery GOVOrte "lang=de,limit=10" -f mediawiki

query

SELECT ?kreis ?kreisLabel ?gemeinde ?gemeindeLabel ?typ ?typLabel ?city ?cityLabel ?govid
WHERE {
  ?city wdt:P2503 ?govid ;
        wdt:P131 ?gemeinde ;
        wdt:P31 ?typ .
  ?gemeinde wdt:P131 ?kreis .

  OPTIONAL { ?city rdfs:label ?cityLabel . FILTER(LANG(?cityLabel) = "de") }
  OPTIONAL { ?gemeinde rdfs:label ?gemeindeLabel . FILTER(LANG(?gemeindeLabel) = "de") }
  OPTIONAL { ?kreis rdfs:label ?kreisLabel . FILTER(LANG(?kreisLabel) = "de") }
  OPTIONAL { ?typ rdfs:label ?typLabel . FILTER(LANG(?typLabel) = "de") }
}
ORDER BY ?kreisLabel ?gemeindeLabel ?cityLabel
LIMIT 10

try it!

result

kreis gemeinde typ typLabel city govid
http://www.wikidata.org/entity/Q21844324 http://www.wikidata.org/entity/Q11700054 http://www.wikidata.org/entity/Q123705 Ortsteil http://www.wikidata.org/entity/Q4981889 NOWDNOKO02MH
http://www.wikidata.org/entity/Q7595612 http://www.wikidata.org/entity/Q63530719 http://www.wikidata.org/entity/Q188509 Stadtteil http://www.wikidata.org/entity/Q649969 ULLLLAQF54FP
http://www.wikidata.org/entity/Q21844324 http://www.wikidata.org/entity/Q11700054 http://www.wikidata.org/entity/Q106935957 http://www.wikidata.org/entity/Q4981889 NOWDNOKO02MH
http://www.wikidata.org/entity/Q2473698 http://www.wikidata.org/entity/Q21636040 http://www.wikidata.org/entity/Q3558970 Dorf in Polen http://www.wikidata.org/entity/Q784921 DOKUDWKO11OW
http://www.wikidata.org/entity/Q2371767 http://www.wikidata.org/entity/Q21843562 http://www.wikidata.org/entity/Q3558970 Dorf in Polen http://www.wikidata.org/entity/Q7686471 TARRNWKO11PH
http://www.wikidata.org/entity/Q2371767 http://www.wikidata.org/entity/Q21843562 http://www.wikidata.org/entity/Q3558970 Dorf in Polen http://www.wikidata.org/entity/Q5950089 HUSNNEKO11WD
http://www.wikidata.org/entity/Q2371767 http://www.wikidata.org/entity/Q21843562 http://www.wikidata.org/entity/Q3558970 Dorf in Polen http://www.wikidata.org/entity/Q6438718 KROOSZKO11QF
http://www.wikidata.org/entity/Q21777323 http://www.wikidata.org/entity/Q61746288 http://www.wikidata.org/entity/Q3558970 Dorf in Polen http://www.wikidata.org/entity/Q5743044 NIEEKIKO12NO
http://www.wikidata.org/entity/Q20859217 http://www.wikidata.org/entity/Q9273753 http://www.wikidata.org/entity/Q3558970 Dorf in Polen http://www.wikidata.org/entity/Q3692447 GRAIECKO12MS
http://www.wikidata.org/entity/Q880888 http://www.wikidata.org/entity/Q81727403 http://www.wikidata.org/entity/Q3558970 Dorf in Polen http://www.wikidata.org/entity/Q5618459 OSINKAKO12SU