Dear all,
I am making my first steps with SPARQL and would appreciate some help from those in the know (got some help already, but am still getting stuck easily).
Specifically, I am trying to get an overview of statements that are or could be sourced to items that are scientific papers.
What I got so far: (1) Wikidata items that are instances of scientific article (Q13442814) and have a PMID (P698) or PMCID (P932) https://query.wikidata.org/#PREFIX%20wd%3A%20%3Chttp%3A%2F%2Fwww.wikidata.or...
(2) Wikidata items that are instances of scientific article (Q13442814) but do not have a PMID (P698) or PMCID (P932) https://query.wikidata.org/#PREFIX%20wd%3A%20%3Chttp%3A%2F%2Fwww.wikidata.or...
What I want now is a list of (ideally) statements (or - less ideally - items with such statements) that have references of one of the types given in (1) and (2).
Any pointers?
Thanks,
Daniel
Hi Daniel,
I'm also a beginner of SPARQL, so I would like to know the suggestions of experts - I'm sure there are many of them on this mailing list.
In the meantime, after a struggle and with the help of [1] and [2], I seem to have made a query which might help: http://tinyurl.com/hcbbalj
For example, its first result shows that "Allen Allison (Q20745425)" has a statement "affiliation (P1416)" which cites a paper "Ecological guild evolution and the discovery of the world's smallest vertebrate (Q15567682)".
Aside from SPARQL, another thing I'm not sure about is whether if there are other properties like "stated in (P248)" that expects an article as its value.
[0] https://query.wikidata.org/#PREFIX%20wd%3A%20%3Chttp%3A%2F%2Fwww.wikidata.or... [1] https://www.mediawiki.org/wiki/Wikibase/Indexing/SPARQL_Query_Examples#Prope... [2] https://www.mediawiki.org/wiki/Wikibase/Indexing/RDF_Dump_Format
Best, Yusuke
On Sun, Jan 10, 2016 at 11:53 AM, Daniel Mietchen daniel.mietchen@googlemail.com wrote:
Dear all,
I am making my first steps with SPARQL and would appreciate some help from those in the know (got some help already, but am still getting stuck easily).
Specifically, I am trying to get an overview of statements that are or could be sourced to items that are scientific papers.
What I got so far: (1) Wikidata items that are instances of scientific article (Q13442814) and have a PMID (P698) or PMCID (P932) https://query.wikidata.org/#PREFIX%20wd%3A%20%3Chttp%3A%2F%2Fwww.wikidata.or...
(2) Wikidata items that are instances of scientific article (Q13442814) but do not have a PMID (P698) or PMCID (P932) https://query.wikidata.org/#PREFIX%20wd%3A%20%3Chttp%3A%2F%2Fwww.wikidata.or...
What I want now is a list of (ideally) statements (or - less ideally - items with such statements) that have references of one of the types given in (1) and (2).
Any pointers?
Thanks,
Daniel
Wikidata mailing list Wikidata@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/wikidata
Daniel,
On Sun, Jan 10, 2016 at 3:53 AM, Daniel Mietchen daniel.mietchen@googlemail.com wrote:
What I want now is a list of (ideally) statements (or - less ideally - items with such statements) that have references of one of the types given in (1) and (2).
It would look something like:
PREFIX wd: http://www.wikidata.org/entity/ PREFIX wdt: http://www.wikidata.org/prop/direct/ PREFIX prov: http://www.w3.org/ns/prov# PREFIX pr: http://www.wikidata.org/prop/reference/
SELECT ?statement ?PMID ?PMCID WHERE { ?statement prov:wasDerivedFrom/pr:P248 ?paper . ?paper wdt:P31 wd:Q13442814 . OPTIONAL { ?paper wdt:P698 ?PMID . } OPTIONAL { ?paper wdt:P932 ?PMCID . } }
https://query.wikidata.org/#PREFIX%20wd%3A%20%3Chttp%3A%2F%2Fwww.wikidata.or...
Then you can filter for your two options with:
FILTER (BOUND(?PMID)) FILTER (!BOUND(?PMID))
Grtz,
Egon
Thanks to both of you, Yusuke and Egon. You solved my immediate problem, taught me new things on the way, and inspired me to play around a bit more. That was a nice experience. d.
On Sun, Jan 10, 2016 at 1:09 PM, Egon Willighagen egon.willighagen@gmail.com wrote:
Daniel,
On Sun, Jan 10, 2016 at 3:53 AM, Daniel Mietchen daniel.mietchen@googlemail.com wrote:
What I want now is a list of (ideally) statements (or - less ideally - items with such statements) that have references of one of the types given in (1) and (2).
It would look something like:
PREFIX wd: http://www.wikidata.org/entity/ PREFIX wdt: http://www.wikidata.org/prop/direct/ PREFIX prov: http://www.w3.org/ns/prov# PREFIX pr: http://www.wikidata.org/prop/reference/
SELECT ?statement ?PMID ?PMCID WHERE { ?statement prov:wasDerivedFrom/pr:P248 ?paper . ?paper wdt:P31 wd:Q13442814 . OPTIONAL { ?paper wdt:P698 ?PMID . } OPTIONAL { ?paper wdt:P932 ?PMCID . } }
https://query.wikidata.org/#PREFIX%20wd%3A%20%3Chttp%3A%2F%2Fwww.wikidata.or...
Then you can filter for your two options with:
FILTER (BOUND(?PMID)) FILTER (!BOUND(?PMID))
Grtz,
Egon
-- E.L. Willighagen Department of Bioinformatics - BiGCaT Maastricht University (http://www.bigcat.unimaas.nl/) Homepage: http://egonw.github.com/ LinkedIn: http://se.linkedin.com/in/egonw Blog: http://chem-bla-ics.blogspot.com/ PubList: http://www.citeulike.org/user/egonw/tag/papers ORCID: 0000-0001-7542-0286 ImpactStory: https://impactstory.org/EgonWillighagen
Wikidata mailing list Wikidata@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/wikidata