True, fair enough. But that works too for our use case :-) (it’s a machine 
learning classification task, where we use the ancestors as features, rather 
than just the “leafs”).
What would be the fastest way of constructing such a list for all concepts in 
the graph? 
Maybe just flush out all the rdfs:subClassOf as a adjacency list and do some 
graph processing on that (without SPARQL)? 

Joël


> On 01 Feb 2016, at 16:21, buehmann <buehm...@informatik.uni-leipzig.de> wrote:
> 
> There is no guarantee with this query to get a path, but instead all ancestor 
> classes for the given class. In your example it might have been worked, but 
> this is more by chance.
> 
> On 01.02.2016 16:13, Joël Kuiper wrote:
>> Well the query does what it needs to do, for a given concept find the path 
>> to a root, for example:
>> 
>> 
>> query:
>> SELECT DISTINCT ?parent
>> WHERE {
>>   GRAPH ?g {
>>     <http://purl.bioontology.org/ontology/ICD10CM/J86.0 
>> <http://purl.bioontology.org/ontology/ICD10CM/J86.0>> rdfs:subClassOf+ 
>> ?parent .
>>   }}
>> 
>> output:
>> parent
>> http://purl.bioontology.org/ontology/ICD10CM/J86 
>> <http://purl.bioontology.org/ontology/ICD10CM/J86>
>> http://purl.bioontology.org/ontology/ICD10CM/J85-J86 
>> <http://purl.bioontology.org/ontology/ICD10CM/J85-J86>
>> http://purl.bioontology.org/ontology/ICD10CM/J00-J99 
>> <http://purl.bioontology.org/ontology/ICD10CM/J00-J99>
>> http://www.w3.org/2002/07/owl#Thing <http://www.w3.org/2002/07/owl#Thing>
>> 
>> It’s just that it’s really slow, so I was wondering if there was a way of 
>> optimising this (either by some hints, or using reasoners that understand 
>> transitivity)
>> 
>> Joël
>> 
>>> On 01 Feb 2016, at 15:42, Paul Tyson <phty...@sbcglobal.net> wrote:
>>> 
>>> I don't know that you can get such results from sparql directly. I would 
>>> get flat list of subclass relations in xml (.srx) or Json and then process 
>>> with xslt or JavaScript to write out class hierarchy.
>>> 
>>> Regards,
>>> --Paul
>>> 
>>> On Feb 1, 2016, at 07:05, Joël Kuiper <j...@joelkuiper.eu 
>>> <mailto:j...@joelkuiper.eu>> wrote:
>>> 
>>>> This message has no content.
>> 
> 

Reply via email to