Question: Order by subclass SPARQL
3
gravatar for JJK
5.2 years ago by
JJK50
Netherlands
JJK50 wrote:

I have seen some posts about using the uniprot and the spraql endpoint to retrieve either all species belonging to a rank or identify what the parent class is of a species.

For example the following query will retrieve the lineage of a given organism

PREFIX up:<http://purl.uniprot.org/core/> 
PREFIX taxon:<http://purl.uniprot.org/taxonomy/> 
PREFIX rdfs:<http://www.w3.org/2000/01/rdf-schema#> 
SELECT ?taxon ?name
WHERE
{
    ?taxon a up:Taxon .
    ?taxon up:scientificName ?name .
    taxon:1314 rdfs:subClassOf+ ?taxon .
}

However is there a way to order them by their subclass tree? I can always ask for 1 level up and then query again and again until I reach the ceiling or floor but there might be a more efficient way?

 

sparql subclassof rdf • 1.7k views
ADD COMMENTlink modified 3 months ago by Biostar ♦♦ 20 • written 5.2 years ago by JJK50
4
gravatar for me
5.2 years ago by
me730
Switzerland
me730 wrote:

You can order by rank

PREFIX up:<http://purl.uniprot.org/core/>
PREFIX taxon:<http://purl.uniprot.org/taxonomy/>
PREFIX rdfs:<http://www.w3.org/2000/01/rdf-schema#>
SELECT ?taxon ?name ?rank
WHERE
{
    ?taxon a up:Taxon .
    ?taxon up:scientificName ?name .
    taxon:1314 rdfs:subClassOf ?taxon .
    ?taxon up:rank ?rank .
} ORDER BY ?rank

I am not sure what you mean by subtree. i.e. could you make some ascii art with the expected output.

ADD COMMENTlink modified 4.1 years ago • written 5.2 years ago by me730
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 2122 users visited in the last hour