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] Exception on SWRL Query (correction)

Martin O'Connor martin.oconnor at stanford.edu
Thu Jan 3 10:26:48 PST 2008


I think you will need to use your existing factory approach [1]:

OWLModel owlModelA = ... // Ontology containing individuals

OWLModel owlModelR = ... // Ontology containing SWRL rules

SWRLFactory factoryA = new SWRLFactory(owlModelA);

SWRLRuleEngine ruleEngine = SWRLRuleEngineFactory.create(owlModelA);

factoryA.copyImps(owlModelR); // Add rules from ontology R to ontology A. 

ruleEngine.infer(); // Do inference

factoryA.deleteImps(); // Remove rules from ontology A

You can then save ontology A. 

I don't know of any convenient way of doing this at the GUI.

Martin


[1] http://protege.cim3.net/cgi-bin/wiki.pl?SWRLFactoryFAQ#nid8GX


Ely Edison Matos wrote:

>Hello,
>Thanks Martin. What I exactly need is:
>- I have a base ontology A, with individuals
>- I have a rule ontology R, with rules
>- I need apply the rules from R in A. This fills some properties of 
>individuals in A. Then I need to save the ontology A (with old and new 
>information). I don't need any vestiges from swrl in ontology A.
>
>This is what I am not getting...:-)
>
>Thanks,
>Ely
>
>----- Original Message ----- 
>From: "Martin O'Connor" <martin.oconnor at stanford.edu>
>
>  
>
>>Could you not simply create a third ontology that imports the base
>>ontology and the rules ontology? You can then load this ontology, run
>>the rules, and save the results.
>>
>>Martin
>>
>>
>>Quoting Ely Edison Matos <ely.matos at ufjf.edu.br>:
>>
>>    
>>
>>>Hello,
>>>Thanks Martin for answer.
>>>I don't know exactly the problem. I have a "base" ontology that imports a
>>>"rule" ontology (a owl file with just swrl rules). As I need to save the
>>>results of rules execution, I was saving the "base" ontology (in code, 
>>>after
>>>re-get the classes with owlModel.getUserDefinedOWLNamedClasses()). But 
>>>this
>>>save the swrl rules _inside_ the same owl file (its seems that it
>>>"incorporate" the rules in the ontology, although it was a imported
>>>ontology). So, when I tried to execute the rules again (inside Protege) I
>>>receive that messages.
>>>
>>>Now, I'm not importing the rules ontology. I'm using the SWRLFactory rule
>>>replacement mechanism [1]. I load the base ontology, insert the rules
>>>(factory.copyImps), execute Jess, and delete the rules
>>>(factory.deleteImps)...A bit idiot, but it's working as I need. If anyone
>>>has suggestions, I accept..:-))
>>>
>>>Thanks,
>>>Ely
>>>
>>>[1] http://protege.cim3.net/cgi-bin/wiki.pl?SWRLFactoryFAQ#nid8GX
>>>
>>>
>>>----- Original Message -----
>>>From: "Martin O'Connor" <martin.oconnor at stanford.edu>
>>>To: "Ely Edison Matos" <ely.matos at ufjf.edu.br>; "User support for the
>>>Protege-OWL editor" <protege-owl at lists.stanford.edu>
>>>Sent: Friday, December 28, 2007 6:41 PM
>>>Subject: Re: [protege-owl] Exception on SWRL Query (correction)
>>>
>>>
>>>      
>>>
>>>>Have you run the ontology through the OWL validator [1] to determine
>>>>that it is valid OWL DL? Exceptions like these are often caused by OWL
>>>>Full constructs in the OWL file. Send me the OWL files if you cannot
>>>>find the source of the problem.
>>>>
>>>>Martin
>>>>
>>>>[1] http://www.mygrid.org.uk/OWL/Validator
>>>>
>>>>Ely Edison Matos wrote:
>>>>
>>>>        
>>>>
>>>>>Correcting the rule:
>>>>>Hello,
>>>>>I'm trying to run a simple SWRL query (Protege 3.4 build 122)
>>>>>
>>>>>imp:Unit(?x) -> sqwrl:select(?x)
>>>>>
>>>>>where imp: is a ontology with Named Classes (like Unit) imported by 
>>>>>the
>>>>>current ontology (which has Individuals from Unit). Nothing happens at
>>>>>          
>>>>>
>>>GUI
>>>      
>>>
>>>>>and at log window I have a Warning (below).
>>>>>
>>>>>Some light on this? Are there some problem on use SWRL Query with
>>>>>          
>>>>>
>>>imported
>>>      
>>>
>>>>>ontologies?
>>>>>
>>>>>Thanks,
>>>>>Ely
>>>>>
>>>>>
>>>>>WARNING: Exception caught by default exception handler --
>>>>>java.lang.ClassCastException:
>>>>>edu.stanford.smi.protegex.owl.model.impl.DefaultOWLUnionClass cannot 
>>>>>be
>>>>>cast to edu.stanford.smi.protegex.owl.model.RDFSNamedClass          at
>>>>>
>>>>>          
>>>>>
>>>>edu.stanford.smi.protegex.owl.model.impl.AbstractOWLModel.getRDFSNamedClass
>>>>        
>>>>
>>>(
>>>      
>>>
>>>>>Unknown Source)  at
>>>>>edu.stanford.smi.protegex.owl.swrl.util.SWRLOWLUtil.getRDFSNamedClass
>>>>>(Unknown Source)  at
>>>>>edu.stanford.smi.protegex.owl.swrl.bridge.impl.AbstractSWRLRuleEngine
>>>>>Bridge.importOWLClass(Unknown Source)         at
>>>>>edu.stanford.smi.protegex.owl.swrl.bridge.impl.AbstractSWRLRuleEngine
>>>>>Bridge.importOWLClasses(Unknown Source)          at
>>>>>edu.stanford.smi.protegex.owl.swrl.bridge.impl.AbstractSWRLRuleEngine
>>>>>Bridge.importOWLPropertyAssertionAxioms(Unknown Source)          at
>>>>>edu.stanford.smi.protegex.owl.swrl.bridge.impl.AbstractSWRLRuleEngine
>>>>>Bridge.importOWLPropertyAssertionAxioms(Unknown Source)          at
>>>>>edu.stanford.smi.protegex.owl.swrl.bridge.impl.AbstractSWRLRuleEngine
>>>>>Bridge.importSWRLRulesAndOWLKnowledge(Unknown Source)          at
>>>>>edu.stanford.smi.protegex.owl.swrl.bridge.impl.AbstractSWRLRuleEngine
>>>>>Bridge.importSWRLRulesAndOWLKnowledge(Unknown Source)          at
>>>>>edu.stanford.smi.protegex.owl.swrl.bridge.impl.AbstractSWRLRuleEngine
>>>>>Bridge.runSQWRLQueries(Unknown Source)          at
>>>>>edu.stanford.smi.protegex.owl.swrl.sqwrl.ui.SQWRLQueryControlPanel$Ru
>>>>>nActionListener.actionPerformed(Unknown Source)          at
>>>>>javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1995)
>>>>>at
>>>>>
>>>>>          
>>>>>
>>>>javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2318
>>>>        
>>>>
>>>)
>>>      
>>>
>>>>>at
>>>>>javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel
>>>>>.java:387)          at
>>>>>
>>>>>avax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:242   
>>>>>)
>>>>>at
>>>>>
>>>>>          
>>>>>
>>>>javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListene
>>>>        
>>>>
>>>r
>>>      
>>>
>>>>>.java:236)         at
>>>>>java.awt.AWTEventMulticaster.mouseReleased(AWTEventMulticaster.java:272)
>>>>>at java.awt.Component.processMouseEvent(Component.java:6100)         at
>>>>>javax.swing.JComponent.processMouseEvent(JComponent.java:3265) 
>>>>>at
>>>>>java.awt.Component.processEvent(Component.java:5865)          at
>>>>>java.awt.Container.processEvent(Container.java:2058)          at
>>>>>java.awt.Component.dispatchEventImpl(Component.java:4472)
>>>>>        at java.awt.Container.dispatchEventImpl(Container.java:2116)
>>>>>at java.awt.Component.dispatchEvent(Component.java:4302)          at
>>>>>java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4322  
>>>>>)
>>>>>at
>>>>>java.awt.LightweightDispatcher.processMouseEvent(Container.java:3986)
>>>>>        at
>>>>>java.awt.LightweightDispatcher.dispatchEvent(Container.java:3916)
>>>>>        at java.awt.Container.dispatchEventImpl(Container.java:2102)
>>>>>        at java.awt.Window.dispatchEventImpl(Window.java:2440)
>>>>>        at java.awt.Component.dispatchEvent(Component.java:4302)
>>>>>        at java.awt.EventQueue.dispatchEvent(EventQueue.java:599)
>>>>>at
>>>>>
>>>>>          
>>>>>
>>>>java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.jav
>>>>        
>>>>
>>>a
>>>      
>>>
>>>>>:273)         at
>>>>>java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.
>>>>>java:183)      at
>>>>>
>>>>>          
>>>>>
>>>>java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.jav
>>>>        
>>>>
>>>a
>>>      
>>>
>>>>>:173)          at
>>>>>java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:168)
>>>>>at
>>>>>java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:160)
>>>>>at java.awt.EventDispatchThread.run(EventDispatchThread.java:121)
>>>>>
>>>>>_______________________________________________
>>>>>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
>>>      
>>>
>>>>>
>>>>>          
>>>>>
>>>_______________________________________________
>>>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
>>>
>>>      
>>>
>>
>>_______________________________________________
>>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 
>>    
>>
>
>_______________________________________________
>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