[Pellet-users] [Fwd: Re: Code examples using SWRL and Pellet - second try]

Evren Sirin evren at clarkparsia.com
Fri Jan 19 15:00:33 UTC 2007


On 1/19/07 5:37 AM, Paolo Bussotti wrote:
> Hi, everybody:
> In the code example  provided in the mail I'm referring to, there is a 
> static class RuleUtils in the line:
>
> Set rules = RuleUtils.parseRules( rulesFile );
>
> which I cannot find in any file .jar either in Pellet (1.3) or in the 
> owlapi.
I was referring to the Pellet-1.4RC1 release which you can download from 
http://pellet.owldl.com.
> Since mention is made to the fact that this  portion of code is taken 
> from the file Pellet.java - where RuleUtils is not present - I think 
> that RuleUtils may be a class which is defined and used only to the 
> extent of this simplified code, and must be reconstructed from scratch 
> from the code of  Pellet.java (where the parseRule function etc. is 
> explicitly made on the basis of SWRLParser in rules.jar.
The parseUtils() function inside Pellet.java of version 1.3 is nearly 
identical. This function was moved outside so you can run Pellet without 
OWL-API jar files being on the classpath if you don't need DL-safe rules.
> I'm I wrong? or do I use an obsolete (1.3) version of Pellet?
Version 1.3 is quite old and we have fixed a lot of bugs and added new 
features since then. There were some bugs found in 1.4-RC1 which are now 
fixed in SVN. The final release will be out soon.
>
> Another thing: why I do not manage to run ontology and rules through 
> the command-line pellet.bat by using -dlsafe as in the example of  
> Vlad Kolovski?
> The results seem to show that the system is not capable to rightly 
> interpret SWRL, since all swrl: elements are reported as "untyped", 
> and I'm advised to provide a type for them. In effects, pellet 
> automatically assumes that the various swrl elements are either 
> individual, classes or properties, apparently not taking into acccount 
> for the SWRL entities such as class/individualproperty atoms, 
> body/head and so on.
This is the problem I mentioned in my previous file. The reasoner thinks 
the terms that are part of SWRL syntax are also ordinary classes and 
properties and tries to validate them. As Matthew said, the next version 
of OWLAPI will fix this problem and you won't see thee messages anymore. 
For now, you can just ignore these messages.
> Does it depends on the enabling/not enabling of the "-econn" flag?, 
> since pellet.bat says that it enables dlsafe managing of rules?
No, they have no connection whatsoever. It was a typo in the help screen 
which is fixed now.
>
> I thank you in advance (and I.m trying to programm myself a RuleUtils 
> class, based on the element of Pellet.java)
Hope this helps,
Evren
> Paolo Bussotti.                 
> ------------------------------------------------------------------------
>
> Subject:
> Re: [Pellet-users] Code examples using SWRL and Pellet - second try
> From:
> Matthew Horridge <matthew.horridge at cs.man.ac.uk>
> Date:
> Mon, 15 Jan 2007 19:09:36 +0000
> To:
> pellet-users at lists.owldl.com
>
> To:
> pellet-users at lists.owldl.com
>
>
> Just to keep everyone updated, the next version of the OWLAPI (not  
> yet available) will have SWRL syntax support out of the box (SWRL  
> rules in RDF/XML format will be parsed without swrl:Imp etc. etc.  
> ending up as "junk" in the ontology).
>
> Cheers,
>
> Matthew
>
>   
>> Well, we don't have any code examples other than what is in  
>> Pellet.java
>> (the command-line version). Here is a general outline of how it works:
>>
>>         // ontology and rules files
>>         String ontFile = "http://www.mindswap.org/~kolovski/ 
>> rules.owl";
>>         String rulesFile = ontFile;
>>
>>         // load the ontology
>>         Reasoner reasoner = new Reasoner();
>>         OWLOntology ont = OntologyHelper.getOntology(URI.create 
>> ( ontFile
>> ) );
>>         reasoner.setOntology( ont );
>>
>>         // load the rules
>>         Set rules = RuleUtils.parseRules( rulesFile );
>>         reasoner.getKB().setRules(rules);
>>
>>         // query the reasoner as usual
>>         String ns =
>> "http://www.mindswap.org/~edna/swoopRules/examples/lubm_owllog.owl#";
>>         OWLClass specialCourse = ont.getClass( URI.create( ns +
>> "SpecialCourse" ) ) ;
>>         Set specialCourses = reasoner.allInstancesOf( specialCourse );
>>         System.out.println( specialCourses );
>>
>> The only additional thing you do is the two lines under "load the  
>> rules"
>> comment. Rest is standard OWL-API code (you can use Jena for the rest
>> but the part about loading rules requires OWL-API).
>>
>> Unlike the example I use above, it is preferable to separate the
>> ontology file and and the rules (as in [1] and [2]) so the terms  
>> used in
>> SWRL syntax will not be treated as regular terms. If you put rules  
>> in a
>> different file you need to put an owl:imports to point to the ontology
>> where the terms are defined.
>>
>> Pellet does not help you in anyway to create or serialize your own  
>> SWRL
>> rules. The OWL-API extension we use (for parsing) should have support
>> for creation and serialization of rules. If you want a UI to do that,
>> you can use Swoop (see [3] for more information - remember to "Enable
>> rules" under "Advanced" menu) or Protege SWRL editor [4].
>>
>> Cheers,
>> Evren
>>
>> [1] http://www.mindswap.org/~edna/swoopRules/examples/ 
>> allogExampleO.owl
>> [2] http://www.mindswap.org/~edna/swoopRules/examples/ 
>> allogExampleR.owl
>> [3] http://www.mindswap.org/~edna/swoopRules
>> [4] http://protege.cim3.net/cgi-bin/wiki.pl?SWRLTab
>>
>> On 1/15/07 6:04 AM, Cristiane Yaguinuma wrote:
>>     
>>> Hello,
>>>
>>> Since it's been a week and no one answered me, I am sending this
>>> message again. I'd like to study some code examples that uses SWRL  
>>> and
>>> Pellet reasoner, since I could not find it in the documentation. It
>>> can be an example showing how to load SWRL rules in
>>> a Pellet reasoner, how to create rules, etc.
>>>
>>> Thanks and best regards,
>>>
>>> Cristiane Yaguinuma.
>>> _______________________________________________
>>> Pellet-users mailing list
>>> Pellet-users at lists.owldl.com
>>> http://lists.owldl.com/mailman/listinfo/pellet-users
>>>
>>>
>>>       
>> _______________________________________________
>> Pellet-users mailing list
>> Pellet-users at lists.owldl.com
>> http://lists.owldl.com/mailman/listinfo/pellet-users
>> _______________________________________________
>> Sponsored by Clark & Parsia, LLC &lt;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/
>
>   
> ------------------------------------------------------------------------
>
> _______________________________________________
> 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