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] regarding insertion of swrl rules through api

sandeep gadi gadisandeep at
Sat Feb 14 13:19:52 PST 2009


I am using protege 3.4 and whne I am trying to run the program to insert
swrl rules through api I am getting it inserted in my owl file but not in
this way                      hasAge(?p,56)-> sqwrl:select(?p)  but rather
this way hasAge(?p, 56)  ∧  sqwrl:select(?p) →   can anybody tell me why?

thank you

import java.util.ArrayList;
import java.util.Collection;

import com.hp.hpl.jena.util.FileUtils;

 import edu.stanford.smi.protege.model.Cls;
 import edu.stanford.smi.protegex.owl.ProtegeOWL;
 import edu.stanford.smi.protegex.owl.model.OWLNamedClass;
 import edu.stanford.smi.protegex.owl.model.OWLDatatypeProperty;
 import edu.stanford.smi.protegex.owl.model.OWLObjectProperty;
import edu.stanford.smi.protegex.owl.model.RDFIndividual;
import edu.stanford.smi.protegex.owl.jena.JenaOWLModel;
import edu.stanford.smi.protegex.owl.model.RDFSClass;
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.parser.SWRLParseException;
import edu.stanford.smi.protegex.owl.swrl.sqwrl.SQWRLQueryEngine;
import edu.stanford.smi.protegex.owl.swrl.sqwrl.SQWRLQueryEngineFactory;

 public class JenaDemo {

     * @param args the command line arguments
     * @throws SWRLParseException

    public static void main(String[] args) throws SWRLParseException {

        JenaOWLModel owlModel = null;

        try {

            File file = new File("sap.owl");
            owlModel =

        catch (Exception e) {

           SWRLFactory factory = new SWRLFactory(owlModel);

        SWRLImp imp = factory.createImp("Query-3", "hasAge(?p,56)->

        Collection col = imp.getReferencedInstances();
        System.out.println("elements: "+col.toString());

        String fileName = "sap.owl";
        Collection errors = new ArrayList(); File(fileName).toURI(), FileUtils.langXMLAbbrev,
        System.out.println("File saved with " + errors.size() + " errors.");


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the protege-owl mailing list