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] How to get values of a dataproperty or objectproperty using Java API over OWL files?

Timothy Redmond tredmond at stanford.edu
Wed Oct 1 17:11:04 PDT 2008


It is not clear what you are trying to do.  The most obvious  
interpretation is that for some individual, i and some property, p,  
you want to discover the asserted p-values for the individual i.    
Looking in the OWLIndividual, we see that it inherits a method from  
RDFResource: RDFResource.getPropertyValues().  So I made a small  
ontology with an individual x, an object property p and an individual  
y where p takes x to y.  I then ran the following code

     OWLIndividual x = owlModel.getOWLIndividual("x");
     OWLObjectProperty p = owlModel.getOWLObjectProperty("p");
     x.getPropertyValues(p);

and  it returned a list containing the owl individual y.

-Timothy


On Oct 1, 2008, at 12:52 PM, Peng Yang wrote:

> Hi,
>
> Does anybody know how to get value of a dataproperty or  
> objectproperty using Java API over OWL files? Can I use  
> getPropertyValueLiterals( )?
>
> The following are the codes how I get values of data property with  
> getPropertyValueLiterals( ). But it fails, no values of data  
> properties are print out. It seems that getPropertyValueLiterals( )  
> returns a  NULL container.
>
> Collection  
> values=((DefaultOWLObjectProperty)property).getPropertyValueLiterals
> ((DefaultOWLObjectProperty)property);
>
>                         for(Iterator  
> vi=values.iterator();vi.hasNext();)
>                         {
>                                 ProtegeSlot s=(ProtegeSlot) vi.next();
>                                  
> System.out.println("----"+s.getBrowserText());
>                          }
>
> Thanks
> Pey
> _______________________________________________
> 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