Daniel,

On Sun, Jan 10, 2016 at 3:53 AM, Daniel Mietchen
<[email protected]> 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.org%2Fentity%2F%3E%0APREFIX%20wdt%3A%20%3Chttp%3A%2F%2Fwww.wikidata.org%2Fprop%2Fdirect%2F%3E%0APREFIX%20prov%3A%20%3Chttp%3A%2F%2Fwww.w3.org%2Fns%2Fprov%23%3E%0APREFIX%20pr%3A%20%3Chttp%3A%2F%2Fwww.wikidata.org%2Fprop%2Freference%2F%3E%0A%0ASELECT%20%3Fstatement%20%3FPMID%20%3FPMCID%20WHERE%20%7B%0A%20%20%3Fstatement%20prov%3AwasDerivedFrom%2Fpr%3AP248%20%3Fpaper%20.%0A%20%20%3Fpaper%20wdt%3AP31%20wd%3AQ13442814%20.%0A%20%20OPTIONAL%20%7B%20%3Fpaper%20wdt%3AP698%20%3FPMID%20.%20%7D%0A%20%20OPTIONAL%20%7B%20%3Fpaper%20wdt%3AP932%20%3FPMCID%20.%20%7D%0A%7D

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
[email protected]
https://lists.wikimedia.org/mailman/listinfo/wikidata

Reply via email to