Skip to content

Ncbi taxon id を使った検索拡張など

Fumihiro Kato edited this page Jul 16, 2015 · 1 revision

=== 和名を入れるとNCBI Taxon IDを返す ===

PREFIX rdfs: 
PREFIX species: 

SELECT DISTINCT ?num
WHERE {
    ?sname rdfs:label "アゲハチョウ科"@ja .
    ?sname species:hasNCBITaxonomyID ?num .
}

=== 種の学名(Papilio xuthus)を入れると属のNCBI Taxon IDを返す ===

PREFIX rdfs: 
PREFIX species: 
SELECT *
WHERE {
   species:hasSuperTaxon ?o .
  ?o species:hasTaxonRank  .
  ?o species:hasNCBITaxonomyID ?num .
  optional {
  	?o species:commonName ?name .
}
}
LIMIT 200

=== 種の学名(Papilio xuthus)を入れるとそのFamily(科)に属するタクソンのNCBI Taxon IDを返す ===

PREFIX rdfs: 
PREFIX species: 
SELECT DISTINCT ?label ?num
WHERE {
   species:hasSuperTaxon ?o .
  ?o species:hasTaxonRank  .
  ?o2 species:hasSuperTaxon ?o .
  ?o2 species:hasTaxonRank ?rank .
   ?o2 species:hasNCBITaxonomyID ?num .
  ?o2 rdfs:label ?label .
}
LIMIT 200

=== カサゴケ科の学名(Bryaceae)を入れるとそのFamily(科)に属するタクソンのNCBI Taxon IDを返す ===

PREFIX rdfs: 
PREFIX species: 
SELECT DISTINCT ?label ?num ?rank
WHERE {
  ?o2 species:hasSuperTaxon  .
  ?o2 species:hasTaxonRank ?rank .
   ?o2 species:hasNCBITaxonomyID ?num .
  ?o2 rdfs:label ?label .
}
LIMIT 200

=== NCBIのIDを入れるとその上位タクソンを返す ===

PREFIX rdfs: 
PREFIX species: 
SELECT *
WHERE {
   rdfs:label ?scientificname ;
  species:hasSuperTaxon ?parent .
  ?parent rdfs:label ?parentname.
}
LIMIT 200

=== NCBIのIDからひとつ上のタクソンを返す(ひとつ上の階層を決め打ち) ===

PREFIX rdfs: 
PREFIX species: 
SELECT * 
WHERE {
   rdfs:label ?scientificname ;
    species:hasSuperTaxon ?parent .
  ?parent rdfs:label ?parentname ;
    species:hasTaxonRank  .
}
LIMIT 200

=== NCBI由来に限って、上位タクソンを探す ===

PREFIX species: 
SELECT *
WHERE {
graph 
{
   species:hasSuperTaxon ?o .
  ?o species:hasTaxonRank ?r .
}
}
LIMIT 1000

=== NCBI由来に限って、自分の属する属genusタクソンのNCBI taxon idを返す === NCBI由来でないものがはいるとおかしなことがおこるので。

PREFIX species: 
SELECT distinct ?num
WHERE {
graph  {
   species:hasSuperTaxon ?o .
  
  ?o species:hasTaxonRank  .
}
?o species:hasNCBITaxonomyID ?num .

  }

LIMIT 1000