Advertisement
Guest User

Untitled

a guest
Aug 20th, 2019
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.39 KB | None | 0 0
  1. library(glue)
  2. library(WikidataQueryServiceR) #library to send SPARQL queries to wikidata
  3.  
  4. #great for building SPARQL queries
  5. #escape braces with double braces
  6. #instert paramters directly with braces
  7.  
  8. query <- glue(
  9. "SELECT ?human ?VIAF WHERE", "{{",
  10. "?human wdt:P106 wd:", "{occupation_id}.",
  11. "?human wdt:P214 ?VIAF .",
  12. "}}"
  13. )
  14.  
  15.  
  16. #now we can query wikidata
  17. query_wikidata(query)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement