Thanks for clarifying this.

On Feb 22, 2013, at 5:10 PM, Dave Reynolds wrote:

> In essence yes, the reasoner is looking for all types that can be deduced 
> about a123, and it is expensive.
> 
> For the rule based reasoners, which aren't that fast, they mix forward and 
> backward reasoning so part of the work is only done when you ask a specific 
> question.
> 
> However, there is a difference between being able to deduce that a123 is also 
> a member of B or not-B and there being no contradiction between it being so. 
> Suppose class A is "Person" and class B is "Tall" but neither have any 
> interesting restrictions. If all we know about a123 is that they are a Person 
> and have a name then there is no problem them being in Tall or being in 
> not-Tall, no contradiction. But we don't know either way - we can't deduce 
> a123 rdf:type Tall nor a123 rdf:type not-Tall without more data (like their 
> height) and more constraints on what can be in Tall.
> 
> So if you want to ask "is it OK for this to also be a B" then you have to 
> trying making it a B and using validate to look for a contradiction.
> 
> Whereas if you want to ask "can we deduce that this must be B as well" then 
> you ask if it has (inferred) type B.
> 
> Dave
> 
> On 22/02/13 18:08, David Jordan wrote:
>> 
>> Sorry, I'd like to be sure I understand this.
>> Specifically, the call
>>      a123.hasRDFType( notB )
>> I would have thought that hasRDFType() would be checking for declarations of 
>> the form
>> :a123 rdf:type :XXX .
>> 
>> So when one creates a the complement class
>> OntClass notB = model.createComplementClass( null, B );
>> Does the reasoner automatically examine all instances and determine whether 
>> they should have a declaration that they are of the type notB and create the 
>> triple??? If so, I assume you would DEFINITELY want to do this in a separate 
>> model with just the one instance, otherwise performance is going to be 
>> awful. Right?
>> 
>> 
>> 
>> -----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