ontolog-forum
[Top] [All Lists]

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

To: "[ontolog-forum] rick@xxxxxxxxxxxxxx," <ontolog-forum@xxxxxxxxxxxxxxxx>
From: Duane Nickull <dnickull@xxxxxxxxx>
Date: Mon, 28 Jan 2008 16:55:39 -0800
Message-id: <C3C3B98B.BE84%dnickull@xxxxxxxxx>
Where can I download the jtp jars?  Are they free?    (01)

D    (02)


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

> 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="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
>>  
>> 
>> 
>     (04)

-- 
**********************************************************************
"Speaking only for myself"
Senior Technical Evangelist - Adobe Systems, Inc.
Blog - http://technoracle.blogspot.com
Community Music - http://www.mix2r.com
My Band - http://www.myspace.com/22ndcentury
Adobe MAX 2008 - http://technoracle.blogspot.com/2007/08/adobe-max-2008.html
**********************************************************************    (05)


_________________________________________________________________
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    (06)

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