Author: enridaga
Date: Mon Jan 16 10:20:26 2012
New Revision: 1231895

URL: http://svn.apache.org/viewvc?rev=1231895&view=rev
Log:
Added documentation about the rest api for reasoners (STANBOL-462) (2). (some 
resources where missing in the previous commit).

Added:
    
incubator/stanbol/trunk/reasoners/servicesapi/src/main/java/org/apache/stanbol/reasoners/servicesannotation/
    
incubator/stanbol/trunk/reasoners/servicesapi/src/main/java/org/apache/stanbol/reasoners/servicesapi/annotations/
    
incubator/stanbol/trunk/reasoners/servicesapi/src/main/java/org/apache/stanbol/reasoners/servicesapi/annotations/Documentation.java
    
incubator/stanbol/trunk/reasoners/web/src/main/resources/org/apache/stanbol/reasoners/web/templates/imports/serviceDescription.ftl
    
incubator/stanbol/trunk/reasoners/web/src/main/resources/org/apache/stanbol/reasoners/web/templates/imports/taskDescription.ftl
    
incubator/stanbol/trunk/reasoners/web/src/main/resources/org/apache/stanbol/reasoners/web/templates/org/apache/stanbol/reasoners/web/resources/ReasoningServicesResource/service.ftl

Added: 
incubator/stanbol/trunk/reasoners/servicesapi/src/main/java/org/apache/stanbol/reasoners/servicesapi/annotations/Documentation.java
URL: 
http://svn.apache.org/viewvc/incubator/stanbol/trunk/reasoners/servicesapi/src/main/java/org/apache/stanbol/reasoners/servicesapi/annotations/Documentation.java?rev=1231895&view=auto
==============================================================================
--- 
incubator/stanbol/trunk/reasoners/servicesapi/src/main/java/org/apache/stanbol/reasoners/servicesapi/annotations/Documentation.java
 (added)
+++ 
incubator/stanbol/trunk/reasoners/servicesapi/src/main/java/org/apache/stanbol/reasoners/servicesapi/annotations/Documentation.java
 Mon Jan 16 10:20:26 2012
@@ -0,0 +1,11 @@
+package org.apache.stanbol.reasoners.servicesapi.annotations;
+
+import java.lang.annotation.*;
+
+@Retention(RetentionPolicy.RUNTIME)
+@Documented
+public @interface Documentation {
+ String name();
+ String description();
+ String file() default "";
+}

Added: 
incubator/stanbol/trunk/reasoners/web/src/main/resources/org/apache/stanbol/reasoners/web/templates/imports/serviceDescription.ftl
URL: 
http://svn.apache.org/viewvc/incubator/stanbol/trunk/reasoners/web/src/main/resources/org/apache/stanbol/reasoners/web/templates/imports/serviceDescription.ftl?rev=1231895&view=auto
==============================================================================
--- 
incubator/stanbol/trunk/reasoners/web/src/main/resources/org/apache/stanbol/reasoners/web/templates/imports/serviceDescription.ftl
 (added)
+++ 
incubator/stanbol/trunk/reasoners/web/src/main/resources/org/apache/stanbol/reasoners/web/templates/imports/serviceDescription.ftl
 Mon Jan 16 10:20:26 2012
@@ -0,0 +1,44 @@
+<#--
+  Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+<#import "/imports/taskDescription.ftl" as taskDescription>
+
+<#macro view fullpath path name description>
+       <p>This endpoint expose the ${name} reasoner.</p>
+       <p>List of subresources:</p>
+       <ul>
+       <!-- TODO: generate the task list dinamically -->
+       <@taskDescription.li name="Classify" path="${fullpath}/classify" 
description="This task infer all <tt>rdf:type</tt> statements."/>
+       <@taskDescription.li name="Check" path="${fullpath}/check" 
description="This task checks whether the schema is correctly used."/>
+       <@taskDescription.li name="Enrich" path="${fullpath}/enrich" 
description="This task materializes all inferences."/>
+       </ul>
+</#macro>
+
+<#macro rest fullpath path name description>
+       <p>This is the description of the REST api exposed by this service. 
<br/>Each subresource correspond to a different task:</p>
+       <ul>
+       <!-- TODO: generate the task list dinamically -->
+       <@taskDescription.li name="Classify" path="${fullpath}/classify" 
description="This task infer all <tt>rdf:type</tt> statements."/>
+       <@taskDescription.li name="Check" path="${fullpath}/check" 
description="This task checks whether the schema is correctly used."/>
+       <@taskDescription.li name="Enrich" path="${fullpath}/enrich" 
description="This task materializes all inferences."/>
+       </ul>
+       <@taskDescription.view name="Classify" path="${fullpath}/classify" 
description="This task infer all <tt>rdf:type</tt> statements."/>
+       <@taskDescription.view name="Check" path="${fullpath}/check" 
description="This task checks whether the schema is correctly used."/>
+       <@taskDescription.view name="Enrich" path="${fullpath}/enrich" 
description="This task materializes all inferences."/>
+</#macro>
+<#macro li fullpath path name description>
+       <li>${name}: @<a href="${fullpath}">${fullpath}</a> This endpoint 
expose the ${name} reasoner.</li>
+</#macro>
\ No newline at end of file

Added: 
incubator/stanbol/trunk/reasoners/web/src/main/resources/org/apache/stanbol/reasoners/web/templates/imports/taskDescription.ftl
URL: 
http://svn.apache.org/viewvc/incubator/stanbol/trunk/reasoners/web/src/main/resources/org/apache/stanbol/reasoners/web/templates/imports/taskDescription.ftl?rev=1231895&view=auto
==============================================================================
--- 
incubator/stanbol/trunk/reasoners/web/src/main/resources/org/apache/stanbol/reasoners/web/templates/imports/taskDescription.ftl
 (added)
+++ 
incubator/stanbol/trunk/reasoners/web/src/main/resources/org/apache/stanbol/reasoners/web/templates/imports/taskDescription.ftl
 Mon Jan 16 10:20:26 2012
@@ -0,0 +1,71 @@
+<#--
+  Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+<#macro view name path description>
+      <h5 style="font-size: 1em;">${name}</h5>
+      <p>Endpoint: @<a href="${it.publicBaseUri}${path}" title="Task: 
${name}">/${path}</a></p>
+      <div style="padding-left: 10px;">  
+          <table>
+                 <tbody>
+                 <tr><th>Request</th><td><tt>GET</tt> or 
<tt>POST</tt>:<ul><li><tt>/${path}</tt>: run as foreground 
job;</li><li><tt>/${path}/job</tt>: run as background job</li> </td>
+                 <tr><th>Description</th><td>${description}</td></tr>
+                 <tr>
+                       <th>Parameters</th>
+                       <td>
+                               <ul>
+                                       <li><tt>url</tt>: a URL pointing to a 
resource in RDF; the service loads the input from the given url;</li>
+                                       <li><tt>file</tt>: an RDF file sent 
from the client; the service loads the file (only using method <tt>POST</tt> 
with <tt>Content-type: multipart/form+data</tt>)</li>
+       <#if name != "Check">
+                                               <li><tt>target</tt>: a graph 
name; if given, the service saves the result in the triple store.</li>
+    </#if>
+                                               <li><tt>scope</tt>: an Ontonet 
scope ID; the service adds the scope to the input stream.</li>
+                                               <li><tt>recipe</tt>: a Recipe 
defined in the Rules module; the service adds the recipe to the reasoner.</li>
+                                               <li><tt>session</tt>: an 
Ontonet session ID; the service adds the session to the input stream</li>
+                               </ul>
+                       </td>
+                 </tr>
+                 <tr>
+                       <th>Produces</th>
+                       <td>
+                       If run as background job (<tt>{service}/job</tt>), 
returns <tt>201 Created</tt>, with the header <tt>Location: 
{job-monitoring-url}</tt>.<br/>
+       <#if name != "Check">
+                               The result comes as <tt>200 Ok</tt>, if no 
errors occurred, or <tt>409 Conflict</tt>, if the input is not consistent.</br>
+                       According to the requested media type, the result can 
be of type: 
+                               <tt>application/rdf+xml</tt>; 
+                               <tt>text/turtle</tt>;
+                               <tt>text/n3</tt>;
+                               <tt>text/html</tt>
+       <#else>
+                               <ul><li><tt>200 Ok</tt>: the input is 
consistent; or</li><li><tt>409 Conflict</tt>: the input is <b>not</b> 
consistent.</li></ul>
+       </#if>
+                       </td>
+                 </tr>
+                 </tbody>
+          </table>
+          <p><b>Examples</b>:
+<pre>
+$ curl "${it.publicBaseUri}${path}?url=http://xmlns.com/foaf/0.1/";
+</pre>
+or
+<pre>
+curl -X POST -H "Content-type: multipart/form-data" -H "Accept: text/turtle" 
-F [email protected] "${it.publicBaseUri}${path}"
+</pre>
+                 </p>
+      </div>
+</#macro>
+<#macro li name path description>
+      <li>${name}: @<a href="${it.publicBaseUri}${path}" title="Task: 
${name}">/${path}</a>: ${description}</li>
+</#macro>
\ No newline at end of file

Added: 
incubator/stanbol/trunk/reasoners/web/src/main/resources/org/apache/stanbol/reasoners/web/templates/org/apache/stanbol/reasoners/web/resources/ReasoningServicesResource/service.ftl
URL: 
http://svn.apache.org/viewvc/incubator/stanbol/trunk/reasoners/web/src/main/resources/org/apache/stanbol/reasoners/web/templates/org/apache/stanbol/reasoners/web/resources/ReasoningServicesResource/service.ftl?rev=1231895&view=auto
==============================================================================
--- 
incubator/stanbol/trunk/reasoners/web/src/main/resources/org/apache/stanbol/reasoners/web/templates/org/apache/stanbol/reasoners/web/resources/ReasoningServicesResource/service.ftl
 (added)
+++ 
incubator/stanbol/trunk/reasoners/web/src/main/resources/org/apache/stanbol/reasoners/web/templates/org/apache/stanbol/reasoners/web/resources/ReasoningServicesResource/service.ftl
 Mon Jan 16 10:20:26 2012
@@ -0,0 +1,34 @@
+<#--
+  Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+<#import "/imports/common.ftl" as common>
+<#import "/imports/reasonersDescription.ftl" as reasonersDescription>
+<#import "/imports/serviceDescription.ftl" as serviceDescription>
+<#escape x as x?html>
+<@common.page title="Reasoners: ${it.serviceDescription.name}" 
hasrestapi=true> 
+               
+<h3>Service Endpoint <a 
href="/${it.currentPath}">/reasoners/${it.service.path}</a>: 
${it.serviceDescription.name}</h3>
+<div class="panel" id="webview">
+               <@serviceDescription.view name="${it.serviceDescription.name}" 
fullpath="${it.currentPath}" path="${it.service.path}" 
description="${it.serviceDescription.description}"/>
+</div>
+
+    <!-- We disable this at the moment -->
+    <div class="panel" id="restapi" style="display: none;">
+               <@serviceDescription.rest name="${it.serviceDescription.name}" 
fullpath="${it.currentPath}" path="${it.service.path}" 
description="${it.serviceDescription.description}"/>
+    </div>
+
+</@common.page>
+</#escape>
\ No newline at end of file


Reply via email to