Author: anuzzolese
Date: Fri Oct  5 15:07:02 2012
New Revision: 1394567

URL: http://svn.apache.org/viewvc?rev=1394567&view=rev
Log:
[STANBOL-758] Resolved management of IDs for recipes based on non-URI strings.
Updated documentation of Rules' HTTP REST services in Web views.

Modified:
    
stanbol/trunk/rules/web/src/main/java/org/apache/stanbol/rules/web/resources/RulesResource.java
    
stanbol/trunk/rules/web/src/main/resources/org/apache/stanbol/rules/web/static/actions/tutorial.js
    
stanbol/trunk/rules/web/src/main/resources/org/apache/stanbol/rules/web/templates/org/apache/stanbol/rules/web/resources/RulesResource/index.ftl

Modified: 
stanbol/trunk/rules/web/src/main/java/org/apache/stanbol/rules/web/resources/RulesResource.java
URL: 
http://svn.apache.org/viewvc/stanbol/trunk/rules/web/src/main/java/org/apache/stanbol/rules/web/resources/RulesResource.java?rev=1394567&r1=1394566&r2=1394567&view=diff
==============================================================================
--- 
stanbol/trunk/rules/web/src/main/java/org/apache/stanbol/rules/web/resources/RulesResource.java
 (original)
+++ 
stanbol/trunk/rules/web/src/main/java/org/apache/stanbol/rules/web/resources/RulesResource.java
 Fri Oct  5 15:07:02 2012
@@ -26,6 +26,8 @@ import static org.apache.stanbol.commons
 import static org.apache.stanbol.commons.web.base.CorsHelper.enableCORS;
 
 import java.io.InputStream;
+import java.net.URI;
+import java.net.URISyntaxException;
 import java.util.List;
 
 import javax.servlet.ServletContext;
@@ -207,6 +209,13 @@ public class RulesResource extends BaseS
 
         ResponseBuilder responseBuilder;
         try {
+               
+               URI uri = new URI(recipeID);
+                       if(uri.getScheme() == null){
+                               recipeID = "urn:" + recipeID;
+                               log.info("The recipe ID is a URI without 
scheme. The ID is set to " + recipeID);
+                       }
+               
             recipe = ruleStore.getRecipe(new UriRef(recipeID));
 
             if (ruleID != null && !ruleID.isEmpty()) {
@@ -228,7 +237,10 @@ public class RulesResource extends BaseS
         } catch (NoSuchRuleInRecipeException e) {
             log.error(e.getMessage(), e);
             responseBuilder = Response.status(Status.NOT_FOUND);
-        }
+        } catch (URISyntaxException e) {
+               log.error(e.getMessage(), e);
+            responseBuilder = Response.status(Status.NOT_ACCEPTABLE);
+               }
 
         addCORSOrigin(servletContext, responseBuilder, headers);
         return responseBuilder.build();
@@ -246,6 +258,13 @@ public class RulesResource extends BaseS
 
         ResponseBuilder responseBuilder;
         try {
+               
+               URI uri = new URI(recipeID);
+                       if(uri.getScheme() == null){
+                               recipeID = "urn:" + recipeID;
+                               log.info("The recipe ID is a URI without 
scheme. The ID is set to " + recipeID);
+                       }
+                       
             recipe = ruleStore.getRecipe(new UriRef(recipeID));
 
             if (ruleID != null && !ruleID.isEmpty()) {
@@ -268,7 +287,10 @@ public class RulesResource extends BaseS
         } catch (NoSuchRuleInRecipeException e) {
             log.error(e.getMessage(), e);
             responseBuilder = Response.status(Status.NOT_FOUND);
-        }
+        } catch (URISyntaxException e) {
+                       log.error(e.getMessage(), e);
+            responseBuilder = Response.status(Status.NOT_ACCEPTABLE);
+               }
 
         addCORSOrigin(servletContext, responseBuilder, headers);
         return responseBuilder.build();
@@ -299,13 +321,22 @@ public class RulesResource extends BaseS
 
         ResponseBuilder responseBuilder;
         try {
+               
+               URI uri = new URI(recipeID);
+                       if(uri.getScheme() == null){
+                               recipeID = "urn:" + recipeID;
+                               log.info("The recipe ID is a URI without 
scheme. The ID is set to " + recipeID);
+                       }
             ruleStore.createRecipe(new UriRef(recipeID), description);
 
             responseBuilder = Response.ok();
         } catch (AlreadyExistingRecipeException e) {
             log.error(e.getMessage(), e);
             responseBuilder = Response.status(Status.CONFLICT);
-        }
+        } catch (URISyntaxException e) {
+               log.error(e.getMessage(), e);
+            responseBuilder = Response.status(Status.NOT_ACCEPTABLE);
+               }
 
         addCORSOrigin(servletContext, responseBuilder, headers);
         return responseBuilder.build();
@@ -364,32 +395,53 @@ public class RulesResource extends BaseS
                                  @Context HttpHeaders headers) {
 
         ResponseBuilder responseBuilder;
-        if (rule != null && !rule.isEmpty()) {
-
-            Recipe rcp;
-            try {
-                rcp = ruleStore.getRecipe(new UriRef(recipe));
-                Rule rl = ruleStore.getRule(rcp, new UriRef(rule));
-                ruleStore.removeRule(rcp, rl);
-            } catch (NoSuchRecipeException e) {
-                log.error(e.getMessage(), e);
-                responseBuilder = Response.status(Status.PRECONDITION_FAILED);
-            } catch (RecipeConstructionException e) {
-                log.error(e.getMessage(), e);
-                responseBuilder = Response.status(Status.NO_CONTENT);
-            } catch (NoSuchRuleInRecipeException e) {
-                log.error(e.getMessage(), e);
-                responseBuilder = Response.status(Status.NOT_FOUND);
-            }
-
-        } else {
-            try {
-                ruleStore.removeRecipe(new UriRef(recipe));
-            } catch (RecipeEliminationException e) {
-                log.error(e.getMessage(), e);
-                responseBuilder = 
Response.status(Status.INTERNAL_SERVER_ERROR);
-            }
-        }
+        
+        boolean stop = false;
+        
+        URI uri = null;
+               try {
+                       uri = new URI(recipe);
+               } catch (URISyntaxException e1) {
+                       log.error(e1.getMessage(), e1);
+            responseBuilder = Response.status(Status.NOT_ACCEPTABLE);
+            stop = true;
+               }
+               
+               if(!stop){
+                       if(uri != null && uri.getScheme() == null){
+                               recipe = "urn:" + recipe;
+                               log.info("The recipe ID is a URI without 
scheme. The ID is set to " + recipe);
+                       }
+               
+                       log.info("The recipe ID is : " + recipe);
+               
+               if (rule != null && !rule.isEmpty()) {
+       
+                   Recipe rcp;
+                   try {
+                       rcp = ruleStore.getRecipe(new UriRef(recipe));
+                       Rule rl = ruleStore.getRule(rcp, new UriRef(rule));
+                       ruleStore.removeRule(rcp, rl);
+                   } catch (NoSuchRecipeException e) {
+                       log.error(e.getMessage(), e);
+                       responseBuilder = 
Response.status(Status.PRECONDITION_FAILED);
+                   } catch (RecipeConstructionException e) {
+                       log.error(e.getMessage(), e);
+                       responseBuilder = Response.status(Status.NO_CONTENT);
+                   } catch (NoSuchRuleInRecipeException e) {
+                       log.error(e.getMessage(), e);
+                       responseBuilder = Response.status(Status.NOT_FOUND);
+                   } 
+       
+               } else {
+                   try {
+                       ruleStore.removeRecipe(new UriRef(recipe));
+                   } catch (RecipeEliminationException e) {
+                       log.error(e.getMessage(), e);
+                       responseBuilder = 
Response.status(Status.INTERNAL_SERVER_ERROR);
+                   }
+               }
+               }
 
         responseBuilder = Response.ok();
 
@@ -427,6 +479,13 @@ public class RulesResource extends BaseS
 
         Recipe rcp;
         try {
+               
+               URI uri = new URI(recipe);
+                       if(uri.getScheme() == null){
+                               recipe = "urn:" + recipe;
+                               log.info("The recipe ID is a URI without 
scheme. The ID is set to " + recipe);
+                       }
+               
             rcp = ruleStore.getRecipe(new UriRef(recipe));
             ruleStore.addRulesToRecipe(rcp, rules, description);
 
@@ -437,7 +496,10 @@ public class RulesResource extends BaseS
         } catch (RecipeConstructionException e) {
             log.error(e.getMessage(), e);
             responseBuilder = Response.status(Status.INTERNAL_SERVER_ERROR);
-        }
+        } catch (URISyntaxException e) {
+               log.error(e.getMessage(), e);
+            responseBuilder = Response.status(Status.NOT_ACCEPTABLE);
+               }
 
         addCORSOrigin(servletContext, responseBuilder, headers);
         return responseBuilder.build();
@@ -478,6 +540,13 @@ public class RulesResource extends BaseS
             // ClassLoader loader = 
Thread.currentThread().getContextClassLoader();
             // classToLoad = loader.loadClass(format);
             classToLoad = Class.forName(format);
+            
+            URI uri = new URI(recipe);
+                       if(uri.getScheme() == null){
+                               recipe = "urn:" + recipe;
+                               log.info("The recipe ID is a URI without 
scheme. The ID is set to " + recipe);
+                       }
+            
             Recipe rcp = ruleStore.getRecipe(new UriRef(recipe));
             RuleAdapter adapter = adapterManager.getAdapter(rcp, classToLoad);
 
@@ -512,7 +581,10 @@ public class RulesResource extends BaseS
         } catch (UnsupportedTypeForExportException e) {
             responseBuilder = Response.status(Status.FORBIDDEN);
             log.error(e.getMessage(), e);
-        }
+        } catch (URISyntaxException e) {
+               responseBuilder = Response.status(Status.NOT_ACCEPTABLE);
+            log.error(e.getMessage(), e);
+               }
 
         addCORSOrigin(servletContext, responseBuilder, headers);
         return responseBuilder.build();

Modified: 
stanbol/trunk/rules/web/src/main/resources/org/apache/stanbol/rules/web/static/actions/tutorial.js
URL: 
http://svn.apache.org/viewvc/stanbol/trunk/rules/web/src/main/resources/org/apache/stanbol/rules/web/static/actions/tutorial.js?rev=1394567&r1=1394566&r2=1394567&view=diff
==============================================================================
--- 
stanbol/trunk/rules/web/src/main/resources/org/apache/stanbol/rules/web/static/actions/tutorial.js
 (original)
+++ 
stanbol/trunk/rules/web/src/main/resources/org/apache/stanbol/rules/web/static/actions/tutorial.js
 Fri Oct  5 15:07:02 2012
@@ -529,8 +529,7 @@ function Tutorial(){
                
                         $.ajaxSetup({ 
                                'beforeSend': function(xhr) {
-                                       //xhr.setRequestHeader("Accept", 
"application/manchester+owl")}
-                                       xhr.setRequestHeader("Accept", 
"application/turtle")}
+                                       xhr.setRequestHeader("Accept", 
"text/owl-manchester")}
                                }
                         );
                         

Modified: 
stanbol/trunk/rules/web/src/main/resources/org/apache/stanbol/rules/web/templates/org/apache/stanbol/rules/web/resources/RulesResource/index.ftl
URL: 
http://svn.apache.org/viewvc/stanbol/trunk/rules/web/src/main/resources/org/apache/stanbol/rules/web/templates/org/apache/stanbol/rules/web/resources/RulesResource/index.ftl?rev=1394567&r1=1394566&r2=1394567&view=diff
==============================================================================
--- 
stanbol/trunk/rules/web/src/main/resources/org/apache/stanbol/rules/web/templates/org/apache/stanbol/rules/web/resources/RulesResource/index.ftl
 (original)
+++ 
stanbol/trunk/rules/web/src/main/resources/org/apache/stanbol/rules/web/templates/org/apache/stanbol/rules/web/resources/RulesResource/index.ftl
 Fri Oct  5 15:07:02 2012
@@ -147,260 +147,193 @@ $.ajax({
 </div> <!-- end webview -->
 
 <div class="panel" id="restapi" style="display: none;">
-<h3> Getting rules from the rule store ("/rule") </h3>
-Request type: GET<br><br>
-Accepted MIME types:
+<h3 id="how-to-create-a-recipe">How to create a recipe</h3>
 <ul>
-<li>application/rdf+xml</li>
-<li>text/owl-manchester</li>
-<li>application/rdf+json</li>
-<li>application/turtle</li>
-<li>application/owl-functional</li>
+<li>Service: <strong>/rules/recipe/</strong></li>
+<li>Method: PUT</li>
+<li>Parameters:<ul>
+<li>recipe (Path parameter): the ID of the recipe as a path 
parameter(MANDATORY)</li>
+<li>description: the textual description of the recipe (OPTIONAL)</li>
 </ul>
-
-Parameters:
-
-<ul>
-<li> <b>uri (Mandatory).</b> The URI which identifies the rule in the rule 
store. The
- parameter has to be passed as a path parameter</li> 
+</li>
 </ul>
-Possible outputs:
-<ul>
-  <li> 200 The rule is retrieved (import declarations point to KReS Services) 
</li>
-  <li> 404 The rule does not exists in the manager </li>
-  <li> 500 Some error occurred </li>
-</ul>
-
-Request example which returns the RDF representation of a rule identified
-by the URI <http://iks-project.eu/rules/rule1> in its RDF/XML serialization.
-<pre style="margin-bottom:40px;">
-$ curl -X GET -H "Accept: application/rdf+xml" \
-  http://localhost:8080/rule/http://iks-project.eu/rules/rule1
-</pre>
+<p>Example:</p>
+<div class="codehilite"><pre>curl -G -X PUT -d <span 
class="nv">description</span><span class="o">=</span><span class="s2">&quot;A 
test recipe.&quot;</span> <span class="se">\</span>
+http://localhost:8080/rules/recipe/recipeTestA
+</pre></div>
 
-<h3> Adding rules to the rule store ("/rule") </h3>
-Request type: POST<br><br>
-
-Parameters:
 
+<h3 id="how-to-add-rules-to-a-recipe">How to add rules to a recipe</h3>
 <ul>
-<li> <b>recipe (Mandatory).</b> The recipe's identifier. It is the recipe to 
which the
- rules should be added</li>
- <li> <b>rule (Mandatory).</b> The rule's identifier. It can be any unique 
string, e.g. a URI</li> 
- <li> <b>kres-syntax (Mandatory).</b> The rule content expressed with the 
Stanbol Rules
- syntax</li>
- <li> <b>description.</b> A textual description of the behaviour of the 
rule</li>
+<li>Service: <strong>/rules/recipe/</strong></li>
+<li>Method: POST</li>
+<li>Parameters:<ul>
+<li>recipe (Path parameter): the ID of the recipe as a path parameter 
(MANDATORY)</li>
+<li>rules: the rules in Stanbol syntax (MANDATORY)</li>
+<li>description: the textual description of the rules (OPTIONAL)</li>
 </ul>
-Possible outputs:
-<ul>
-  <li> 200 The rule has been added </li>
-  <li> 204 The rule has not been added </li>
-  <li> 400 The rule and recipe are not specified </li>
-  <li> 404 Recipe or rule not found </li>
-  <li> 409 The rule has not been added </li>
-  <li> 500 Some error occurred </li>
-</ul>
-
-Request example which shows how can be used the service in order to
-create a rule:
-<pre style="margin-bottom:40px;">
-$ curl -X POST -d recipe="http://iks-project.eu/recipies/recipeA"; \
-      -d rule="http://iks-project.eu/rule/uncleRule"; \
-      -d kres-syntax= \
-                  "has(<http://www.foo.org/myont.owl#hasFather>, ?x, ?z) . \
-                  has(<http://www.foo.org/myont.owl#hasBrother>, ?z, ?y) \
-                    -> \
-                  has(<http://www.foo.org/myont.owl#hasUncle>, ?x, ?y)" \
-      -d description="The rule which allows to infer hasUncle relations." \
-      http://localhost:8080/rule \
-</pre>
-
-<h3> Removing rules from the rule store ("/rule") </h3>
-Request type: DELETE<br><br>
-
-Parameters:
-
-<ul>
- <li> <b>rule (Mandatory).</b> The rule's identifier. It can be any unique 
string, e.g. a URI</li> 
- <li> <b>recipe.</b> The recipe's identifier. It is the recipe from which
- the rules should be removed. When the parameter is provided, the rule is
- removed only from the recipe, but it is still availavle in the rule base.
- Otherwise, if the parameter is not provided, the rule is completely deleted
- from the rule store</li>
+</li>
 </ul>
-Possible outputs:
-<ul>
-  <li> 200 The rule has been deleted </li>
-  <li> 204 The rule has not been deleted </li>
-  <li> 404 Recipe or rule not found </li>
-  <li> 409 The recipe has not been deleted </li>
-  <li> 500 Some error occurred </li>
-</ul>
-
-Request example which shows how to delete a rule from a recipe leaving it
-into the rule store:
-<pre style="margin-bottom:40px;">
-$ curl -X DELETE -G -d recipe="http://iks-project.eu/recipies/recipeA"; \
-      -d rule="http://iks-project.eu/rule/uncleRule"; \
-      http://localhost:8080/rule
-</pre>
+<p>Example:</p>
+<div class="codehilite"><pre>curl -X POST -H <span 
class="s2">&quot;Content-type: multipart/form-data&quot;</span> <span 
class="se">\</span>
+-F <span class="nv">rules</span><span class="o">=</span>@myRules -F <span 
class="nv">description</span><span class="o">=</span><span class="s2">&quot;My 
rules in the recipe.&quot;</span> <span class="se">\</span>
+http://localhost:8080/rules/recipe/recipeTestA
+</pre></div>
 
-<h3> Getting recipes from the rule store ("/recipe") </h3>
-Request type: GET<br><br>
 
-Accepted MIME types:
+<h3 id="how-to-get-a-recipe-or-a-recipe-from-the-store">How to get a recipe or 
a recipe from the store</h3>
 <ul>
+<li>Service: <strong>/rules/recipe/</strong></li>
+<li>Method: GET</li>
+<li>Parameters:<ul>
+<li>recipe (Path parameter): the ID of the recipe as a path 
parameter(MANDATORY)</li>
+<li>rule: the ID of the rule (OPTIONAL). If it is null than the whole recipe 
is returned. Otherwise it is returned the single rule identified by the 
parameter value</li>
+</ul>
+</li>
+<li>Accepts:<ul>
 <li>application/rdf+xml</li>
+<li>text/html</li>
+<li>text/plain</li>
+<li>application/owl+xml</li>
+<li>text/owl-functional</li>
 <li>text/owl-manchester</li>
-<li>application/rdf+json</li>
-<li>application/turtle</li>
-<li>application/owl-functional</li>
+<li>application/rdf+json,</li>
+<li>text/turle</li>
 </ul>
+</li>
+</ul>
+<p>Example:</p>
+<div class="codehilite"><pre>curl -G -X GET -H <span class="s2">&quot;Accept: 
text/turtle&quot;</span> <span class="se">\ </span>
+-d <span class="nv">rule</span><span class="o">=</span>recipeTestA_rule1 <span 
class="se">\</span>
+http://localhost:8080/rules/recipe/recipeTestA
+</pre></div>
 
-Parameters:
 
+<h3 id="how-to-delete-a-recipe-or-a-recipe-from-the-store">How to delete a 
recipe or a recipe from the store</h3>
 <ul>
- <li> <b>uri (Mandatory).</b> The recipe's identifier that is basically an 
URI</li>
+<li>Service: <strong>/rules/recipe/</strong></li>
+<li>Method: DELETE</li>
+<li>Parameters:<ul>
+<li>recipe (Path parameter): the ID of the recipe as a path 
parameter(MANDATORY)</li>
+<li>rule: the ID of the rule (OPTIONAL). If it is null than the whole recipe 
is deleted. Otherwise it is deleted the single rule identified by the parameter 
value</li>
 </ul>
-Possible outputs:
-<ul>
-  <li> 200 The recipe is retrieved </li>
-  <li> 404 The recipe does not exists in the manager </li>
-  <li> 500 Some error occurred </li>
+</li>
 </ul>
+<p>Example:  <br />
+</p>
+<div class="codehilite"><pre>curl -X DELETE <span class="se">\</span>
+-d <span class="nv">rule</span><span class="o">=</span>recipeTestA_rule1 <span 
class="se">\</span>
+http://localhost:8080/rules/recipe/recipeTestA
+</pre></div>
 
-Request example which shows how to get a recipe from the rule store:
-<pre style="margin-bottom:40px;">
-$ curl -X GET \
-      http://localhost:8080/recipe/http://iks-project.eu/recipies/recipeA
-</pre>
-
-<h3> Adding recipes to the rule store ("/recipe") </h3>
-Request type: POST<br><br>
-
-Parameters:
 
+<h3 id="how-to-find-a-recipe-in-the-store">How to find a recipe in the 
store</h3>
 <ul>
- <li> <b>recipe (Mandatory).</b> The recipe's identifier that is basically an 
URI</li>
- <li> <b>description.</b> The textual description of the recipe</li>
+<li>Service: <strong>/rules/find/recipes</strong></li>
+<li>Method: GET</li>
+<li>Parameters:<ul>
+<li>description: some word describing the recipe. This parameter is used as 
search field.</li>
 </ul>
-Possible outputs:
-<ul>
-  <li> 200 The recipe has been added </li>
-  <li> 409 The recipe has not been added </li>
-  <li> 500 Some error occurred </li>
-</ul>
-
-Request example which shows how to create a recipe and add it into the rule
-store:
-<pre style="margin-bottom:40px;">
-$ curl -X POST \
-      -d recipe="http://iks-project.eu/recipies/recipeA"; \
-      -d description="Example of recipe." \
-      http://localhost:8080/recipe
-</pre>
-
-<h3> Removing recipes from the rule store ("/recipe") </h3>
-Request type: DELETE<br><br>
-
-Parameters:
-
-<ul>
- <li> <b>recipe (Mandatory).</b> The recipe's identifier that is basically an 
URI</li>
+</li>
+<li>Accepts:<ul>
+<li>application/rdf+xml</li>
+<li>text/html</li>
+<li>text/plain</li>
+<li>application/owl+xml</li>
+<li>text/owl-functional</li>
+<li>text/owl-manchester</li>
+<li>application/rdf+json,</li>
+<li>text/turle</li>
 </ul>
-Possible outputs:
-<ul>
-  <li> 200 The recipe has been delted </li>
-  <li> 409 The recipe has not been deleted </li>
-  <li> 500 Some error occurred </li>
+</li>
 </ul>
+<p>Example:  <br />
+</p>
+<div class="codehilite"><pre>curl -G -X GET <span class="se">\</span>
+-d <span class="nv">description</span><span class="o">=</span><span 
class="s2">&quot;test recipe&quot;</span> <span class="se">\</span>
+http://localhost:8080/rules/find/recipes
+</pre></div>
 
-Request example which shows how to delete a recipe from the rule
-store:
-<pre style="margin-bottom:40px;">
-$ curl -X DELETE -G \
-      -d recipe="http://iks-project.eu/recipies/recipeA"; \
-      http://localhost:8080/recipe
-</pre>
 
-
-<h3> Refactoring RDF graphs ("/refactor") </h3>
-Request type: GET<br><br>
-
-Accepted MIME types:
+<h3 id="how-to-find-a-rule-in-the-store">How to find a rule in the store</h3>
 <ul>
+<li>Service: <strong>/rules/find/rules</strong></li>
+<li>Method: GET</li>
+<li>Parameters:<ul>
+<li>description: some word describing the rule. This parameter is used as 
search field.</li>
+</ul>
+</li>
+<li>Accepts:<ul>
 <li>application/rdf+xml</li>
+<li>text/html</li>
+<li>text/plain</li>
+<li>application/owl+xml</li>
+<li>text/owl-functional</li>
 <li>text/owl-manchester</li>
-<li>application/rdf+json</li>
-<li>application/turtle</li>
-<li>application/owl-functional</li>
+<li>application/rdf+json,</li>
+<li>text/turle</li>
 </ul>
+</li>
+</ul>
+<p>Example:  <br />
+</p>
+<div class="codehilite"><pre>curl -G -X GET <span class="se">\</span>
+-d <span class="nv">description</span><span class="o">=</span><span 
class="s2">&quot;My rules&quot;</span> <span class="se">\</span>
+http://localhost:8080/rules/find/rules
+</pre></div>
 
-Parameters:
-
+<h3 id="refactor-engine-refactor">Refactor Engine ("/refactor"):</h3>
 <ul>
- <li> <b>recipe (Mandatory).</b> The recipe's identifier that is basically an 
URI</li>
- <li> <b>input-graph (Mandatory).</b> The ID of the graph to transform</li>
- <li> <b>output-graph (Mandatory).</b> The ID that the transformed graph has 
to have in
- the IKS triple store</li>
+<li>The Refactor Engine <strong>@/refactor</strong> performs a refactoring 
applying an existing recipe in the rule store to the provided RDF graph. </li>
 </ul>
-Possible outputs:
+<p>The request should be done as it follows:</p>
 <ul>
-  <li> 200 The refactoring is performed and a new RDF graph is returned </li>
-  <li> 404 The recipe does not exists in the manager </li>
-  <li> 500 Some error occurred </li>
-</ul>
-
-Request example which shows how to perform a refactoring
-applying an existing recipe in the rule store:
-<pre style="margin-bottom:40px;">
-$ curl -X GET -G -H "Accept: application/rdf+xml" \
-      -d recipe="http://iks-project.eu/recipies/recipeA"; \
-      -d input-graph="http://iks-project.eu/graphs/graphIn"; \
-      -d output-graph="http://iks-project.eu/graphs/graphOut"; \
-      http://localhost:8080/refactor
-</pre>
+<li>Method: GET</li>
+<li>Parameters:<ul>
+<li>input-graph: the ID of RDF graph in the triplestore provided as input</li>
+<li>output-graph: the ID of RDF graph in the triplestore in which we want to 
store the result.</li>
+<li>recipe: the ID of the recipe in the rule store</li>
+</ul>
+</li>
+</ul>
+<p>Example:</p>
+<div class="codehilite"><pre>curl -G -X GET <span class="se">\</span>
+-d input-graph<span class="o">=</span>stored_graph -d <span 
class="nv">recipe</span><span class="o">=</span>myTestRecipeA -d 
output-graph<span class="o">=</span>result_graph <span class="se">\</span>
+http://localhost:8080/refactor
+</pre></div>
 
-<h3> Refactoring RDF graphs ("/refactor/apply") </h3>
-Request type: POST<br><br>
 
-Accepted MIME types:
+<h3 id="refactor-engine-refactorapply">Refactor Engine 
("/refactor/apply"):</h3>
 <ul>
+<li>Refactor Engine <strong>@/refactor/apply</strong> performs a refactoring 
applying an recipe as string to the provided RDF graph as input source.</li>
+</ul>
+<p>The request should be done as it follows:</p>
+<ul>
+<li>Method: POST</li>
+<li>Parameters:<ul>
+<li>recipe: the ID of the recipe (MANDATORY)</li>
+<li>input: the RDF graph to which the refactoring has to be applied. The graph 
has to be provided as a binary file (MANDATORY)</li>
+</ul>
+</li>
+<li>Accepts:<ul>
 <li>application/rdf+xml</li>
+<li>text/html</li>
+<li>text/plain</li>
+<li>application/owl+xml</li>
+<li>text/owl-functional</li>
 <li>text/owl-manchester</li>
-<li>application/rdf+json</li>
-<li>application/turtle</li>
-<li>application/owl-functional</li>
+<li>application/rdf+json,</li>
+<li>text/turle</li>
 </ul>
-
-Parameters:
-
-<ul>
- <li> <b>recipe (Mandatory).</b> The recipe's identifier that is basically an 
URI</li>
- <li> <b>input-graph (Mandatory).</b> The ID of the graph to transform</li>
- <li> <b>output-graph (Mandatory).</b> The ID that the transformed graph has 
to have in
- the IKS triple store</li>
+</li>
 </ul>
-Possible outputs:
-<ul>
-  <li> 200 The refactoring is performed and a new RDF graph is returned </li>
-  <li> 404 The recipe does not exists in the manager </li>
-  <li> 500 Some error occurred </li>
-</ul>
-
-Request example which shows how to perform a refactoring
-applying an existing recipe in the rule store:
-<pre style="margin-bottom:40px;">
-$ curl -X POST -H "Content-Type: multipart/form-data" \
-      -H "Accept: application/turtle" \
-      -F recipe="
-           has(<http://www.foo.org/myont.owl#hasFather>, ?x, ?z) . \
-           has(<http://www.foo.org/myont.owl#hasBrother>, ?z, ?y) \
-              -> \
-           has(<http://www.foo.org/myont.owl#hasUncle>, ?x, ?y)" \
-      -F [email protected]
-      http://localhost:8080/refactor/apply
-</pre>
+<p>Example:</p>
+<div class="codehilite"><pre>curl -X POST -H <span 
class="s2">&quot;Content-type: multipart/form-data&quot;</span> <span 
class="se">\</span>
+-H <span class="s2">&quot;Accept: application/rdf+json&quot;</span> <span 
class="se">\</span>
+-F <span class="nv">recipe</span><span class="o">=</span>recipeTestA -F <span 
class="nv">input</span><span class="o">=</span>@graph.rdf <span 
class="se">\</span>
+http://localhost:8080/refactor/apply
+</pre></div>
+
 </div>
 </@common.page>
 </#escape>
\ No newline at end of file


Reply via email to