Auto generated action files for all portals from Wikidata
Opened this issue · 3 comments
stefangrotz commented
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:
- Data import using Wikidata - adapt the existing query to filter for CKAN portals
- Improve Wikidata and spread the knowledge that adding your portal to wikidata is important
- Test the max number of possible Actions
stefangrotz commented
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)
stefangrotz commented
I updated the action creation script to use a JSON from wikidata.
Edit: latest update also directly queries wikidata.
TODO:
- different api descriptions for V2 and V3 portals
- Improve certain functions, e.g. search doesn't work right now
- test all portals and add them to the GPT
- Doku in the readme
stefangrotz commented
There is now a GitHub action to create all V3 portals: https://github.com/stefangrotz/OpenDataGermanyGPT/actions