Open JonasKress opened 6 years ago
Hi @JonasKress - this is definitely do-able. Does that SPARQL query actually work in Palladio at present?
Would you have any interest in sending a pull request? The change would be here: https://github.com/humanitiesplusdesign/palladio-app/blob/master/js/controllers.js#L176 You would need to test for the sparql
query parameters just like file
is tested for above, and then turn that into JSON that can be loaded as in the loadFile
function.
If you are not interested or able to do a pull request, that's totally fine. I'll get to it soon as I think we have a similar need in another project as well.
Hi @esjewett, thanks for you reply! The query would look like this:
I am sorry I will not have time to work on this in the near future.
Thanks! Jonas
Cool, just so that I have it handy, that's a query to https://query.wikidata.org/sparql
#Cats
SELECT ?item ?itemLabel
WHERE {
?item wdt:P31 wd:Q146.
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}
It must be noted that that isn't a very good query for Palladio. A better one would be e.g.
#Locations of archaelogical sites with their types, with coordinates formatted for Palladio
SELECT ?subj ?type ?typeLabel ?label (REPLACE(STR(?coord),"Point\\((.*) (.*)\\)","$2,$1") AS ?coordinates)
WHERE
{
?type wdt:P279* wd:Q839954 ;
rdfs:label ?typeLabel filter (lang(?typeLabel) = "en") .
?subj wdt:P31 ?type ;
wdt:P625 ?coord ;
rdfs:label ?label filter (lang(?label) = "en")
}
which has both coordinate information as well as the types for faceting. Ideally, it would be great also to be able to define the view ands and facets somehow using parameters, as even with the proposed integration those would still need to be set by hand, but that's quite advanced stuff to try to fit into a GET parameter..
On query.wikidata.org we would like to provide a link to palladio with the data of the current query. Something like 'export data to palladio'.
So it would be nice to be able to pass a SPARQL query which results would be displayed in palladio then.
Something like for example: http://hdlab.stanford.edu/palladio-app/#/upload?sparql=https://query.wikidata.org/sparql?query=%23Cats%0ASELECT%20%3Fitem%20%3FitemLabel%20WHERE%20%7B%0A%20%20%3Fitem%20wdt%3AP31%20wd%3AQ140.%0A%20%20SERVICE%20wikibase%3Alabel%20%7B%20bd%3AserviceParam%20wikibase%3Alanguage%20%22en%2Cen%22.%20%7D%0A%7D