Skip to contents

This function takes a component of a triple pattern as input and returns (if it exists) a corresponding human-readable label.

Usage

get_label_1(
  string,
  language = "en",
  endpoint = "wikidata",
  label_property = "rdfs:label"
)

Arguments

string

the string (a part of a triple pattern) to label

language

the language in which to return the label (defaults to "en")

endpoint

the SPARQL endpoint that is being queried (defaults to "wikidata")

label_property

the name of the labelling property, for instance "skos:prefLabel". Defaults to "rdfs:label". If the endpoint is one of the usual glitter endpoints (see glitter::usual_endpoints) the labelling property is set accordingly.

Value

the label corresponding to the string

Examples

get_label_1("wdt:P31")
#> [1] "instance of"
get_label_1("{wd:Q144 wd:Q146 wd:Q780}")
#> [1] "dog\nhouse cat\nchicken"
get_label_1("wdt:P31/wdt:P279*")
#> [1] "instance of\nsubclass of"