Search Mailing List Archives

Limit search to: Subject & Body Subject Author
Sort by: Reverse Sort
Limit to: All This Week Last Week This Month Last Month
Select Date Range     through    

[bioontology-support] SPARQL EndPOINT root path extraction

manuelso manuelso at
Fri Apr 5 11:37:38 PDT 2013

Hi Nikolina,

See inline answers below …

On Apr 5, 2013, at 3:57 AM, Nikolina Koleva <nikkol at> wrote:

> Dear Manuel,
> I extract the root path for a class found in a BioPortal ontology by making use of the SPARQL endpoint. For this I send a query that iteratively collects the path. 
> An example query looks like this: 
> PREFIX rdfs: <> 
> PREFIX skos: <>
> SELECT * WHERE { GRAPH <> { <> rdfs:subClassOf ?parent.
> OPTIONAL {?parent rdfs:label ?label}.
> OPTIONAL {?parent skos:prefLabel ?prefLabel}.}} LIMIT 100
> By getting the response for now I just select the last parent retrieved and set it to the child slot and do so until no parent is retrieved.
> Tough there may be more than one paths from the root to a class and so I investigate the question how would I extract all.
> One can collect them in the same manner as explained above. However, this doesn't seem to be very efficient.

Right, this requires many calls to the SPARQL endpoint.

> The REST services allow to get all root paths. However, we want to stick to the SPARQL endpoint.
> We were wondering how this is done there. 
> We experimented with the SPARQL 1.1 Proprty Paths for getting the root path and it is possible to use the "+" operator that gives all ancestors.
> For example using stardog:
> ./stardog query -c snarl://localhost:5820/temp -q "CONSTRUCT { ?s rdfs:subClassOf ?o } WHERE { ?s rdfs:subClassOf ?o. obo:OGMS_0000071 rdfs:subClassOf+ ?o }"
> The query above delivers the paths that we need. Unfortunately the "+" operator is not yet allowed by the BioPortal SPARQL endpoint.
> Are you going to update to the SPARQL 1.1 version? 

Unfortunately there are no "short-term" plans to implement property paths in our SPARQL endpoint. 

> Do you have any idea how this could be solved?

Do you actually need the paths ? or are you just interested in the set of parents. If this was the case you can use subClassOf reasoning to climb up the tree (with this approach you loose the path).

You can send the http parameter "rules" with "SUBP+SUBC" to enable subClassOf and subPropertyOf reasoning in our triple store.

An example in Java:


> Thank you very much in advance!
> Best regards,
> Nikolina

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the bioontology-support mailing list