Patterns

Entity Linking

Connect Wikidata entities to external databases using identifiers. Link to VIAF, GND, ORCID, GitHub, and thousands of other sources.

External Identifiers in Wikidata

Wikidata stores thousands of external identifier properties that link entities to other databases. These enable cross-dataset queries and data enrichment.

Property Database Domain
wdt:P214 VIAF ID Authority control
wdt:P227 GND ID German National Library
wdt:P496 ORCID Researchers
wdt:P2037 GitHub username Developers
wdt:P2013 Facebook ID Social media
wdt:P646 Freebase ID Knowledge graph

Finding External IDs

All External IDs for a Programming Language
Run ↗
SELECT ?prop ?propLabel ?value
WHERE {
  # Python programming language
  wd:Q28865 ?prop ?value .

  # Filter to external-id properties only
  ?property wikibase:directClaim ?prop ;
             wikibase:propertyType wikibase:ExternalId .

  SERVICE wikibase:label {
    bd:serviceParam wikibase:language "en" .
  }
}
Museums with VIAF Authority Records
Run ↗
SELECT ?museum ?museumLabel ?viaf
WHERE {
  ?museum wdt:P31/wdt:P279* wd:Q33506 ;  # museum
          wdt:P214 ?viaf .  # has VIAF ID

  SERVICE wikibase:label {
    bd:serviceParam wikibase:language "en" .
  }
}
LIMIT 50

Building External URLs

Generate GitHub Profile URLs
Run ↗
SELECT ?person ?personLabel ?github
       (CONCAT("https://github.com/", ?github) AS ?githubUrl)
WHERE {
  ?person wdt:P106 wd:Q5482740 ;  # programmer
          wdt:P2037 ?github .    # GitHub username

  SERVICE wikibase:label {
    bd:serviceParam wikibase:language "en" .
  }
}
LIMIT 30
Using Formatter URLs
Run ↗
SELECT ?city ?cityLabel ?geonames ?url
WHERE {
  ?city wdt:P31 wd:Q515 ;  # city
        wdt:P17 wd:Q142 ;     # France
        wdt:P1566 ?geonames . # GeoNames ID

  # Get the formatter URL pattern
  wd:P1566 wdt:P1630 ?formatter .
  BIND(IRI(REPLACE(?formatter, "\\$1", ?geonames)) AS ?url)

  SERVICE wikibase:label {
    bd:serviceParam wikibase:language "en" .
  }
}
LIMIT 20

Cross-Reference Matching

Find Entity by External ID
Run ↗
SELECT ?item ?itemLabel
WHERE {
  # Find by ORCID
  ?item wdt:P496 "0000-0001-5109-3700" .

  SERVICE wikibase:label {
    bd:serviceParam wikibase:language "en" .
  }
}
Entities with Multiple Authority IDs
Run ↗
SELECT ?person ?personLabel ?viaf ?gnd ?orcid
WHERE {
  ?person wdt:P106 wd:Q1650915 ;  # researcher
          wdt:P214 ?viaf ;         # VIAF
          wdt:P227 ?gnd ;          # GND
          wdt:P496 ?orcid .        # ORCID

  SERVICE wikibase:label {
    bd:serviceParam wikibase:language "en" .
  }
}
LIMIT 30

Coverage Analysis

Programming Languages Missing GitHub Topic
Run ↗
SELECT ?lang ?langLabel
WHERE {
  ?lang wdt:P31 wd:Q9143 .  # programming language

  # Has no GitHub topic ID
  FILTER NOT EXISTS { ?lang wdt:P9100 ?github . }

  SERVICE wikibase:label {
    bd:serviceParam wikibase:language "en" .
  }
}
LIMIT 50
Count External IDs per Entity Type
Run ↗
SELECT ?lang ?langLabel
       (COUNT(DISTINCT ?extProp) AS ?extIdCount)
WHERE {
  ?lang wdt:P31 wd:Q9143 ;  # programming language
        ?extProp ?extValue .

  ?prop wikibase:directClaim ?extProp ;
        wikibase:propertyType wikibase:ExternalId .

  SERVICE wikibase:label {
    bd:serviceParam wikibase:language "en" .
  }
}
GROUP BY ?lang ?langLabel
ORDER BY DESC(?extIdCount)
LIMIT 20

Key External ID Properties

Property Name Domain
P214 VIAF ID People, organizations
P227 GND ID German authority
P244 LCNAF US Library of Congress
P496 ORCID Researchers
P1566 GeoNames ID Geographic places
P2037 GitHub username Developers
P9100 GitHub topic Programming topics
P856 Official website All entities