url_to_id: Extract an identifier from a wikidata URL

Description Usage Arguments Value Examples

View source: R/utils.R

Description

Convert a URL ending in an identifier (returned by SPARQL queries) to just the plain identifier (QID or PID).

Convert a URL ending in an identifier (returned by SPARQL queries) to just the plan identifier (QID or PID).

Usage

1
2
3

Arguments

x

a vector of strings representing wikidata URLs

Value

if the URL ends in a QID or PID, return that PID or QID, else return the original string

QID or PID

Examples

1
2
url_to_id("http://www.wikidata.org/entity/42")
url_to_id("http://www.wikidata.org/Q42")

WikidataR documentation built on Nov. 16, 2021, 5:07 p.m.