Project:SPARQL/examples: Difference between revisions

Jump to navigation Jump to search
no edit summary
No edit summary
Line 89: Line 89:
</sparql>
</sparql>


===Find interactions where the symbiont is member of Pseudomonadota===
Symbiont items linked to Wikidata items by NCBI taxonomy ID. Not all symbionts have corresponding Wikidata items or NCBI taxonomy IDs.
<sparql tryit="1">
PREFIX pp: <https://ppsdb.wikibase.cloud/entity/>
PREFIX ppt: <https://ppsdb.wikibase.cloud/prop/direct/>
SELECT DISTINCT ?host ?hostLabel ?symb ?symbLabel ?ncbi ?wditem
WITH {
  SELECT DISTINCT ?host ?symb ?ncbi ?hostLabel ?symbLabel
  WHERE {
    ?host ppt:P19 ?symb.
    ?symb ppt:P11 ?ncbi.
    ?host rdfs:label ?hostLabel.
    ?symb rdfs:label ?symbLabel.
  }
} AS %ncbis
WHERE {
  INCLUDE %ncbis
  SERVICE <https://query.wikidata.org/sparql> {
    ?wditem wdt:P685 ?ncbi;
          rdfs:label ?wdlabel.
    ?wditem wdt:P171* wd:Q12962137. # child taxon of Pseudomonadota (parent taxon of Gammaproteobacteria)
    FILTER ( LANG(?wdlabel) = "en" )
  }
} ORDER BY ?symbLabel
</sparql>


==Lists==
==Lists==

Navigation menu