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    

[protege-dev] Fwd: [Protege 3.x][OWL API] Getting indirect children or directed graph of individuals/descendants

Tania Tudorache tudorache at stanford.edu
Wed May 13 10:59:20 PDT 2015


I am glad to hear that you found a solution.

Cheers,
Tania

On 05/12/2015 09:21 PM, Ray Rashif wrote:
> Thanks, that's what I needed to hear. I ended up just doing a
> recursive depth-first search -- that's as concise as it gets (although
> in Java, especially with unmodifiable collections, it is a bit messy).
> Pseuodocode below for anyone's future reference.
>
> ~~~
> printAllChildrenByProperty(parent, children[], property):
>    child = parent.property.firstValue
>    if child is null
>      print children
>    else
>      newchildren = child.property.allValues
>      children.remove(child)
>      newchildren.add(children)
>      printAllChildrenByProperty(child, newchildren, property)
> ~~~
>
> Best
>
> On 12 May 2015 at 04:55, Tania Tudorache <tudorache at stanford.edu> wrote:
>> You can use the:
>>
>> kb.getDirectOwnSlotValuesClosure(instance, slot);
>>
>> It returns a set with the closure. However, it will only work on the direct
>> own slot values.
>>
>> If it does not work for your purposes, then you would need to implement your
>> own search algorithm.
>>
>> Tania
>>
>>
>>
>> On 04/27/2015 01:08 AM, Ray Rashif wrote:
>>> [cross-posting from the user's list and amended since this is about an
>>> old API that not many will be familiar with]
>>>
>>> Hello folks
>>>
>>> I have an academic need to use the (very old) Protege-OWL API of
>>> Protege 3.x, and am looking for an alternative to BFS/DFS search to
>>> accomplish what I want:
>>>
>>> All individuals (direct or indirect) related by a certain property
>>> (e.g. "child", "son", "daughter", etc.) that point back to a common
>>> node.
>>>
>>> So, for instance, given an individual P with children { x ... }, under
>>> normal uninformed circumstances such as now I would simply iterate
>>> over the values of the property :child in a breadth- or depth-first
>>> manner to get all descendants.
>>>
>>> I just want to know if it's my limited knowledge or whether there is
>>> indeed no other alternative solution to this.
>>>
>>> Two points worth mentioning here:
>>>
>>> 1. I am not using transitive properties, so that's out (though that
>>> would certainly be a nice way to design this for semantic validity).
>>>
>>> 2. I'd definitely move to the OWL API (or do some Jena magic) if there
>>> is a "better" (i.e. more abstract) solution to be gotten from the
>>> move.
>>>
>>> Best
>>>
>>> P.S: I am not really bound to use protege-owl, but at the moment I'd
>>> like to refrain from moving to the OWL API if there is no real need.
>>> The problem here is pretty generic and not specific to one API.
>>>
>>>
>>
>> _______________________________________________
>> protege-dev mailing list
>> protege-dev at lists.stanford.edu
>> https://mailman.stanford.edu/mailman/listinfo/protege-dev
>
>




More information about the protege-dev mailing list