Function entity_id

Source
pub fn entity_id(url: &str) -> Option<String>
Expand description

The Wikidata entity id inside a URL MusicBrainz returned.

MusicBrainz gives the relationship as a page URL rather than a bare id, and it does not always give the same one: www.wikidata.org/wiki/Q11649 is the usual shape, but the entity URI .../entity/Q11649 appears too. Both end in the id, so the id is read from the end rather than the middle.

Returns None for anything that does not end in an entity id, which is the honest answer for a link that leads somewhere else — a lexeme, a property, or a URL that was never Wikidata at all.