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-owl] owl:hasValue

Tania Tudorache tudorache at stanford.edu
Thu May 29 17:42:30 PDT 2008


I can confirm the bug. For some reason, the code assumes that there is 
only one hasValue restriction on a particular property. So, it will 
always return just the first one it finds. We will fix this in the next 
beta release.

Until then, you can use the following code to get all hasValue fillers 
for a class:

for (Iterator it = owlNamedClass.getRestrictions(property, 
true).iterator(); it.hasNext();) {
  OWLRestriction restriction = (OWLRestriction) it.next();
  if (restriction instanceof OWLHasValue) {
      OWLHasValue hasValue = (OWLHasValue) restriction;
      System.out.println("has value filler: " + hasValue.getHasValue());
   }
}

Tania

Thomas Russ wrote:
> On May 29, 2008, at 12:47 PM, Steve Wilder wrote:
>
>   
>> Thomas Russ wrote:
>>     
>>> On May 29, 2008, at 8:22 AM, Steve Wilder wrote:
>>>
>>>       
>>>> Also, I have trouble with the solution you recommended.
>>>>
>>>> I actually have multiple hasValue restrictions on AAR
>>>>
>>>> AAR <= hasAssociatedMissions has AEW_instance
>>>> AAR <= hasAssociatedMissions has ABC_instance
>>>> AAR <= hasAssociatedMissions has CAP_instance
>>>>
>>>> When I run myAAR.getHasValuesOnTypes(prop).size(), the return  
>>>> value is
>>>> 1, even though I'd expect it to be 3.
>>>>         
>>> Well, that's a bit perplexing.
>>>
>>> Unfortunately, setting up an environment to test this on my own is a
>>> bit more work than I'm willing to do right now.
>>>
>>> What values do you get when you look at the contents returned by
>>> getHasValuesOnTypes?  Does it at least get one of the instances you
>>> expect?
>>>       
>> Yes, the first one.
>>
>> 35487  INFO  [main] testeval - AAR-1-4939 is associated with  
>> AEW_instance
>>     
>
> Well, that sounds like a bug in Protege, then.
>
>
>
>   
>>
>>     
>>>> Steve
>>>>
>>>> Steve Wilder wrote:
>>>>         
>>>>> I like the automatic inference better.  I tried classifying the
>>>>> taxonomy
>>>>> using a reasoner, but that didn't seem to do the trick.
>>>>>
>>>>> How can I get my protege server to do this kind of automatic
>>>>> inference
>>>>> on hasValue?
>>>>>
>>>>> Steve
>>>>>
>>>>> Thomas Russ wrote:
>>>>>           
>>>>>> On May 27, 2008, at 9:34 AM, Steve Wilder wrote:
>>>>>>
>>>>>>             
>>>>>>> I have a problem that I'm trying to diagnose.
>>>>>>>
>>>>>>> I have the following definition in OWL:
>>>>>>>               
>>>>>>  AAR <= hasAssociatedMissions has AEW_instance
>>>>>>  ...
>>>>>>             
>>>>>>> If I create an instance of AAR in the Protege editor, the new
>>>>>>> instance
>>>>>>> properly fills in the hasAssociatedMissions property with
>>>>>>> AEW_instance.
>>>>>>>               
>>>>>> That is because the instance editor has a special purpose routine
>>>>>> that
>>>>>> looks for fillers specified by hasValue restrictions on the
>>>>>> instance.
>>>>>> In effect, there is some implicit inference done by the editor to
>>>>>> figure out the slot value.
>>>>>>
>>>>>>             
>>>>>>> However, when using the Protege client/server in my program, I'm
>>>>>>> not
>>>>>>> seeing this property filled in correctly for any instances of  
>>>>>>> AAR.
>>>>>>>
>>>>>>> AAR myAAR = myFactory.createAAR("myAAR");
>>>>>>> System.out.println("AAR: " + myAAR + " has associated missions:  
>>>>>>> " +
>>>>>>> myAAR.getHasAssociatedMissions().size());
>>>>>>>
>>>>>>> returns:
>>>>>>>
>>>>>>> AAR: DefaultAAR(myAAR of [DefaultOWLNamedClass(aco:AAR,
>>>>>>> FrameID(12:12042
>>>>>>> 1))]) has associated missions: 0
>>>>>>>               
>>>>>> That is because this does not do any inference.  It looks only at
>>>>>> the
>>>>>> assserted information.
>>>>>>
>>>>>> You can get the hasValue restrictions by using the
>>>>>> "getHasValuesOnTypes" method.  Note that this is a moderately
>>>>>> expensive method to call.
>>>>>>
>>>>>> Ex:
>>>>>>
>>>>>>    OWLProperty prop =
>>>>>> model.getOWLProperty("hasAssociatedMissions");
>>>>>>    myAAR.getHasValuesOnTypes(prop);
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> _______________________________________________
>>>>>> protege-owl mailing list
>>>>>> protege-owl at lists.stanford.edu
>>>>>> https://mailman.stanford.edu/mailman/listinfo/protege-owl
>>>>>>
>>>>>> Instructions for unsubscribing: http://protege.stanford.edu/doc/faq.html#01a.03
>>>>>>             
>>>>> _______________________________________________
>>>>> protege-owl mailing list
>>>>> protege-owl at lists.stanford.edu
>>>>> https://mailman.stanford.edu/mailman/listinfo/protege-owl
>>>>>
>>>>> Instructions for unsubscribing: http://protege.stanford.edu/doc/faq.html#01a.03
>>>>>           
>>>> <swilder.vcf>_______________________________________________
>>>> protege-owl mailing list
>>>> protege-owl at lists.stanford.edu
>>>> https://mailman.stanford.edu/mailman/listinfo/protege-owl
>>>>
>>>> Instructions for unsubscribing: http://protege.stanford.edu/doc/faq.html#01a.03
>>>>         
>>> _______________________________________________
>>> protege-owl mailing list
>>> protege-owl at lists.stanford.edu
>>> https://mailman.stanford.edu/mailman/listinfo/protege-owl
>>>
>>> Instructions for unsubscribing: http://protege.stanford.edu/doc/faq.html#01a.03
>>>       
>> <swilder.vcf>_______________________________________________
>> protege-owl mailing list
>> protege-owl at lists.stanford.edu
>> https://mailman.stanford.edu/mailman/listinfo/protege-owl
>>
>> Instructions for unsubscribing: http://protege.stanford.edu/doc/faq.html#01a.03
>>     
>
> _______________________________________________
> protege-owl mailing list
> protege-owl at lists.stanford.edu
> https://mailman.stanford.edu/mailman/listinfo/protege-owl
>
> Instructions for unsubscribing: http://protege.stanford.edu/doc/faq.html#01a.03 
>
>   




More information about the protege-owl mailing list