Project:SPARQL/examples: Difference between revisions

Jump to navigation Jump to search
(→‎Maintenance queries: property P28 deprecated)
Line 364: Line 364:


==Maintenance queries==
==Maintenance queries==
===Generate QuickStatements to add "instance of: taxon" to items with NCBI taxon IDs===
<sparql tryit="1">
PREFIX pp: <https://ppsdb.wikibase.cloud/entity/>
PREFIX ppt: <https://ppsdb.wikibase.cloud/prop/direct/>
PREFIX pps: <https://ppsdb.wikibase.cloud/prop/>
PREFIX ppss: <https://ppsdb.wikibase.cloud/prop/statement/>
PREFIX ppsq: <https://ppsdb.wikibase.cloud/prop/qualifier/>
SELECT DISTINCT ?qid ?P18 WHERE {
  ?host pps:P19 ?symbiont.
  FILTER NOT EXISTS {
    ?host ppt:P18 ?instanceof.
    ?instanceof ppt:P24* pp:Q2
  }
  ?host ppt:P11 ?ncbi
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
  BIND (ENCODE_FOR_URI(REPLACE(STR(?host), ".*Q", "Q")) AS ?qid) # article item
  BIND ("Q2" AS ?P18)
}
</sparql>




Navigation menu