[Pellet-users] Pellet cache free

Evren Sirin evren at clarkparsia.com
Thu Oct 4 14:14:44 UTC 2007


On 10/4/07 10:07 AM, Nick Drummond wrote:
> Evren,
>
> Does this mean that classify() must be called to force a new  
> classification or does pellet try to keep up with all changes as they  
> happen?
>   
Pellet will update some of its internal structures when changes happen 
but it won't do a full classification. Classification will happen next 
time classify() or a function that requires classification (e.g. 
getSubClasses) is called.

Cheers,
Evren
> Cheers for your help
>
> Nick
>
> On 4 Oct 2007, at 13:13, Evren Sirin wrote:
>
>   
>> On 10/3/07 10:29 AM, Nick Drummond wrote:
>>     
>>> Hi Evren,
>>>
>>> I've had a bug report about caching pellet results in Protege4.0.
>>> I wrote a bit of test code to see what was happening with pellet   
>>> (below).
>>>
>>> It seems that to get pellet to drop the previous results and   
>>> recalculate, I need to call Reasoner.refresh(), which is not a  
>>> part  of the OWL API.
>>> Could the reasoner listen to changes in the ontology and set a   
>>> refreshRequired flag to perform this refresh when classify() is   
>>> subsequently called?
>>>
>>>       
>> Pellet reasoner implements the OntologyChangeListener interface but  
>> does not add itself automatically as a listener. This is left as an  
>> option to the user because some applications might prefer to do  
>> manual/scheduled synchronization. In your case, if you simply add  
>> the line:
>>
>> mngr.addOntologyChangeListener( r );
>>
>> after the reasoner is created you will see that results from the  
>> reasoner reflect the latest changes. Depending on the type of the  
>> change (add/remove) and axiom (subclass, subproperty, etc.),  
>> applying the changes might require full reload so the time it takes  
>> to apply the changes will vary greatly.
>>
>> Cheers,
>> Evren
>>     
>>> I know this behaviour isn't specified in the OWLAPI docs.
>>>
>>> Cheers
>>>
>>> Nick
>>>
>>>      public void testPelletReload(){
>>>          OWLOntologyManager mngr =  
>>> OWLManager.createOWLOntologyManager ();
>>>          try {
>>>              OWLOntology ont = mngr.createOntology(URI.create 
>>> ("http:// www.co-ode.org/ontologies/test/test.owl"));
>>>              OWLDataFactory df = mngr.getOWLDataFactory();
>>>              OWLClass a = df.getOWLClass(URI.create("http:// 
>>> www.co- ode.org/ontologies/test/test.owl#A"));
>>>              OWLClass b = df.getOWLClass(URI.create("http:// 
>>> www.co- ode.org/ontologies/test/test.owl#B"));
>>>              OWLSubClassAxiom bSubA = df.getOWLSubClassAxiom(b, a);
>>>              List<OWLOntologyChange> changes = new   
>>> ArrayList<OWLOntologyChange>();
>>>              changes.add(new AddAxiom(ont, bSubA));
>>>              mngr.applyChanges(changes);
>>>
>>>              Reasoner r = new Reasoner(mngr);
>>>              r.loadOntology(ont);
>>>              r.classify();
>>>
>>>              Set<Set<OWLClass>> results = r.getSubClasses(a);
>>>              for (Set<OWLClass> result : results){
>>>                  System.out.println("result = " + result);
>>>              }
>>>
>>>              changes.clear();
>>>              changes.add(new RemoveAxiom(ont, bSubA));
>>>              mngr.applyChanges(changes);
>>>
>>> //            r.refresh(); // calling this prevents the problem
>>>              r.classify();
>>>
>>>              results = r.getSubClasses(a); // still contains B
>>>              for (Set<OWLClass> result : results){
>>>                  System.out.println("result = " + result);
>>>              }
>>>
>>>          }
>>>          catch (OWLOntologyCreationException e) {
>>>              logger.error(e);
>>>              fail();
>>>          }
>>>          catch (OWLOntologyChangeException e) {
>>>              logger.error(e);
>>>              fail();
>>>          }
>>>      }
>>>
>>> _______________________________________________
>>> Pellet-users mailing list
>>> Pellet-users at lists.owldl.com
>>> http://lists.owldl.com/mailman/listinfo/pellet-users
>>> _______________________________________________
>>>
>>> Sponsored by Clark & Parsia, LLC http://clarkparsia.com/
>>>
>>>       
>
> _______________________________________________
> Pellet-users mailing list
> Pellet-users at lists.owldl.com
> http://lists.owldl.com/mailman/listinfo/pellet-users
> _______________________________________________
>
> Sponsored by Clark & Parsia, LLC http://clarkparsia.com/
>   



More information about the Pellet-users mailing list