Download Wikidata single entity - truthy

1.4k Views Asked by At

I would like to download Wikidata for a single entity. I know I can achieve using the URL, for example:

https://www.wikidata.org/wiki/Special:EntityData/Q42.rdf

Will give me Wikidata for Douglas Adams in RDF format.

But this data is fully, meaning complete with meta-data such as qualifiers and references. I am interested in primary data only.

Actually I am working on RDF Reification, and for that I need some sample non-RDF data which I can test my program on (like truthy Wikidata).

I do not wish to download entire Wikidata dumps (Which I know are available in truthy format).

2

There are 2 best solutions below

0
Stanislav Kralin On BEST ANSWER

.ttl?flavor=simple produces also many sitelinks which look like this:

<https://ru.wikipedia.org/wiki/Адамс,_Дуглас> a schema:Article ;
    schema:about wd:Q42 ;
    schema:inLanguage "ru" ;
    schema:isPartOf <https://ru.wikipedia.org/> ;
    schema:name "Адамс, Дуглас"@ru .

<https://ru.wikipedia.org/> wikibase:wikiGroup "wikipedia" .

If you want to get rid of them, you can manually CONSTRUCT what you want as described below.

Do not forget to send Accept: text/turtle.

Truthy statements, without properties from external vocabularies

CONSTRUCT {?s ?p ?o} WHERE {
  VALUES (?s) {(wd:Q42)}
  ?s ?p ?o . 
  [] wikibase:directClaim ?p 
}

Try it!

Truthy statements, with properties from external vocabularies

CONSTRUCT {?s ?p ?o} WHERE {
  VALUES (?s) {(wd:Q42)}
  ?s ?p ?o . 
  FILTER NOT EXISTS { [] wikibase:claim|wikibase:directClaimNormalized ?p }
}

Try it!


Documentation

0
Vijay Chavda On

As suggested in comments, we can use the ?flavor=simple like so:

https://www.wikidata.org/wiki/Special:EntityData/Q42.rdf?flavor=simple