[Pellet-Users] validate()! errata corrige

Evren Sirin evren at cs.umd.edu
Mon Sep 18 22:50:36 EDT 2006


You seem to be continuously adding new statements to the model but never 
removing anything (you might think model.reset() is doing that but all 
it does is to remove internal caches). Once the model becomes 
inconsistent there is no turning back unless you remove the 
contradictory statements. So you need to create a copy of the model at 
the beginning of the loop, modify it inside the loop and throw it away 
at the end of the loop. You might reuse the same model as long as it is 
consistent but definitely restart when the first inconsistency is found. 
Even a better solution would be create an anonymous class, e.g. 
intersection of subClassB and Restriction(prop1 
someValuesFrom(subClassA)), and check its satisfiability, e.g. in a Jena 
model you would check if it is a subclass of owl:Nothing. Such testing 
has no side effects on the model so you will never get an inconsistency 
in the model.

Regards,
Evren


Roberto Grimaldi wrote:
> Hi!
> First, subClasses is the array that lists all the
> subclasses of B;
> Second, i forgot "cl" in createindividual (see
> below)!
> (but this is not the problem in the code)
> Thanks and sorry!
>  
>   
>> --- Roberto Grimaldi <robymaldi at yahoo.it> ha
>> scritto: 
>>
>>     
>>> Hi!
>>> This is the problem i have:
>>> in my ontology i have a class "A" with a set of
>>> subclasses, and a class "B" with another set of
>>> subclasses. Each subclass of "B" has some
>>> restrictions. Class "B" defines two properties,
>>> prop1
>>> (functional) and prop2. I want to check if an
>>> individual "ind" of a subclass of "A" can be the
>>> property value of the property prop1 in one or
>>>       
>> more
>>     
>>> of
>>> the subclasses of "B".
>>> To do this i've written the following code:
>>>
>>> OntModel model = ModelFactory.createOntologyModel(
>>>       
>>  
>>     
>>>      PelletReasonerFactory.THE_SPEC );
>>> String ont = "file:/D:/Ontology.owl";
>>> model.read( ont );
>>>
>>> OntClass c = model.getOntClass( ns + B );
>>> RDFNode ind = model.getIndividual( ns + ind );
>>> Objectproperty prop1 = model.getObjectProperty( ns
>>>       
>> +
>>     
>>>      prop1 );
>>>
>>> for( int x = 0; x < subClasses.lenght; x++ ){
>>>     OntClass cl = model.getOntClass(ns +
>>> subClasses[x]
>>>   
>>>     );
>>>       
>> ********HERE**************
>>       Individual indiv = model.createIndividual( 
>>           "Individual", cl );
>> **************************
>>     
>>>     ind.setPropertyValue( prop1, ind );
>>>     ValidityReport validity = model.validate();
>>>     if( validity.isValid() ){
>>>         System.out.println( "OK" );
>>>         model.reset;
>>>     }
>>>     else{
>>>         model.reset;
>>>     }
>>> }
>>>
>>> The problem is that when the reasoner finds the
>>> first
>>> inconsistency, then it returns me always the same
>>> result, even if the individual satisfies the
>>> restrictions.
>>> Can someone please tell where did i do wrong?
>>> Thanks in advance,
>>> Rob
>>>
>>> P.S. Sorry for the other 3 mails, but i've got a
>>> problem with my internet connection!
>>>
>>> --- Bijan Parsia <bparsia at isr.umd.edu> ha scritto:
>>>       
>>>> Not sure what you mean. Species validate? Test
>>>>         
>> for
>>     
>>>> unsatisfiability?  
>>>> (Which is always a class level notion, but still
>>>> requires thinking  
>>>> about the whole ontology.) Not sure what the
>>>>         
>>> former
>>>       
>>>> would mean, and  
>>>> the later is definitely doable (and done).
>>>>
>>>> Cheers,
>>>> Bijan.
>>>>
>>>>         
>>> __________________________________________________
>>> Do You Yahoo!?
>>> Poco spazio e tanto spam? Yahoo! Mail ti protegge
>>> dallo spam e ti da tanto spazio gratuito per i
>>>       
>> tuoi
>>     
>>> file e i messaggi 
>>> http://mail.yahoo.it 
>>> _______________________________________________
>>> Pellet-Users mailing list
>>> Pellet-Users at lists.mindswap.org
>>>
>>>       
> http://lists.mindswap.org/mailman/listinfo/pellet-users
>   
>> __________________________________________________
>> Do You Yahoo!?
>> Poco spazio e tanto spam? Yahoo! Mail ti protegge
>> dallo spam e ti da tanto spazio gratuito per i tuoi
>> file e i messaggi 
>> http://mail.yahoo.it 
>>
>>     
>
>
>
> 	
>
> 	
> 		
> ___________________________________ 
> Yahoo! Mail: gratis 1GB per i messaggi e allegati da 10MB 
> http://mail.yahoo.it
> _______________________________________________
> Pellet-Users mailing list
> Pellet-Users at lists.mindswap.org
> http://lists.mindswap.org/mailman/listinfo/pellet-users
>   



More information about the Pellet-Users mailing list