Open stefangrotz opened 8 months ago
Here is a query for all CKAN portals in the DACH region:
SELECT ?portal ?portalLabel ?countryLabel ?hasApiEndpoint ?website ("CKAN" AS ?protocol) # Adding CKAN as a static value for protocol
WHERE {
?portal wdt:P31 wd:Q27031827; # Searching for instances of Open Data Portals
wdt:P17 ?country. # Restricting to a country, variable ?country
VALUES ?country { wd:Q183 wd:Q40 wd:Q39 } # Germany (Q183), Austria (Q40), Switzerland (Q39)
OPTIONAL { ?portal wdt:P6269 ?hasApiEndpoint } # Searching for API Endpoint properties (if available)
OPTIONAL { ?portal wdt:P6269 ?apiEndpoint. # Searching for API Endpoint properties (if available)
?apiEndpoint wdt:P2700 wd:Q105592698; # Ensuring the API uses the CKAN protocol
BIND(CONCAT(STR(?apiEndpoint)) AS ?hasApiEndpoint) }
OPTIONAL { ?portal wdt:P856 ?website } # Searching for the official website (if available)
SERVICE wikibase:label { bd:serviceParam wikibase:language "en".
?portal rdfs:label ?portalLabel .
?country rdfs:label ?countryLabel . }
}
ORDER BY DESC(?hasApiEndpoint)
I updated the action creation script to use a JSON from wikidata.
Edit: latest update also directly queries wikidata.
TODO:
There is now a GitHub action to create all V3 portals: https://github.com/stefangrotz/OpenDataGermanyGPT/actions
If we want to support all available CKAN APIs in the DACH region, generating the API files automatically makes sense.
First concept: https://github.com/stefangrotz/OpenDataGermanyGPT/blob/main/actions/create-api-files.py
Todo: