Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow passing SPARQL query #186

Open
JonasKress opened this issue Dec 8, 2017 · 4 comments
Open

Allow passing SPARQL query #186

JonasKress opened this issue Dec 8, 2017 · 4 comments
Assignees

Comments

@JonasKress
Copy link

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

@esjewett
Copy link
Member

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.

@esjewett esjewett self-assigned this Dec 11, 2017
@JonasKress
Copy link
Author

Hi @esjewett,
thanks for you reply!
The query would look like this:
image

I am sorry I will not have time to work on this in the near future.

Thanks!
Jonas

@esjewett
Copy link
Member

esjewett commented Dec 12, 2017

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". }
}

@jiemakel
Copy link
Contributor

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..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants