Thanks.

-----Original Message-----
From: Joshua TAYLOR [mailto:[email protected]] 
Sent: Friday, February 22, 2013 12:42 PM
To: [email protected]
Subject: Re: testing whether an instance could be associated with a class

On Fri, Feb 22, 2013 at 12:11 PM, David Jordan <[email protected]> wrote:
> My original question WAS about an individual a of class A, let me call it 
> a123, so not to confuse it with the word "a". I may have taken things to the 
> class level in my discussion, but the question is about an individual. So my 
> original question was to see whether you could take individual a123 and 
> declare that it is a B, taking into account any restrictions that may be 
> defined for B. You say that a reasoner can determine that. So my question was 
> how, with using the Jena API, that I can determine whether a123 can be made 
> into a B (via :a123 a :B). What is the approach using Jena to check this?

Sorry, I did misread the order of the classes and individuals.  Using the Jena 
API, you can create the class "not B" and ask whether a123 is a "not B".  If it 
is, then adding "a123 a B" would be inconsistent.
Dave Reynolds' message just arrived while I was writing this, so instead of 
elaborating on the above, I'll provide a code sample:

package example;

import com.hp.hpl.jena.ontology.Individual;
import com.hp.hpl.jena.ontology.OntClass;
import com.hp.hpl.jena.ontology.OntModel;
import com.hp.hpl.jena.ontology.OntModelSpec;
import com.hp.hpl.jena.rdf.model.ModelFactory;

public class Example {
public static void main(String[] args) {
                
                // Instead of OntModelSpec.OWL_DL_MEM, you might use, e.g., 
Pellet's THE_SPEC
                OntModel model = ModelFactory.createOntologyModel( 
OntModelSpec.OWL_DL_MEM );
                
                OntClass A = model.createClass();
                OntClass B = model.createClass();
                OntClass notB = model.createComplementClass( null, B );
                
                Individual a123 = model.createIndividual( A );
                
                if ( a123.hasRDFType( notB ) ) {
                        // a123 cannot consistently be declared as a B
                }
                else {
                        // a123 can be declared as a B, so go ahead and do it.
                        a123.addRDFType( B );
                }
        }
}

Sorry for the earlier confusion.


>
> -----Original Message-----
> From: Joshua TAYLOR [mailto:[email protected]]
> Sent: Friday, February 22, 2013 11:41 AM
> To: [email protected]
> Subject: Re: testing whether an instance could be associated with a 
> class
>
>> -----Original Message-----
>> From: Joshua TAYLOR [mailto:[email protected]]
>> Sent: Friday, February 22, 2013 10:26 AM
>> To: [email protected]
>> Subject: Re: testing whether an instance could be associated with a 
>> class
>>
>> On Fri, Feb 22, 2013 at 9:38 AM, David Jordan <[email protected]> wrote:
>>> I have a question about how to express something in Jena. Assume we have an 
>>> individual a that is of type A, where A would actually be a collection of 
>>> classes and subclasses. Also assume we have a class B that has been 
>>> defined. B may include some class restrictions that place constraints on 
>>> which resources can be instances of that class. As a simple case, B may be 
>>> defined as disjoint with A. What would be the means of asking whether 
>>> individual a can be of class B based on currently defined constraints?
>>>
>>> Individual.addOntClass returns void and throws no exception, so that would 
>>> not seem to work.
>>>
>>> Would another approach be to get the OntClasses associated with individual 
>>> a and then calling OntClass.isDisjointWith?
>>
>> Even using OntClass#isDisjointWith is unlikely to work except in the case of 
>> explicit disjointness declarations, unless you have a reasoner running.  
>> With a reasoner running, you could ask whether B is disjoint from A.  Even 
>> so, it might not be consistent for *some particular* instance of B to be an 
>> instance of A, even if A and B aren't, in general disjoint.
>>
>> Once you've got a reasoner running:
>>
>> * You could check whether A and B are disjoint.
>> * You could check whether a *some particular instance* of B is an instance 
>> of *the complement of A* (i.e., not A).  If the reasoner can guarantee that 
>> it is, then (since it can't be an instance of A and of not A), then that 
>> instance can't be an instance of A.
>>
>> I know the Jena rule-based reasoners aren't complete for OWL, so I 
>> don't know whether they'll cover these cases or not.  Others (e.g.,
>> Pellet) are available that should cover these cases.
>
> On Fri, Feb 22, 2013 at 11:04 AM, David Jordan <[email protected]> wrote:
>>
>> Suppose class B includes a restriction that states that a property cannot 
>> include a particular value x. An individual a may have that property with 
>> the value x. I don't understand how your suggestions would cover that case. 
>> And assume there is a reasoned involved.
>
> Forgive me, but I don't understand how that case relates to the original 
> question, which I think had two possible interpretations:
> * check whether "Some B's could be A's"
> * check whether "some particular B, say, b34, could be an A"
>
> Suppose "B includes a restriction that states that a property cannot include 
> a particular value x".
>
> If some individual a23 has x as a value for that property, then a23 cannot be 
> a B.  A reasoner could confirm that.
>
> That doesn't say anything about whether "some B's could be A's".
> It doesn't say anything about whether "some particular B, say, b34, could be 
> an A"
>
> Do you have a particular example at hand that you can share?
>
> //JT
>
> --
> Joshua Taylor, http://www.cs.rpi.edu/~tayloj/
>



--
Joshua Taylor, http://www.cs.rpi.edu/~tayloj/

Reply via email to