Vijay Chavda
Vijay Chavda

Reputation: 862

Download Wikidata single entity - truthy

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).

Upvotes: 3

Views: 1595

Answers (2)

Stanislav Kralin
Stanislav Kralin

Reputation: 11479

.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

Upvotes: 3

Vijay Chavda
Vijay Chavda

Reputation: 862

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

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

Upvotes: 3

Related Questions