w_SearchByOccupation {wikiTools}R Documentation

Get Wikidata entities with a certain occupation

Description

Return the Wikidata entities which have the occupation indicated in Qoc, the Wikidata entity for that occupation. For example, if Qoc='Q2306091', returns the Wikidata entities which occupation is "Sociologist", among others. Also returns the Wikidata class of which the entities are instances of. If parameter langsorder=”, then no labels or descriptions of the entities are returned, otherwise the function returns them in the language order indicated in langsorder. If wikilangs=” (if mode='wikipedias') then the Wikipedia pages are not filtered by language, else only Wikipedias of languages in this parameter are returned.

Usage

w_SearchByOccupation(
  Qoc,
  mode = c("default", "count", "wikipedias"),
  langsorder = "",
  wikilangs = "",
  nlimit = 10000,
  debug = FALSE
)

Arguments

Qoc

The Wikidata entity of the occupation. For example, Q2306091 for sociologist, Q2526255 for Film director, etc.

mode

The results you want to obtain: 'default' returns the Wikidata entities which have the occupation indicated; 'count' search in WDQS to know the number of Wikidata entities with that occupation); 'wikipedias' also the Wikipedia page of the entities are returned.

langsorder

Order of languages in which the information will be returned, separated with '|'. If no information is given in the first language, next is used. If langsorder=”, then labels or descriptions are not returned.

wikilangs

List of languages in Wikipedias to limit the search, using "|" as separator (only if mode='wikipedias'). Wikipedias page titles are returned in same order as languages in this parameter. If wikilangs=” the function returns Wikipedia page titles of entities in any language, not sorted.

nlimit

If the number of entities in that occupation exceeds this number, then query are made in chunks. The value can increase if langorder=”. Please, reduce the default value if error is raised.

debug

For debugging purposes (default FALSE). If debug='info' information about chunked queries is shown. If debug='query' also the query launched is shown. If debug='count' the function only returns the number of entities with that occupation.

Value

A data-frame with 'entity' and 'entityLabel', 'entityDescription', 'instanceof' and 'instanceofLabel' columns. Index of the data-frame is also set to the list of entities found.

Author(s)

Angel Zazo, Department of Computer Science and Automatics, University of Salamanca

Examples

## Not run: 
# "Q2306091" Qoc for Sociologist
w_SearchByOccupation(Qoc="Q2306091", mode='count')
q <- w_SearchByOccupation(Qoc="Q2306091", langsorder="")
q <- w_SearchByOccupation(Qoc="Q2306091", langsorder="en|es|fr")
q <- w_SearchByOccupation(Qoc="Q2306091", mode='wikipedias', debug='info')
q <- w_SearchByOccupation(Qoc="Q2306091", mode='wikipedias', wikilangs='en|es|fr', debug='info')

## End(Not run)

[Package wikiTools version 1.2.7 Index]