Download Wikidata single entity - truthy

ぐ巨炮叔叔 提交于 2019-11-27 08:37:38

问题


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


回答1:


.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




回答2:


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

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



来源:https://stackoverflow.com/questions/49332839/download-wikidata-single-entity-truthy

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!