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] Error while importing SWRL rules via bridge

Alvi aa396 at cam.ac.uk
Tue Aug 26 06:57:53 PDT 2008


Hi,

It seems that bridge.infer() is not doing any reasoning with SWRL rules
because I have certain properties that get populated with values on firing
the SWRL rules via the JessTab, but the same is not happening
programmatically with the program I sent in the first post in this thread.
For example, I have a rule:

hasWife(?x, ?y) -> hasSpouse(?x, ?y)  ^ hasSpouse(?y, ?x)

which populates the hasSpouse property of married individuals with the names
of their spouses on using the SWRLJess tab. The same is not happening with
bridge.infer().


Any help is greatly appreciated.

-atif

Alvi wrote:
> 
> Hi Martin,
> 
> I have sent you the ontology separately (Protege-OWL rev3.4_build505). I
> think there was an offending empty swrl rule that was causing the errors
> at the end. Now the output is only till:
> **************************************************
> [root at uranium Implementation]$ java SWRLexample
> WARNING: [Local Folder Repository] The specified file must be a directory.
> (/root/Desktop/Implementation/plugins/edu.stanford.smi.protegex.owl) --
> LocalFolderRepository.update()
> ...[omitted output same as before]...
> Aug 26, 2008 6:26:46 AM
> edu.stanford.smi.protegex.owl.jena.parser.ProtegeOWLParser
> doFinalPostProcessing
> INFO: Updating underlying frames model in 1 ms
> Rule engine 'SWRLJessBridge' registered with the SWRLTab bridge.
> Aug 26, 2008 6:26:46 AM
> edu.stanford.smi.protegex.owl.swrl.bridge.BridgeFactory registerBridge
> INFO: Rule engine 'SWRLJessBridge' registered with the SWRLTab bridge.
> [root at uranium Implementation]$   
> **************************************************
> I guess all the reasoning with SWRL rules is being done now. Correct?
> The first warning message doesn't go away still about local folder
> repository.
> 
> On a separate note, I read somewhere that using bridge.infer() also does
> reasoning that
> is normally associated with RacerPro or Pellet, and then does the SWRL
> reasoning. It seems so because there are messages about classification in
> the output of my program. So should we just invoke infer() multiple times
> to
> overcome the problem described here in 2nd paragraph:
> http://protege.cim3.net/cgi-bin/wiki.pl?SWRLRuleEngineBridgeFAQ#nid6QL
> 
> Thanks for your help. I really appreciate it.
> 
> -Atif
> 
> 
> Martin O'Connor wrote:
>> 
>> 
>> Can you forward me the offending OWL ontology. Are you using the latest 
>> build?
>> 
>> Martin
>> 
>>>
>>>
>>> ------------------------------------------------------------------------
>>>
>>> Subject:
>>> [protege-owl] Error while importing SWRL rules via bridge
>>> From:
>>> Alvi <aa396 at cam.ac.uk>
>>> Date:
>>> Mon, 25 Aug 2008 08:57:54 -0700 (PDT)
>>> To:
>>> protege-owl at lists.stanford.edu
>>>
>>> To:
>>> protege-owl at lists.stanford.edu
>>>
>>>
>>>Hi,
>>>
>>>I am new to programming with Protege-OWL API and am frustrated with an
error
>>>while trying to infer knowledge using the SWRL Rule Engine Bridge from a
>>>simple ontology with a few SWRL rules. Everything else works fine but at
the
>>>end the swrl rules are not imported, I guess, and hence no inference with
>>>them is possible. I am using v3.4beta of Protege-OWL. The code is:
>>>
>>>***************************************************************
>>>import edu.stanford.smi.protegex.owl.model.OWLModel;
>>>import edu.stanford.smi.protegex.owl.model.OWLNamedClass;
>>>import edu.stanford.smi.protegex.owl.ProtegeOWL;
>>>import edu.stanford.smi.protegex.owl.swrl.bridge.BridgeFactory;
>>>import edu.stanford.smi.protegex.owl.swrl.bridge.*;
>>>import
>>>edu.stanford.smi.protegex.owl.swrl.bridge.exceptions.SWRLRuleEngineBridgeException;
>>>import edu.stanford.smi.protegex.owl.swrl.model.*;
>>>import edu.stanford.smi.protegex.owl.model.*;
>>>import edu.stanford.smi.protegex.owl.swrl.bridge.jess.*;
>>>import java.io.*;
>>>import java.util.ArrayList;
>>>import java.util.Iterator;
>>>import jess.*;
>>>import java.util.Iterator;
>>>import java.util.Collection;
>>>
>>>public class SWRLexample {
>>>	public static void main(String[] args) throws
>>>SWRLRuleEngineBridgeException{
>>>		try{
>>>//			Can load either from URL by running the apache server, or from file
>>>			final String ONTOLOGY_URL = "http://127.0.0.1/SimpleOntology.owl";
>>>			// Load the ontology from the specified URL
>>>			OWLModel owlModel =
ProtegeOWL.createJenaOWLModelFromURI(ONTOLOGY_URL);			
>>>			//SWRLFactory factory = new SWRLFactory(owlModel);
>>>			SWRLRuleEngineBridge bridge = BridgeFactory.createBridge(owlModel);
>>>			bridge.infer();
>>>
>>>			//for bash script
>>>			System.exit(100);
>>>		}
>>>		catch(Exception e) {e.printStackTrace();}
>>>
>>>	}
>>>}
>>>
>>>**********************************************************************
>>>
>>>Running the program results in the following:
>>>
>>>**********************************************************************
>>>[root at uranium Implementation]$ java SWRLexample
>>>WARNING: [Local Folder Repository] The specified file must be a
directory.
>>>(/root/Desktop/Implementation/plugins/edu.stanford.smi.protegex.owl) --
>>>LocalFolderRepository.update()
>>>Loading triples from: http://127.0.0.1/SimpleOntology.owl
>>>    Completed triple loading after 605 ms
>>>Importing http://swrl.stanford.edu/ontologies/3.3/swrla.owl from
location:
>>>http://swrl.stanford.edu/ontologies/3.3/swrla.owl
>>>Aug 25, 2008 5:02:31 PM
>>>edu.stanford.smi.protegex.owl.model.impl.AbstractOWLModel
>>>loadImportedAssertions
>>>INFO: Importing http://swrl.stanford.edu/ontologies/3.3/swrla.owl from
>>>location: http://swrl.stanford.edu/ontologies/3.3/swrla.owl
>>>Loading triples from: http://swrl.stanford.edu/ontologies/3.3/swrla.owl
>>>    Completed triple loading after 10 ms
>>>Importing http://swrl.stanford.edu/ontologies/built-ins/3.3/swrlx.owl
from
>>>location: http://swrl.stanford.edu/ontologies/built-ins/3.3/swrlx.owl
>>>Aug 25, 2008 5:02:33 PM
>>>edu.stanford.smi.protegex.owl.model.impl.AbstractOWLModel
>>>loadImportedAssertions
>>>INFO: Importing
http://swrl.stanford.edu/ontologies/built-ins/3.3/swrlx.owl
>>>from location:
http://swrl.stanford.edu/ontologies/built-ins/3.3/swrlx.owl
>>>Loading triples from:
>>>http://swrl.stanford.edu/ontologies/built-ins/3.3/swrlx.owl
>>>    Completed triple loading after 8 ms
>>>Importing http://swrl.stanford.edu/ontologies/built-ins/3.3/abox.owl from
>>>location: http://swrl.stanford.edu/ontologies/built-ins/3.3/abox.owl
>>>Aug 25, 2008 5:02:34 PM
>>>edu.stanford.smi.protegex.owl.model.impl.AbstractOWLModel
>>>loadImportedAssertions
>>>INFO: Importing
http://swrl.stanford.edu/ontologies/built-ins/3.3/abox.owl
>>>from location: http://swrl.stanford.edu/ontologies/built-ins/3.3/abox.owl
>>>Loading triples from:
>>>http://swrl.stanford.edu/ontologies/built-ins/3.3/abox.owl
>>>    Completed triple loading after 15 ms
>>>Importing http://swrl.stanford.edu/ontologies/built-ins/3.3/tbox.owl from
>>>location: http://swrl.stanford.edu/ontologies/built-ins/3.3/tbox.owl
>>>Aug 25, 2008 5:02:35 PM
>>>edu.stanford.smi.protegex.owl.model.impl.AbstractOWLModel
>>>loadImportedAssertions
>>>INFO: Importing
http://swrl.stanford.edu/ontologies/built-ins/3.3/tbox.owl
>>>from location: http://swrl.stanford.edu/ontologies/built-ins/3.3/tbox.owl
>>>Loading triples from:
>>>http://swrl.stanford.edu/ontologies/built-ins/3.3/tbox.owl
>>>    Completed triple loading after 24 ms
>>>Importing http://swrl.stanford.edu/ontologies/built-ins/3.4/swrlm.owl
from
>>>location: http://swrl.stanford.edu/ontologies/built-ins/3.4/swrlm.owl
>>>Aug 25, 2008 5:02:36 PM
>>>edu.stanford.smi.protegex.owl.model.impl.AbstractOWLModel
>>>loadImportedAssertions
>>>INFO: Importing
http://swrl.stanford.edu/ontologies/built-ins/3.4/swrlm.owl
>>>from location:
http://swrl.stanford.edu/ontologies/built-ins/3.4/swrlm.owl
>>>Loading triples from:
>>>http://swrl.stanford.edu/ontologies/built-ins/3.4/swrlm.owl
>>>    Completed triple loading after 7 ms
>>>Importing http://swrl.stanford.edu/ontologies/built-ins/3.3/temporal.owl
>>>from location:
>>>http://swrl.stanford.edu/ontologies/built-ins/3.3/temporal.owl
>>>Aug 25, 2008 5:02:37 PM
>>>edu.stanford.smi.protegex.owl.model.impl.AbstractOWLModel
>>>loadImportedAssertions
>>>INFO: Importing
>>>http://swrl.stanford.edu/ontologies/built-ins/3.3/temporal.owl from
>>>location: http://swrl.stanford.edu/ontologies/built-ins/3.3/temporal.owl
>>>Loading triples from:
>>>http://swrl.stanford.edu/ontologies/built-ins/3.3/temporal.owl
>>>    Completed triple loading after 37 ms
>>>Importing http://sqwrl.stanford.edu/ontologies/built-ins/3.4/sqwrl.owl
from
>>>location: http://sqwrl.stanford.edu/ontologies/built-ins/3.4/sqwrl.owl
>>>Aug 25, 2008 5:02:39 PM
>>>edu.stanford.smi.protegex.owl.model.impl.AbstractOWLModel
>>>loadImportedAssertions
>>>INFO: Importing
http://sqwrl.stanford.edu/ontologies/built-ins/3.4/sqwrl.owl
>>>from location:
http://sqwrl.stanford.edu/ontologies/built-ins/3.4/sqwrl.owl
>>>Loading triples from:
>>>http://sqwrl.stanford.edu/ontologies/built-ins/3.4/sqwrl.owl
>>>    Completed triple loading after 16 ms
>>>Postprocess: Process entities with incorrect Java type (10 entities) ...
0
>>>ms
>>>Postprocess: Process metaclasses (3 metaclasses) ... 0 ms
>>>Postprocess: Process subclasses of rdf:List (1 classes) ... 1 ms
>>>Postprocess: Instances with multiple types (60 instances) ... 7 ms
>>>Postprocess: Add inferred superclasses ... 0 ms
>>>Postprocess: Process orphan classes (54 classes) ... 4 ms
>>>Postprocess: Generalized Concept Inclusion (0 axioms) ... 0 ms
>>>Postprocess: Abstract classes... 0 ms
>>>Postprocess: Domain and range of properties... 32 ms
>>>Postprocess: Possibly typed entities (0 resources) ... 0 ms
>>>Updating underlying frames model in 1 ms
>>>Aug 25, 2008 5:02:39 PM
>>>edu.stanford.smi.protegex.owl.jena.parser.ProtegeOWLParser
>>>doFinalPostProcessing
>>>INFO: Updating underlying frames model in 1 ms
>>>Rule engine 'SWRLJessBridge' registered with the SWRLTab bridge.
>>>Aug 25, 2008 5:02:39 PM
>>>edu.stanford.smi.protegex.owl.swrl.bridge.BridgeFactory registerBridge
>>>INFO: Rule engine 'SWRLJessBridge' registered with the SWRLTab bridge.
>>>java.lang.NullPointerException
>>>        at
>>>edu.stanford.smi.protegex.owl.swrl.bridge.impl.AbstractSWRLRuleEngineBridge.importSWRLRule(Unknown
>>>Source)
>>>        at
>>>edu.stanford.smi.protegex.owl.swrl.bridge.impl.AbstractSWRLRuleEngineBridge.importSWRLRules(Unknown
>>>Source)
>>>        at
>>>edu.stanford.smi.protegex.owl.swrl.bridge.impl.AbstractSWRLRuleEngineBridge.importSWRLRulesAndOWLKnowledge(Unknown
>>>Source)
>>>        at
>>>edu.stanford.smi.protegex.owl.swrl.bridge.impl.AbstractSWRLRuleEngineBridge.infer(Unknown
>>>Source)
>>>        at
>>>edu.stanford.smi.protegex.owl.swrl.bridge.impl.AbstractSWRLRuleEngineBridge.infer(Unknown
>>>Source)
>>>        at SWRLexample.main(SWRLexample.java:63)
>>>[root at uranium Implementation]$ 
>>>
>>>**********************************************************************
>>>So, Rule engine 'SWRLJessBridge' registers with the SWRLTab bridge but
then
>>>I get a null pointer exception while importing SWRL rules. I have omitted
a
>>>few comments, so the error at line 63 in the output is actually the
>>>statement bridge.infer();
>>>
>>>Thanks in advance for any help.
>>>
>>>-Atif
>>>
>>>  
>>>
>> 
>> _______________________________________________
>> 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 
>> 
>> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Error-while-importing-SWRL-rules-via-bridge-tp19145871p19162628.html
Sent from the Protege - OWL mailing list archive at Nabble.com.




More information about the protege-owl mailing list