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] Hi SWRL rules

Martin O'Connor martin.oconnor at stanford.edu
Mon Aug 24 11:39:31 PDT 2009


You need to set the -Dprotege.dir option to you VM so that Protege picks 
up the built-in ontologies in the repository [1]

You can use SQWRL[2] rewrite your rules as queries for debugging 
purposes, e.g.,

Person(?x) ^ hasSibling(?x, ?y) ^ Man(?x) -> sqwrl:seletc(?x, ?y)

As a general rule, I would create and debug the rules interactively 
before doing so programatically.

Martin

[1] 
http://protegewiki.stanford.edu/index.php/SetUpEclipseForPlugin#Using_in_the_run_configuration_the_protege.dir_java_argument
[2] http://protege.cim3.net/cgi-bin/wiki.pl?SQWRL

Antonio Astorga Rivera wrote:

>Hi Martin
>
>When I run my Project in Eclipse I have this output:
>
>WARNING: [Local Folder Repository] The specified file must be a directory.
>(C:\Documents and
>Settings\admin\workspace\ExampleRulesSWRL\plugins\edu.stanford.smi.protegex.
>owl) -- LocalFolderRepository.update()
>Loading triples from: null
>    Completed triple loading after 641 ms
>Importing http://swrl.stanford.edu/ontologies/built-ins/3.3/query.owl from
>location: http://swrl.stanford.edu/ontologies/built-ins/3.3/query.owl
>21-ago-2009 17:30:25
>edu.stanford.smi.protegex.owl.model.impl.AbstractOWLModel
>loadImportedAssertions
>INFO: Importing http://swrl.stanford.edu/ontologies/built-ins/3.3/query.owl
>from location: http://swrl.stanford.edu/ontologies/built-ins/3.3/query.owl
>Loading triples from:
>http://swrl.stanford.edu/ontologies/built-ins/3.3/query.owl
>    Completed triple loading after 0 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
>21-ago-2009 17:30:26
>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 16 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
>21-ago-2009 17:30:28
>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 0 ms
>Importing http://swrl.stanford.edu/ontologies/3.3/swrla.owl from location:
>http://swrl.stanford.edu/ontologies/3.3/swrla.owl
>21-ago-2009 17:30:29
>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 16 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
>21-ago-2009 17:30:31
>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 16 ms
>WARNING: The system cannot find the ontology http://www.w3.org/2003/11/swrl
>in any of the repositories. This import will be ignored. --
>UnresolvedImportUIHandler.handleUnresolvableImport()
>WARNING: The system cannot find the ontology http://www.w3.org/2003/11/swrlb
>in any of the repositories. This import will be ignored. --
>UnresolvedImportUIHandler.handleUnresolvableImport()
>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
>21-ago-2009 17:30:35
>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 0 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
>21-ago-2009 17:30:37
>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 15 ms
>Postprocess: Process entities with incorrect Java type (0 entities) ... 0 ms
>Postprocess: Process metaclasses (3 metaclasses) ... 0 ms
>Postprocess: Process subclasses of rdf:List (1 classes) ... 0 ms
>Postprocess: Instances with multiple types (35 instances) ... 0 ms
>Postprocess: Add inferred superclasses ... 16 ms
>Postprocess: Process orphan classes (27 classes) ... 0 ms
>Postprocess: Generalized Concept Inclusion (0 axioms) ... 0 ms
>Postprocess: Abstract classes... 0 ms
>Postprocess: Domain and range of properties... 0 ms
>Postprocess: Possibly typed entities (2 resources) ... 0 ms
>Updating underlying frames model in 0 ms
>21-ago-2009 17:30:38
>edu.stanford.smi.protegex.owl.jena.parser.ProtegeOWLParser
>doFinalPostProcessing
>INFO: Updating underlying frames model in 0 ms
>Rule engine 'SWRLJessBridge' registered with the SWRLTab bridge.
>21-ago-2009 17:30:38 edu.stanford.smi.protegex.owl.swrl.bridge.BridgeFactory
>registerBridge
>INFO: Rule engine 'SWRLJessBridge' registered with the SWRLTab bridge.
>Inferred Individuals :[]
>Class swrla:Entity (0)
>Class swrla:RuleGroup (0)
>Class temporal:Proposition (0)
>Class temporal:Entity (0)
>Class temporal:ExtendedProposition (0)
>Class temporal:ValidInstant (0)
>Class temporal:ValidTime (0)
>Class temporal:ValidPeriod (0)
>Class temporal:Granularity (7)
> - temporal:Hours
> - temporal:Minutes
> - temporal:Milliseconds
> - temporal:Seconds
> - temporal:Months
> - temporal:Days
> - temporal:Years
>Class Daugther (0)
>Class Child (0)
>Class Woman (10)
> - F03
> - F02
> - F01
> - F04
> - F05
> - F09
> - F08
> - F06
> - F10
> - F07
>Class Son (0)
>Class Parent (0)
>Class Person (0)
>Class Sibling (0)
>Class Sister (0)
>Class Brother (0)
>Class Man (10)
> - M01
> - M02
> - M05
> - M03
> - M04
> - M06
> - M09
> - M07
> - M08
> - M10
>Class Niece (0)
>Class Nephew (0)
>Class Relative (0)
>Class Uncle (0)
>Class Aunt (0)
>Class Mother (0)
>Class Gender (2)
> - Male
> - Female
>Class Father (0)
>
>First I don't understand the Warnings, and then I don't have any results in
>the inference, because after this I need to obtain the new ontology whit the
>new information, do I need to use a reasoner do to this? 
>And also to add more rules I need to do create more object
>
>SWRLImp imp = factory.createImp("Person(?x) ^ hasSibling(?x, ?y)
>  
>
>>^ Man(?x) -> hasBrother(?x,?y)");     
>>    
>>
>
>
> regards
>
>
>
>-----Mensaje original-----
>De: protege-owl-bounces at mailman.stanford.edu
>[mailto:protege-owl-bounces at mailman.stanford.edu] En nombre de Martin
>O'Connor
>Enviado el: viernes, 21 de agosto de 2009 17:14
>Para: User support for the Protege-OWL editor
>CC: 'User support for the Protege-OWL editor'
>Asunto: Re: [protege-owl] Hi SWRL rules
>
>The code below will execute SWRL rules and place the inferred knowledge 
>back into an OWL ontology and will also display the inferred knowledge.
>
>What else are you trying to do?.
>
>Martin
>
>Antonio Astorga Rivera wrote:
>  
>
>>Hi
>>I need help; I'm trying to make a simple java program with only one
>>    
>>
>SWRLrule
>  
>
>>using the ontology example family.swrl.owl.
>>The rule is one of that is provided in the example, but now to understand
>>the process without using the Protége software, I'm doing these.
>>So I have this code but I don't know what is the next step to obtain the
>>inference and the applied these in the ontology, also to call Jess to help
>>in this, somebody could help me?
>>This is the code
>>
>>import java.io.FileInputStream;
>>import java.io.FileNotFoundException;
>>import java.util.Collection;
>>import java.util.Iterator;
>>
>>import edu.stanford.smi.protege.exception.OntologyLoadException;
>>import edu.stanford.smi.protegex.owl.jena.JenaOWLModel;
>>import edu.stanford.smi.protegex.owl.model.OWLIndividual;
>>import edu.stanford.smi.protegex.owl.model.OWLModel;
>>import edu.stanford.smi.protegex.owl.model.OWLNamedClass;
>>import
>>
>>    
>>
>edu.stanford.smi.protegex.owl.swrl.bridge.exceptions.SWRLRuleEngineBridgeExc
>  
>
>>eption;
>>import edu.stanford.smi.protegex.owl.swrl.bridge.jess.SWRLJessBridge;
>>import edu.stanford.smi.protegex.owl.swrl.model.SWRLAtomList;
>>import edu.stanford.smi.protegex.owl.swrl.model.SWRLFactory;
>>import edu.stanford.smi.protegex.owl.swrl.model.SWRLImp;
>>import edu.stanford.smi.protegex.owl.swrl.model.SWRLVariable;
>>import edu.stanford.smi.protegex.owl.swrl.parser.SWRLParseException;
>>import edu.stanford.smi.protegex.owl.ProtegeOWL;
>>
>>
>>public class ExampleRulesSWRL {
>>	public static void main(String[] args) throws OntologyLoadException,
>>FileNotFoundException, SWRLRuleEngineBridgeException, SWRLParseException {
>>		
>>		FileInputStream input=new
>>FileInputStream("C:/Toño/Ontologias/SWRL/family.swrl.owl");
>>   		JenaOWLModel owlModel =
>>ProtegeOWL.createJenaOWLModelFromInputStream(input);
>>		jess.Rete testrete = new jess.Rete();
>>		SWRLJessBridge bridge=new SWRLJessBridge
>>(owlModel,testrete);
>>			
>>	     //  OWLModel owlModel =
>>ProtegeOWL.createJenaOWLModelFromURI(uri);
>>	      SWRLFactory factory = new SWRLFactory(owlModel);
>>
>>	      // SWRLVariable x = factory.createVariable("x");
>>	    //   SWRLVariable y = factory.createVariable("y");
>>	    //   SWRLVariable z = factory.createVariable("z");
>>	       	       
>>
>>	              
>>	   SWRLImp imp = factory.createImp("Person(?x) ^ hasSibling(?x, ?y)
>>^ Man(?x) -> hasBrother(?x,?y)");     
>>	   bridge.resetRuleEngine();
>>		bridge.infer();   
>>		System.out.println("Inferred Individuals
>>:"+bridge.getInferredIndividuals());
>>	       	        
>>	       
>>	        Collection classes =
>>owlModel.getUserDefinedOWLNamedClasses();
>>	        for (Iterator it = classes.iterator(); it.hasNext();) {
>>	            OWLNamedClass cls = (OWLNamedClass) it.next();
>>	            Collection instances = cls.getInstances(false);
>>	            System.out.println("Class " + cls.getBrowserText() + "
>>(" + instances.size() + ")");
>>	            for (Iterator jt = instances.iterator(); jt.hasNext();)
>>{
>>	                OWLIndividual individual = (OWLIndividual)
>>jt.next();
>>	                System.out.println(" - " +
>>individual.getBrowserText());
>>	            }
>>	        }
>>	        
>>	    }
>>	
>>	
>>}
>>
>>
>>
>>
>>_______________________________________________
>>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