index.html revision 2
2ronwalf<link media="screen" href="http://www.mindswap.org/css/swap.css" type="text/css" rel="stylesheet" title="normal"/><link media="screen" href="http://www.mindswap.org/css/mind.css" type="text/css" rel="alternate stylesheet" title="none"/><meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
2ronwalf<link media="screen" href="/css/swap.css" type="text/css" rel="stylesheet" title="normal"/><link media="screen" href="/css/mind.css" type="text/css" rel="alternate stylesheet" title="none"/><meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
2ronwalf <h2 class="headingSubtitle">Maryland Information and Network Dynamics Lab Semantic Web Agents Project </h2>
2ronwalf <p>The javadocs of the API is included in the distribution file. You can access the online version
2ronwalf <p>There are couple of example OWL-S files here <a href="http://www.mindswap.org/2004/owl-s/services.shtml">http://www.mindswap.org/2004/owl-s/services.shtml</a>.
2ronwalfThese services are all grounded in actual WSDL services and can be executed with the API. These are simple service descriptions to show different features in OWL-S such
2ronwalfas how to define XSLT transformations in groundings, how to define CompositeProcesses and data flows and so on.</p>
2ronwalf <p>The examples directory in the distribution file contains example code that shows how to use these service
2ronwalf <a href="javadoc/org/mindswap/owl/OWLKnowledgeBase.html">OWLKnowledgeBase</a></font>. OWLOntology represents the information stored in a single
2ronwalf <a href="javadoc/org/mindswap/owl/OWLKnowledgeBase.html#read(java.net.URI)">OWLKnowledgeBase.read(URI)</a></code> function reads the file from the
2ronwalf <font face="Courier New">OWLOntology.getService()</font> </a>can be used to get the service instance from the
2ronwalf ontology (<font face="Courier New"><a href="javadoc/org/mindswap/owl/OWLOntology.html#getServices()">OWLOntology.getServices()</a></font> if there are multiple services).
2ronwalf <font face="Courier New">OWLKnowledgeBase.readService(URI)</font></a><font face="tahoma, arial, sans-serif">
2ronwalf <font face="Courier New">OWLKnowledgeBase.readServices(URI)</font></a><font face="tahoma, arial, sans-serif">) function will automatically do that.
2ronwalf<!-- = Further information: http://www.java2html.de = -->
2ronwalf<table border="2" cellpadding="3" cellspacing="0" bgcolor="#ffffff" width="60%" style="border-collapse: collapse" bordercolor="#111111">
2ronwalf<font color="#ffffff"> </font><font color="#000000">URI uri = </font><font color="#7f0055"><b>new </b></font><font color="#000000">URI(</font></code><font SIZE="2" COLOR="#2a00ff">"http://www.mindswap.org/2004/owl-s/0.9/ZipCodeFinder.owl"</font><code><font color="#000000">);</font></code><p>
2ronwalf<font color="#3f7f5f"> // create a KB</font><font color="#ffffff"> </font><br/>
2ronwalf<font color="#ffffff"> </font><font color="#000000">OWLOntology ont = kb.read(uri;</font><br/>
2ronwalf<font color="#ffffff"> </font><font color="#000000">Service service = ont.getService();<br>
2ronwalf<font color="#ffffff"> </font><font color="#000000">ont.write(System.out);</font><br/>
2ronwalf Translation should be enabled with the OWLKnowledgeBase.setAutoTranslate(true)
2ronwalf cached files. The cache dir should include a file named service.idx that has
2ronwalf <a href="http://java.sun.com/j2se/1.4.2/docs/api/java/util/Properties.html#load(java.io.InputStream)">
2ronwalf <code>OWLCache.addCachedFile()</code></a> function. When there is a cache entry for a file,
2ronwalf <code>OWLCache.setForced(boolean)</code></a> for this functionality. Remember to include an
2ronwalf OWLKnowledgeBase.getReader().getCache() will return the cache assocaited with
2ronwalf <a href="javadoc/org/mindswap/owls/process/execution/ProcessExecutionEngine.html">ProcessExecutionEngine.execute(Process,
2ronwalf<table border="2" cellpadding="3" cellspacing="0" bgcolor="#ffffff" width="60%" style="border-collapse: collapse" bordercolor="#111111">
2ronwalf<font color="#ffffff"> </font><font color="#3f7f5f">// create an execution engine </font><br/>
2ronwalf<font color="#ffffff"> </font><font color="#000000">ProcessExecutionEngine exec = OWLSFactory.createExecutionEngine();</font></code><p>
2ronwalf<font color="#ffffff"> </font><font color="#3f7f5f">// </font><font color="#3F7F5F">load
2ronwalf </font><font color="#000000">Service service = kb.readService(</font><font color="#2a00ff">"http://www.mindswap.org/2004/owl-s/1.0/Dictionary.owl"</font><font color="#000000">);<br>
2ronwalf<font color="#ffffff"> </font><font color="#000000">Process process = service.getProcess();</font><br/>
2ronwalf<font color="#ffffff"> </font><font color="#000000">ValueMap values = new
2ronwalf<font color="#ffffff"> </font><font color="#000000">values.setDataValue(process.getInput(</font><font color="#2a00ff">"InputString"</font><font color="#000000">), </font><font color="#2a00ff">"computer"</font><font color="#000000">); </font><br/>
2ronwalf<font color="#ffffff"> </font><font color="#000000">values = exec.execute(process, values); </font><br/>
2ronwalf<font color="#ffffff"> </font><font color="#3f7f5f">// get the output value
2ronwalf<font color="#ffffff"> </font><font color="#000000">String outValue = values.getStringValue(process.getOutput());</font><br/>
2ronwalf<font color="#ffffff"> </font><font color="#3f7f5f">// display the result</font><br/>
2ronwalf<font color="#ffffff"> </font><font color="#000000">System.out.println(</font><font color="#2a00ff">"Output = " </font><font color="#000000">+ outValue);</font></code></td>
2ronwalf <a href="javadoc/org/mindswap/owls/process/execution/ProcessExecutionEngine.html">ProcessExecutionEngine.addExecutionListener(ProcessExecutionListener)</a> </code>
2ronwalf <a href="http://svn.mindswap.org/owl-s/trunk/src/org/mindswap/owls/examples/RunService.java">
2ronwalf <a href="javadoc/org/mindswap/owl/OWLOntology.html">OWLOntology</a></code> provides functions to create any of these structures.
2ronwalf<table border="2" cellpadding="3" cellspacing="0" bgcolor="#ffffff" width="60%" style="border-collapse: collapse" bordercolor="#111111">
2ronwalf<font color="#ffffff"> </font><font color="#3f5fbf">* Create a new Sequence from the processes of the given services and put them in a new</font><br/>
2ronwalf<font color="#ffffff"> </font><font color="#3f5fbf">* Service.</font><br/>
2ronwalf<font color="#ffffff"> </font><font color="#3f5fbf">* </font><font color="#7f9fbf">@param </font><font color="#3f5fbf">services List of Service</font><font color="#3F5FBF">s</font><br/>
2ronwalf<font color="#ffffff"> </font><font color="#3f5fbf">* </font><font color="#7f9fbf">@param </font><font color="#3f5fbf">baseURI The base URI for the generated service</font><br/>
2ronwalf<font color="#ffffff"> </font><font color="#3f5fbf">* </font><font color="#7f9fbf">@return </font><font color="#3f5fbf">The Service which is a Sequence of the given services </font><br/>
2ronwalf<font color="#ffffff"> </font><font color="#000000">Service createSequenceService(List services, String baseURI) {</font><font color="#ffffff"> <br>
2ronwalf </font><font color="#3f7f5f">// create an empty ontology</font><br/>
2ronwalf<font color="#ffffff"> </font><font color="#3f7f5f">// create a
2ronwalf<font color="#ffffff"> </font><font color="#000000">Service service = ont.createService(URI.create(baseURI + </font><font color="#2a00ff">"Service"</font><font color="#000000">));</font><br/>
2ronwalf<font color="#ffffff"> </font><font color="#3f7f5f">// create a new
2ronwalf<font color="#ffffff"> </font><font color="#000000">CompositeProcess process = ont.createCompositeProcess(URI.create(baseURI + </font><font color="#2a00ff">"Process"</font><font color="#000000">)); </font><br/>
2ronwalf<font color="#ffffff"> </font><font color="#000000">Sequence sequence = ont.createSequence();</font><br/>
2ronwalf<font color="#ffffff"> </font><font color="#000000">compositeProcess.setComposedOf(sequence);</font><br/>
2ronwalf<font color="#ffffff"> </font><font color="#7f0055"><b>for</b></font><font color="#000000">(</font><font color="#7f0055"><b>int </b></font><font color="#000000">i = </font><font color="#990000">0</font><font color="#000000">; i < services.size(); i++) { </font><br/>
2ronwalf<font color="#ffffff"> </font><font color="#3f7f5f">// get
2ronwalf<font color="#ffffff"> </font><font color="#000000">Service s = (Service) services.get(i);</font><br/>
2ronwalf<font color="#ffffff"> </font><font color="#3f7f5f">// get
2ronwalf<font color="#ffffff"> </font><font color="#000000">Process p = s.getProcess();</font><br/>
2ronwalf<font color="#ffffff"> </font><font color="#3f7f5f">// put
2ronwalf<font color="#ffffff"> </font><font color="#000000">sequence.addComponent(p);</font><br/>
2ronwalf </font><font color="#3f7f5f">// create grounding </font><br/>
2ronwalf<font color="#ffffff"> </font><font color="#7f0055"><b>return </b></font><font color="#000000">service;</font><font color="#3f7f5f"><br>
2ronwalf Every resource in the API (<code><a href="javadoc/org/mindswap/owls/service/Service.html">Service</a>,</code>
2ronwalf OWLIndividual.getImplementation() returns the implementation specific object. Right now, API is built on top of Jena so the function will return the corresponding