0
votes

I am trying to get a full subgraph, with all relations intact from the following ontology: http://purl.obolibrary.org/obo/NCBITaxon_9443 The NCBI ontology is very large and we only want the subset of all the primates for example. I currently use the following query:

PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>

SELECT DISTINCT ?s2 ?s3 ?s4 ?s5 FROM <http://purl.obolibrary.org/obo/merged/NCBITAXON> WHERE {
        SERVICE <http://sparql.hegroup.org/sparql>    
        {
            ?s rdf:type ?o .
            ?s2 rdfs:subClassOf ?s.
            ?s3 rdfs:subClassOf ?s2.
            ?s4 rdfs:subClassOf ?s3.
            ?s5 rdfs:subClassOf ?s4.
            FILTER ( ?s = <http://purl.obolibrary.org/obo/NCBITaxon_9443> )
    }   
}

I don't think this is extensive enough and it also does not return a "nice" format. I would preferably get a subgraph in OWL or RDF(S) format back.

Can anyone help me with this? Thanks!

you have to use a CONSTRUCT query when you want an RDF back as resultUninformedUser
next, you should define what the subgraph should contain. From your shown query I don't see which facts you want to have in the subgraph, just the class hierarchy below a given class? Nothing else? No labels, description, etc?UninformedUser