ontolog-forum
[Top] [All Lists]

Re: [ontolog-forum] OWL to KIF translator?

To: "[ontolog-forum]" <ontolog-forum@xxxxxxxxxxxxxxxx>
From: "Elisa F. Kendall" <ekendall@xxxxxxxxxxxx>
Date: Mon, 28 Jan 2008 17:32:30 -0800
Message-id: <479E822E.60909@xxxxxxxxxxxx>
Hi Duane,

The current JTP web site is http://www.ksl.stanford.edu/software/JTP/.  It's all freely available and open source. 

Assistance with the software may be limited -- now that Deb is at RPI, she's starting to take over maintenance of some of the KSL legacy work, but I'm not sure what the status of support for JTP is at this point (she moved over the holidays, and is still settling in, with initial focus on her core research in InferenceWeb).

Best,

Elisa

Duane Nickull wrote:
Where can I download the jtp jars?  Are they free?

D


On 1/28/08 4:19 PM, "rick@xxxxxxxxxxxxxx" <rick@xxxxxxxxxxxxxx> wrote:

  
Pat:

See below for an EJB using JTP with the OWLReasoningContext and the
KIF2CNF parser. This has never been validated, it just builds on a
snippet from the JTP documentation. Feel free to call if you want to
chat ...

Patrick Cassidy wrote:
    
Does anyone have on hand a functioning ontology  translator to go from OWL
to KIF or some other FOL format?
      
/**
  * @(#) TrustProviderProxyBean.java
  * @author <a href:mailto="rick@xxxxxxxxxxxxxx">Rick Murphy</a>
  * @version 0.1
  * @see <a href="" class="moz-txt-link-rfc2396E" href="http://www.rickmurphy.org/cps-license.html">"http://www.rickmurphy.org/cps-license.html">Citizen
Privacy Service License</a>
  */

package org.rickmurphy.pep;

import java.io.InputStream;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;

import java.net.URL;
import java.net.MalformedURLException;

import java.util.Iterator;
import java.util.Map;
import java.util.HashMap;

import javax.ejb.SessionBean;
import javax.ejb.SessionContext;
import javax.ejb.EJBLocalHome;
import javax.ejb.EJBLocalObject;

import jtp.ReasoningException;
import jtp.ReasoningStep;
import jtp.ReasoningStepIterator;

import jtp.context.owl.OWLReasoningContext;

import jtp.fol.kif.KIF2CNF;

import jtp.fol.parser.ParserBasedTranslator;

import jtp.frame.vc.Goal;

import jtp.modelim.AskingQueryProcessor;

import jtp.ui.RDFQueryUtils;

import com.hp.hpl.jena.rdf.model.Model;
import com.hp.hpl.jena.rdf.model.ModelFactory;

/**
  *
  */
public class TrustProviderProxyBean implements
TrustProviderProxy,SessionBean{

   private KIF2CNF kifParser;
   private OWLReasoningContext context;

   /**
    * @param goal
    * @return boolean
    * @throws ReasoningException
    */
   public boolean challenge(Goal goal) throws ReasoningException{

     AskingQueryProcessor queryProcessor = new AskingQueryProcessor();
 
queryProcessor.setTranslator((ParserBasedTranslator)kifParser.createTranslator
());
     context.add(queryProcessor);

     return queryProcessor.acceptable(goal);

   }//challenge

   /**
    * @param goal
    * @return ReasoningStepIterator
    * @throws ReasoningException
    */
   public ReasoningStepIterator enforce(Goal goal) throws
ReasoningException{

     ReasoningStepIterator iterator = context.ask(goal.toString());

     ReasoningStep step = null;

     while((step = iterator.next()) != null){
       step = iterator.next();
       //System.out.println("got step: " + step);
     }

     //persist and return provenance
     TrustProviderDAO dao = new TrustProviderDAO();

     return iterator;

   }//enforce

   /**
    * @throws CreateException
    * @throws ReasoningException
    * @throws IOException
    * @throws MalformedURLException
    */
   public void ejbCreate() throws
MalformedURLException,IOException,ReasoningException{

     kifParser = new KIF2CNF();

     kifParser.setCaseSensitiveSymbols(true);
     kifParser.addNamespaceMapping("owl", "http://www.w3.org/2002/07/owl#");
     kifParser.addNamespaceMapping("daml",
"http://www.daml.org/2001/03/daml+oil#");
     kifParser.addNamespaceMapping("rdf",
"http://www.w3.org/1999/02/22-rdf-syntax-ns#");
     kifParser.addNamespaceMapping("rdfs",
"http://www.w3.org/2000/01/rdf-schema#");

     context = new OWLReasoningContext();
     context.setUp();

     Model model = ModelFactory.createDefaultModel();

     URL pubLocURL = new URL("http://localhost/kb");
     model.read(new BufferedReader(new InputStreamReader(new
URL("http://www.osera.gov/privacy.owl").openStream())),
pubLocURL.toString());

     ((OWLReasoningContext)context).loadRDFKB(model, pubLocURL);

     HashMap nsToUriMap = new HashMap();
     RDFQueryUtils.addNamespaceMappingsFromKb(pubLocURL.toString(),
model, nsToUriMap);
     for (Iterator it = nsToUriMap.entrySet().iterator(); it.hasNext();){
       Map.Entry ent = (Map.Entry)it.next();
 
kifParser.addNamespaceMapping((String)ent.getKey(),(String)ent.getValue());
     }
     context.add(kifParser);

   }//ejbCreate

   /**
    * @param sessioncontext
    */
   public void setSessionContext( SessionContext sessioncontext
){}//setSessionContext

   /**
    *
    */
   public void ejbRemove( ){}//ejbRemove

   /**
    *
    */
   public void ejbPassivate( ){}//ejbPassivate

   /**
    *
    */
   public void ejbActivate( ){}//ejbActivate

   /**
    *
    */
   public void remove( ){}//remove

   /**
    * @param localObject
    * @return boolean
    */
   public boolean isIdentical(EJBLocalObject localObject){ return
false;}//isIdentical

   /**
    * @return EJBLocalHome
    */
   public EJBLocalHome getEJBLocalHome(){return null;}//getEJBLocalHome

   /**
    * @return Object
    */
   public Object getPrimaryKey(){return null;}//getPrimaryKey

}//TrustProviderProxyBean


    
Pat

Patrick Cassidy
MICRA, Inc.
908-561-3416
cell: 908-565-4053
cassidy@xxxxxxxxx


 
_________________________________________________________________
Message Archives: http://ontolog.cim3.net/forum/ontolog-forum/
Subscribe/Config: http://ontolog.cim3.net/mailman/listinfo/ontolog-forum/
Unsubscribe: mailto:ontolog-forum-leave@xxxxxxxxxxxxxxxx
Shared Files: http://ontolog.cim3.net/file/
Community Wiki: http://ontolog.cim3.net/wiki/
To Post: mailto:ontolog-forum@xxxxxxxxxxxxxxxx
 


      

  

_________________________________________________________________
Message Archives: http://ontolog.cim3.net/forum/ontolog-forum/  
Subscribe/Config: http://ontolog.cim3.net/mailman/listinfo/ontolog-forum/  
Unsubscribe: mailto:ontolog-forum-leave@xxxxxxxxxxxxxxxx
Shared Files: http://ontolog.cim3.net/file/
Community Wiki: http://ontolog.cim3.net/wiki/ 
To Post: mailto:ontolog-forum@xxxxxxxxxxxxxxxx    (01)

<Prev in Thread] Current Thread [Next in Thread>