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] SWRL rule -- infer(string)

Martin O'Connor martin.oconnor at stanford.edu
Wed Oct 29 07:51:52 PDT 2008


infer() does not take a rule as a parameter [1,2].

You can use the SWRLFactory to create rules programatically [3].

Martin

Quoting Koosha <koosha.g at gmail.com>:


[1] http://protege.cim3.net/cgi-bin/wiki.pl?SWRLRuleEngineBridgeFAQ
[2]  
http://protege.stanford.edu/download/prerelease_javadoc_owl/edu/stanford/smi/protegex/owl/swrl/SWRLRuleEngine.html
[3] http://protege.cim3.net/cgi-bin/wiki.pl?SWRLFactoryFAQ

> Hi Everyone,
>
> How can we infer a SWRL rule in our code instead of having that written in
> advance and just run(). the following code is not doing any inference:
>
> String uri = "
> http://www.ualberta.ca/~golmoham/SW/music%20ontology/moProject/Oct152008/KGmo/mo.owl
> ";
>     OWLModel owlModel;
> try {
>        owlModel = ProtegeOWL.createJenaOWLModelFromURI(uri);
>        SWRLRuleEngineBridge bridge= bridgeFactory.createBridge(owlModel);
>
>        bridge.infer("Profile(?p) -> Weblog(?p) "); // this is the
> problematic line
>
>        OWLNamedClass WeblogClass = owlModel.getOWLNamedClass("Weblog");
>        Collection tt = WeblogClass.getInstances(false);
>        System.out.println("the weblog includes:"+tt.toString());
>        System.exit(100);
>            } catch
>
> but when I replace   bridge.infer("Profile(?p) -> Weblog(?p) ") with the
> following it work fine (having SWRL rules defined in the ontology using the
> swrlTab)
>        bridge.reset();
>        bridge.importSWRLRulesAndOWLKnowledge();
>        bridge.run();
>        bridge.writeInferredKnowledge2OWL();
>
> There is no error or strange message in the console.
>
> Bests,
> --Koosha
>





More information about the protege-owl mailing list