31
votes
Get Wikipedia URLs (sitelinks) in Wikidata SPARQL query
On 18. April 2016 the ticket "More efficient SPARQL queries for sitelinks" brought us a better way: schema:isPartOf.
?sitelink schema:about ?item .
?sitelink schema:inLanguage "en" .
?sitelink ...
- 411
17
votes
Accepted
Get Wikipedia URLs (sitelinks) in Wikidata SPARQL query
Try this one:
prefix schema: <http://schema.org/>
PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX wdt: <http://www.wikidata.org/...
- 443
15
votes
Accepted
Querying Wikidata : WDQ vs. WDQS / SPARQL
I'm the developer of WDQ. It was developed as a stop-gap measure, until Wikidata would get its own query service. That took some years, but now we have SPARQL and https://query.wikidata.org/ so I plan ...
- 386
15
votes
Accepted
How to include sub-classes in a Wikidata SPARQL query? (example: when querying "bands", include "rock bands")
The right expression to use here is p:P31/ps:P31/wdt:P279*.
Explanation:
p:P31/ps:P31 means instance of, or instance of not marked as preferred. Only using p:P31 at this step would miss some ...
- 8,266
14
votes
Accepted
How to get the name of a Wikidata item
You probably want this:
https://www.wikidata.org/w/api.php?action=wbgetentities&props=labels&ids=Q19675&languages=es
The API command in English: Get information about some entities (...
- 5,800
11
votes
Accepted
Is Wikidata up to date with Wikipedia?
The dependency is supposed to be the opposite, i.e. that Wikipedia should rely on data in Wikidata. This is however not fully implemented yet. If you look at the infobox on this cheese in French, all ...
- 426
8
votes
Accepted
Mapping all Wikipedia URLs to Wikidata entity ids
If you want to do this from the dumps, you can use the wb_items_per_site dump (current version, 625 MB; most recent dumps)
For each Wikidata item, this contains rows with the corresponding page ...
- 793
8
votes
How to get list of all items that have a particular property, in Wikidata?
While not the most script-friendly, here is the easiest/fastest way to get what you want without any third-party:
1) Go to the Wikidata page of the property
2) Click What links here in the left ...
- 8,266
8
votes
Accepted
How to get list of all items that have a particular property, in Wikidata?
Assuming you are familiar with SPARQL, Wikidata (not to be confused with DBpedia) has an official endpoint and a page with example queries. The following example lists all countries with the property ...
- 364
7
votes
How to get the name of a Wikidata item
You can get it also using SPARQL:
SELECT DISTINCT * WHERE {
wd:Q19675 rdfs:label ?label .
FILTER (langMatches( lang(?label), "ES" ) )
}
See it on Wikidata Query Service.
- 442
7
votes
Mapping all Wikipedia URLs to Wikidata entity ids
You can also use the SPARQL service with query like:
prefix schema: <http://schema.org/>
SELECT * WHERE {
<https://en.wikipedia.org/wiki/Tom_Hanks> schema:about ?item .
}
- 443
7
votes
Accepted
Wikidata get property of property
The point in time property of the award received is what Wikidata calls a qualifier:
Along with sources and ranks, qualifiers allow statements to be expanded on, annotated, or contextualized beyond ...
- 5,800
6
votes
Accepted
What are the practical differences between WikiData's infrastructure and SemanticMediawiki?
It really depends on what you're trying to achieve.
This is what the Semantic Mediawiki project has to say on the relationship between Semantic MediaWiki and Wikidata:
The software that powers ...
- 5,800
6
votes
Mapping all Wikipedia URLs to Wikidata entity ids
You could also use the API. The call https://en.wikipedia.org/w/api.php?action=query&prop=pageprops&format=json&titles=Tom%20Hanks will give you the id on Wikidata (as "wikibase_item").
- 426
6
votes
How to get list of all items that have a particular property, in Wikidata?
You can do it by using MediaWiki API for Wikidata with backlinks query
https://www.wikidata.org/w/api.php?action=query&list=backlinks&blnamespace=0&bllimit=500&&bltitle=Property:...
- 257
6
votes
Accepted
Get QID from Wikidata label name, via SPARQL
Yes, you can, but it isn't short:
SELECT distinct ?item ?itemLabel ?itemDescription WHERE{
?item ?label "Mozambique"@en.
?item wdt:P31 wd:Q6256 .
?article schema:about ?item .
?article ...
- 442
6
votes
Retrieve periodic table information from wikidata
I think this is close to what you want but there doesn't seem to be a property for group or period as a number.
SELECT ?element ?elementLabel ?symbol ?protons ?group ?groupLabel ?period ?periodLabel
...
- 388
6
votes
Accepted
Wikidata: How to represent British Hong Kong's under Japanese occupation?
As far as I know, there are no methodological guidelines for how to model those things on Wikidata.
Rerardless Wikidata, modelling of such geopolitical endurants/perdurants/aggregates might be fairly ...
- 2,945
5
votes
Accepted
Extract labels from Wikidata entity
You could do it with SPARQL:
SELECT ?wdLabel ?ooLabel
WHERE {
VALUES (?s) {(wd:Q42)}
?s ?wdt ?o .
?wd wikibase:directClaim ?wdt .
?wd rdfs:label ?wdLabel .
OPTIONAL {
?o rdfs:label ?...
- 2,945
5
votes
Accepted
How to output the description of Wikidata items using SPARQL?
I am far from expert in this, but your question motivated me to learn a little, and I have a solution, below.
In short, there is a "label service" which can be added to the WHERE clause. By simply ...
- 5,488
5
votes
Accepted
Wikidata Query Service reliability
The reason is an error in loading data. It was a temporary problem, now fixed.
The information about future plans and work on WDQS can be found on Wikimedia Discovery team page and Phabricator board....
- 443
5
votes
Querying Wikidata : WDQ vs. WDQS / SPARQL
You can abbreviate SPARQL by expanding a given query fragment with default namespace definitions and other options. For instance the wikidata query command line client expands
wdq -tplanet '?planet ...
- 195
5
votes
Querying Wikidata : WDQ vs. WDQS / SPARQL
As Magnus Manske points out, SPARQL is the preferred way since, I would add, SPARQL is standardized BUT, here is the downside:
The SPARQL endpoint, at this point in time, is NOT as reliable as WDQ ...
5
votes
Accepted
Wikidata SPARQL, why an intermediate item is needed in this sample query?
In the original query ?property and ?p are distinct values: ?property is wd:P54 (short for <http://www.wikidata.org/entity/P54>) and ?p is wdt:P54 (short for <http://www.wikidata.org/prop/...
- 869
5
votes
Is Wikidata up to date with Wikipedia?
Wikidata doesn't automatically use data from Wikipedia. Data from Wikipedia is uploaded to Wikidata by hand or using some more or less automated tools to do batch uploads but ultimately under control ...
- 381
5
votes
wikidata extract
Try Tabernacle. Seems to be exactly what you search. The downloaded resultset is in TSV format, and can be imported in Excel.
You'll need to have a Wikimedia account to work with Tabernacle and some ...
- 51
4
votes
Accepted
Subquery in wikidata
Ok, I found out how to do this. You can use curly braces to further filter on your qualifiers. So the query to get all people that are Bundesminister and where the Bundesminister has a start but no ...
- 211
4
votes
Accepted
How can I add Wikidata properties of item a on the Wikipedia page of item b?
According to v0.4 of the Wikidata inclusion syntax, this feature has not been implemented yet. The progress of this feature is available in the Wikimedia bug tracking system.
- 5,800
4
votes
How to output the description of Wikidata items using SPARQL?
Include SERVICE wikibase:label { bd:serviceParam wikibase:language "en" } inside your WHERE clause
Append the magic string Label and Description to the variable names of your SELECT
For instance, if ...
- 8,266
4
votes
How to add a claim to an existing Wikidata item, from command line?
You can use wikidata-agent for that:
curl -XPOST http://your.wikidata.agent.instance/claim -d 'entity=Q5369879&property=P137&value=Q39'
[Update]: you can now actually add claims using ...
- 266
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
wikidata × 131sparql × 59
wikipedia × 28
data-request × 17
rdf × 9
geospatial × 8
linked-data × 7
api × 6
uses-of-open-data × 6
dbpedia × 5
ontology × 4
images × 3
data-mapping × 3
wikimedia-commons × 3
wikivoyage × 3
nlp × 2
releasing-data × 2
research × 2
json × 2
biology × 2
semantic-web × 2
wikibase × 2
usa × 1
medical × 1
finance × 1