Skip to contents

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

url_to_id(x)

url_to_id(x)

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.

Details

The Wikidata Q identifier (QID) is the unique identifier (UID) used in Wikidata.

Examples

url_to_id("http://www.wikidata.org/entity/42")
#> http://www.wikidata.org/entity/42 
#>                              "42" 
url_to_id("http://www.wikidata.org/Q42")
#> http://www.wikidata.org/Q42 
#>                       "Q42"