
Wikidata Knowledge
- 16 installs
- 869 repo stars
- Updated June 8, 2026
- beita6969/scienceclaw
wikidata-knowledge is a skill that queries the Wikidata knowledge graph using SPARQL and the entity search API to retrieve structured facts and entity relationships.
About
This skill teaches an agent to query Wikidata's knowledge graph using SPARQL and the entity search API. A developer uses it to find structured facts about people, places, and organizations, query relationships between entities, and cross-reference external identifiers like ORCID and VIAF. It matters because it lets agents pull verified linked-data facts instead of relying on training-data recall.
- Queries Wikidata's 100M+ item knowledge graph via SPARQL and the entity search API
- Includes common property codes (P31, P279, P17) and entity codes (Q5, Q515) plus ready-made SPARQL examples
- Enforces a data-integrity rule: never fabricate results, every fact must come from an actual API response
Wikidata Knowledge by the numbers
- 16 all-time installs (skills.sh)
- Ranked #1,318 of 2,065 Data Science & ML skills by installs in the Skillselion catalog
- Data as of Aug 2, 2026 (Skillselion catalog sync)
wikidata-knowledge capabilities & compatibility
Free; queries the public Wikidata SPARQL and entity search endpoints, no API key needed.
- Capabilities
- knowledge graph query · entity search · sparql query · identifier cross reference
- Use cases
- research · data analysis
- Runs
- Runs locally
- Pricing
- Free
What wikidata-knowledge says it does
Query Wikidata for structured knowledge using SPARQL and entity search.
Query Wikidata's knowledge graph of 100M+ items using SPARQL and the entity search API.
NEVER fabricate database results from training data.
npx skills add https://github.com/beita6969/scienceclaw --skill wikidata-knowledgeAdd your badge
Show developers this skill is listed on Skillselion. Paste this into your README.
| Installs | 16 |
|---|---|
| repo stars | ★ 869 |
| Last updated | June 8, 2026 |
| Repository | beita6969/scienceclaw ↗ |
What it does
Query Wikidata via SPARQL and entity search to retrieve structured facts, entity relationships, and cross-referenced external identifiers.
Who is it for?
Finding structured facts about entities, querying relationships, and cross-referencing external identifiers like Wikipedia, VIAF, GND, and ORCID.
Skip if: Full-text article content (use Wikipedia API), scientific literature (use semantic-scholar), and geospatial data (use OpenStreetMap).
When should I use this skill?
Finding structured facts about entities, querying entity relationships, cross-referencing external identifiers, or building knowledge graphs from linked data.
What you get
Agents retrieve real, cited facts and external identifiers from Wikidata via SPARQL queries.
- SPARQL query results
- Wikidata entity IDs
- cross-referenced external identifiers
By the numbers
- 100M+ Wikidata items
- SPARQL limit of 1 concurrent query with 60-second timeout
- 7 best-practice rules
Files
Wikidata SPARQL and Entity Search
Query Wikidata's knowledge graph of 100M+ items using SPARQL and the entity search API. Covers people, places, organizations, events, scientific concepts, and their relationships.
Entity Search API
Find Wikidata entity IDs by label:
curl -s "https://www.wikidata.org/w/api.php?action=wbsearchentities&search=Marie+Curie&language=en&format=json&limit=5" \
| python3 -c "
import sys, json
data = json.load(sys.stdin)
for r in data.get('search', []):
qid = r.get('id', 'N/A')
label = r.get('label', 'N/A')
desc = r.get('description', '')
print(f'{qid:12s} {label} - {desc}')
"SPARQL Endpoint
https://query.wikidata.org/sparql?query={SPARQL}&format=jsonBasic SPARQL Query via curl
curl -s -G "https://query.wikidata.org/sparql" \
--data-urlencode "format=json" \
--data-urlencode "query=
SELECT ?item ?itemLabel WHERE {
?item wdt:P31 wd:Q515 .
?item wdt:P17 wd:Q183 .
?item wdt:P1082 ?pop .
FILTER(?pop > 500000)
SERVICE wikibase:label { bd:serviceParam wikibase:language \"en\" . }
} ORDER BY DESC(?pop) LIMIT 10
" | python3 -c "
import sys, json
data = json.load(sys.stdin)
for r in data['results']['bindings']:
qid = r['item']['value'].split('/')[-1]
label = r['itemLabel']['value']
print(f'{qid:12s} {label}')
"Common Property Codes
P31 (instance of), P279 (subclass of), P17 (country), P569 (date of birth), P570 (date of death), P106 (occupation), P1082 (population), P625 (coordinates), P214 (VIAF ID), P496 (ORCID iD), P356 (DOI).
Common Entity Codes
Q5 (human), Q515 (city), Q6256 (country), Q3918 (university), Q7889 (computer program), Q11173 (chemical compound), Q16521 (taxon).
SPARQL: Find Nobel Prize Winners in Physics
curl -s -G "https://query.wikidata.org/sparql" \
--data-urlencode "format=json" \
--data-urlencode "query=
SELECT ?person ?personLabel ?year WHERE {
?person wdt:P166 wd:Q38104 .
?person p:P166 ?statement .
?statement ps:P166 wd:Q38104 ;
pq:P585 ?date .
BIND(YEAR(?date) AS ?year)
FILTER(?year >= 2020)
SERVICE wikibase:label { bd:serviceParam wikibase:language \"en\" . }
} ORDER BY DESC(?year)
"SPARQL: Cross-Reference External IDs
# Find ORCID and VIAF for a researcher
curl -s -G "https://query.wikidata.org/sparql" \
--data-urlencode "format=json" \
--data-urlencode "query=
SELECT ?person ?personLabel ?orcid ?viaf WHERE {
?person wdt:P31 wd:Q5 ;
wdt:P496 ?orcid ;
wdt:P214 ?viaf ;
rdfs:label ?name .
FILTER(CONTAINS(LCASE(?name), 'hinton'))
FILTER(LANG(?name) = 'en')
SERVICE wikibase:label { bd:serviceParam wikibase:language \"en\" . }
} LIMIT 5
"Rate Limits
SPARQL: 1 concurrent query, 60-second timeout. Entity search: standard MediaWiki rate limits. User-Agent header recommended for all requests.
Best Practices
1. Always use SERVICE wikibase:label to get human-readable labels. 2. Start with entity search to find Q-IDs before writing SPARQL queries. 3. Use LIMIT on all queries to avoid timeouts on large result sets. 4. Prefer wdt: (direct truthy) over p:/ps: unless you need qualifiers. 5. For complex queries, test at https://query.wikidata.org/ first. 6. URL-encode SPARQL queries when using curl with --data-urlencode. 7. Add OPTIONAL {} blocks for properties that may not exist on all entities.
Data Integrity Rule
NEVER fabricate database results from training data. Every protein ID, gene name, compound property, pathway ID, structure detail, and metadata MUST come from an actual API response in this conversation. If the API returns no results, errors, or partial data, report exactly what happened. Do not "fill in" missing data from memory or make up identifiers.
Related skills
FAQ
What is the wikidata-knowledge skill for?
Querying Wikidata's knowledge graph of 100M+ items using SPARQL and the entity search API to retrieve structured facts, relationships, and external identifiers.
When should I not use this skill?
Do not use it for full-text article content (use the Wikipedia API), scientific literature (use semantic-scholar), or geospatial data (use OpenStreetMap).