Author: fchrist
Date: Thu Apr 14 11:29:54 2011
New Revision: 1092141

URL: http://svn.apache.org/viewvc?rev=1092141&view=rev
Log:
STANBOL-144 splitted doc of different resources into their own files and made 
them accessible via GET TEXT_HTML on the resource

Added:
    
incubator/stanbol/trunk/entityhub/jersey/src/main/resources/org/apache/stanbol/entityhub/jersey/templates/org/apache/stanbol/entityhub/jersey/resource/SiteManagerRootResource/
    
incubator/stanbol/trunk/entityhub/jersey/src/main/resources/org/apache/stanbol/entityhub/jersey/templates/org/apache/stanbol/entityhub/jersey/resource/SiteManagerRootResource/entity.ftl
    
incubator/stanbol/trunk/entityhub/jersey/src/main/resources/org/apache/stanbol/entityhub/jersey/templates/org/apache/stanbol/entityhub/jersey/resource/SiteManagerRootResource/find.ftl
    
incubator/stanbol/trunk/entityhub/jersey/src/main/resources/org/apache/stanbol/entityhub/jersey/templates/org/apache/stanbol/entityhub/jersey/resource/SiteManagerRootResource/inc_entity.ftl
    
incubator/stanbol/trunk/entityhub/jersey/src/main/resources/org/apache/stanbol/entityhub/jersey/templates/org/apache/stanbol/entityhub/jersey/resource/SiteManagerRootResource/inc_find.ftl
    
incubator/stanbol/trunk/entityhub/jersey/src/main/resources/org/apache/stanbol/entityhub/jersey/templates/org/apache/stanbol/entityhub/jersey/resource/SiteManagerRootResource/inc_query.ftl
    
incubator/stanbol/trunk/entityhub/jersey/src/main/resources/org/apache/stanbol/entityhub/jersey/templates/org/apache/stanbol/entityhub/jersey/resource/SiteManagerRootResource/inc_referenced.ftl
    
incubator/stanbol/trunk/entityhub/jersey/src/main/resources/org/apache/stanbol/entityhub/jersey/templates/org/apache/stanbol/entityhub/jersey/resource/SiteManagerRootResource/index.ftl
    
incubator/stanbol/trunk/entityhub/jersey/src/main/resources/org/apache/stanbol/entityhub/jersey/templates/org/apache/stanbol/entityhub/jersey/resource/SiteManagerRootResource/query.ftl
    
incubator/stanbol/trunk/entityhub/jersey/src/main/resources/org/apache/stanbol/entityhub/jersey/templates/org/apache/stanbol/entityhub/jersey/resource/SiteManagerRootResource/referenced.ftl
    
incubator/stanbol/trunk/entityhub/jersey/src/main/resources/org/apache/stanbol/entityhub/jersey/templates/org/apache/stanbol/entityhub/jersey/resource/SiteManagerRootResource/sitemanager_common.ftl
Modified:
    
incubator/stanbol/trunk/entityhub/jersey/src/main/java/org/apache/stanbol/entityhub/jersey/resource/SiteManagerRootResource.java
    
incubator/stanbol/trunk/entityhub/jersey/src/main/resources/org/apache/stanbol/entityhub/jersey/templates/org/apache/stanbol/entityhub/jersey/resource/EntityhubRootResource/index.ftl

Modified: 
incubator/stanbol/trunk/entityhub/jersey/src/main/java/org/apache/stanbol/entityhub/jersey/resource/SiteManagerRootResource.java
URL: 
http://svn.apache.org/viewvc/incubator/stanbol/trunk/entityhub/jersey/src/main/java/org/apache/stanbol/entityhub/jersey/resource/SiteManagerRootResource.java?rev=1092141&r1=1092140&r2=1092141&view=diff
==============================================================================
--- 
incubator/stanbol/trunk/entityhub/jersey/src/main/java/org/apache/stanbol/entityhub/jersey/resource/SiteManagerRootResource.java
 (original)
+++ 
incubator/stanbol/trunk/entityhub/jersey/src/main/java/org/apache/stanbol/entityhub/jersey/resource/SiteManagerRootResource.java
 Thu Apr 14 11:29:54 2011
@@ -16,12 +16,7 @@
  */
 package org.apache.stanbol.entityhub.jersey.resource;
 
-import static javax.ws.rs.core.MediaType.APPLICATION_FORM_URLENCODED;
-import static javax.ws.rs.core.MediaType.APPLICATION_JSON;
-import static javax.ws.rs.core.MediaType.APPLICATION_JSON_TYPE;
-import static javax.ws.rs.core.MediaType.MULTIPART_FORM_DATA;
-import static javax.ws.rs.core.Response.Status.BAD_REQUEST;
-import static javax.ws.rs.core.Response.Status.NOT_FOUND;
+import static javax.ws.rs.core.MediaType.TEXT_HTML;
 import static org.apache.clerezza.rdf.core.serializedform.SupportedFormat.N3;
 import static 
org.apache.clerezza.rdf.core.serializedform.SupportedFormat.N_TRIPLE;
 import static 
org.apache.clerezza.rdf.core.serializedform.SupportedFormat.RDF_JSON;
@@ -49,6 +44,7 @@ import javax.ws.rs.core.HttpHeaders;
 import javax.ws.rs.core.MediaType;
 import javax.ws.rs.core.Response;
 import javax.ws.rs.core.UriInfo;
+import javax.ws.rs.core.Response.Status;
 
 import org.apache.clerezza.rdf.ontologies.RDFS;
 import org.apache.stanbol.commons.web.base.ContextHelper;
@@ -61,6 +57,8 @@ import org.codehaus.jettison.json.JSONAr
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import com.sun.jersey.api.view.Viewable;
+
 /**
  * Resource to provide a REST API for the {@link ReferencedSiteManager}.
  * 
@@ -92,6 +90,19 @@ public class SiteManagerRootResource ext
         this.context = context;
     }
 
+    @GET
+    @Produces(MediaType.TEXT_HTML)
+    public Response getSitesPage() {
+        return Response.ok(new Viewable("index", this), TEXT_HTML).build();
+    }
+    
+    @GET
+    @Path("/referenced")
+    @Produces(MediaType.TEXT_HTML)
+    public Response getReferencedSitesPage() {
+        return Response.ok(new Viewable("referenced", this), 
TEXT_HTML).build();
+    }
+    
     /**
      * Getter for the id's of all referenced sites
      * 
@@ -99,18 +110,23 @@ public class SiteManagerRootResource ext
      */
     @GET
     @Path(value = "/referenced")
-    @Produces(APPLICATION_JSON)
+    @Produces(MediaType.APPLICATION_JSON)
     public JSONArray getReferencedSites(@Context UriInfo uriInfo) {
-        log.debug("getReferencedSites() request");
         JSONArray referencedSites = new JSONArray();
         ReferencedSiteManager referencedSiteManager = 
ContextHelper.getServiceFromContext(
             ReferencedSiteManager.class, context);
         for (String site : referencedSiteManager.getReferencedSiteIds()) {
             referencedSites.put(String.format("%sentityhub/site/%s/", 
uriInfo.getBaseUri(), site));
         }
-        log.debug("getReferencedSites() returns {}", 
referencedSites.toString());
         return referencedSites;
     }
+    
+    @GET
+    @Path("/entity")
+    @Produces(MediaType.TEXT_HTML)
+    public Response getEntityPage() {
+        return Response.ok(new Viewable("entity", this), TEXT_HTML).build();   
     
+    }
 
     /**
      * Cool URI handler for Signs.
@@ -129,7 +145,7 @@ public class SiteManagerRootResource ext
 
         if (id == null || id.isEmpty()) {
             log.error("getSignById() No or emptpy ID was parsed as query 
parameter (id={})", id);
-            throw new WebApplicationException(BAD_REQUEST);
+            throw new WebApplicationException(Status.BAD_REQUEST);
         }
         ReferencedSiteManager referencedSiteManager = 
ContextHelper.getServiceFromContext(
             ReferencedSiteManager.class, context);
@@ -141,19 +157,26 @@ public class SiteManagerRootResource ext
         // throw new WebApplicationException(e, 
Response.Status.INTERNAL_SERVER_ERROR);
         // }
         final MediaType acceptedMediaType = JerseyUtils
-                .getAcceptableMediaType(headers, APPLICATION_JSON_TYPE);
+                .getAcceptableMediaType(headers, 
MediaType.APPLICATION_JSON_TYPE);
         if (sign != null) {
             return Response.ok(sign, acceptedMediaType).build();
         } else {
             // TODO: How to parse an ErrorMessage?
             // create an Response with the the Error?
             log.info("getSignById() entity {} not found on any referenced 
site");
-            throw new WebApplicationException(NOT_FOUND);
+            throw new WebApplicationException(Status.NOT_FOUND);
         }
     }
 
     @GET
     @Path("/find")
+    @Produces(MediaType.TEXT_HTML)
+    public Response getFindPage() {
+        return Response.ok(new Viewable("find", this), TEXT_HTML).build();
+    }
+    
+    @GET
+    @Path("/find")
     public Response findEntityfromGet(@QueryParam(value = "name") String name,
                                       @FormParam(value = "field") String field,
                                       @QueryParam(value = "lang") String 
language,
@@ -187,10 +210,17 @@ public class SiteManagerRootResource ext
         FieldQuery query = JerseyUtils.createFieldQueryForFindRequest(name, 
field, language,
             limit == null || limit < 1 ? DEFAULT_FIND_RESULT_LIMIT : limit, 
offset);
         final MediaType acceptedMediaType = JerseyUtils
-                .getAcceptableMediaType(headers, APPLICATION_JSON_TYPE);
+                .getAcceptableMediaType(headers, 
MediaType.APPLICATION_JSON_TYPE);
         return Response.ok(referencedSiteManager.find(query), 
acceptedMediaType).build();
     }
 
+    @GET
+    @Path("/query")
+    @Produces(MediaType.TEXT_HTML)
+    public Response getQueryPage() {
+        return Response.ok(new Viewable("query", this), TEXT_HTML).build();
+    }
+    
     /**
      * Allows to parse any kind of {@link FieldQuery} in its JSON 
Representation. Note that the maximum number
      * of results (limit) and the offset of the first result (offset) are 
parsed as seperate parameters and
@@ -212,7 +242,7 @@ public class SiteManagerRootResource ext
      */
     @POST
     @Path("/query")
-    @Consumes( {APPLICATION_FORM_URLENCODED + ";qs=1.0", MULTIPART_FORM_DATA + 
";qs=0.9"})
+    @Consumes( {MediaType.APPLICATION_FORM_URLENCODED + ";qs=1.0", 
MediaType.MULTIPART_FORM_DATA + ";qs=0.9"})
     public Response queryEntities(@FormParam("query") String queryString,
                                   @FormParam("query") File file,
                                   @Context HttpHeaders headers) {

Modified: 
incubator/stanbol/trunk/entityhub/jersey/src/main/resources/org/apache/stanbol/entityhub/jersey/templates/org/apache/stanbol/entityhub/jersey/resource/EntityhubRootResource/index.ftl
URL: 
http://svn.apache.org/viewvc/incubator/stanbol/trunk/entityhub/jersey/src/main/resources/org/apache/stanbol/entityhub/jersey/templates/org/apache/stanbol/entityhub/jersey/resource/EntityhubRootResource/index.ftl?rev=1092141&r1=1092140&r2=1092141&view=diff
==============================================================================
--- 
incubator/stanbol/trunk/entityhub/jersey/src/main/resources/org/apache/stanbol/entityhub/jersey/templates/org/apache/stanbol/entityhub/jersey/resource/EntityhubRootResource/index.ftl
 (original)
+++ 
incubator/stanbol/trunk/entityhub/jersey/src/main/resources/org/apache/stanbol/entityhub/jersey/templates/org/apache/stanbol/entityhub/jersey/resource/EntityhubRootResource/index.ftl
 Thu Apr 14 11:29:54 2011
@@ -8,237 +8,13 @@
 </div>
 
 <div class="panel" id="restapi" style="display: none;">
-<h3>Service Endpoint "/entityhub/sites"</h3>
+<h3>Service Endpoints</h3>
 
-<h4>Subresource /referenced</h4>
+<p>The Entityhub supports the following service endpoints:</p>
 
-<table>
-<tbody>
-       <tr>
-               <th>Description</th>
-               <td>This service returns a json array containing the IDs of all 
-               referenced sites. Sites returned by this Method can be accessed 
via the SITE 
-               service endpoint.</td>
-       </tr>
-       <tr>
-               <th>Request</th>
-               <td>GET /entityhub/sites/referenced</td>
-       </tr>
-       <tr>
-               <th>Parameter</th>
-               <td>none</th>
-       </tr>
-       <tr>
-               <th>Produces</th>
-               <td>application/json</td>
-       </tr>
-</tbody>
-</table>
-
-<h5>Example</h5>
-<pre>curl "http://localhost:8080/entityhub/sites/referenced";</pre>
-
-<h5>Example response</h5>
-<pre>["http:\/\/localhost:8080\/entityhub\/site\/dbpedia\/",
-"http:\/\/localhost:8080\/entityhub\/site\/musicbrainz\/"]</pre>
-
-<h5>Test</h5>
-
-<p>You can check the referenced sites in this installation by
-<a href="#" onclick="listReferencedSites(); return false;">clicking 
here</a>.</p>
-
-<script language="javascript">
-function listReferencedSites() {
- $("#listReferencedSitesResult").show();         
- $.ajax({
-   type: "GET",
-   url: "${it.publicBaseUri}entityhub/sites/referenced",
-   data: "",
-   dataType: "text/plain",
-   cache: false,
-   success: function(result) {
-     $("#listReferencedSitesResultText").text(result);
-   },
-   error: function(result) {
-     $("#listReferencedSitesResultText").text(result);
-   }
- });             
-}
-</script>
-
-<div id="listReferencedSitesResult" style="display: none">
-<p><a href="#" onclick="$('#listReferencedSitesResult').hide(); return 
false;">Hide results</a>
-<pre id="listReferencedSitesResultText">... waiting for results ...</pre>
-</div>
-
-<h4>Subresource /entity?id={URI}</h4>
-
-<table>
-<tbody>
-       <tr>
-               <th>Description</th>
-               <td>This service searches all referenced sites for the entity 
with the 
-    parsed URI and returns the result in the requested entity in the media 
type. 
-    If the requested entity can not be found a 404 is returned.</td>
-       </tr>
-       <tr>
-               <th>Request</th>
-               <td>GET /entityhub/sites/entity?id={URI}</td>
-       </tr>
-       <tr>
-               <th>Parameter</th>
-               <td>id: the URI of the requested Entity</th>
-       </tr>
-       <tr>
-               <th>Produces</th>
-               <td>Depends on requested media type</td>
-       </tr>
-</tbody>
-</table>
-
-<h5>Example</h5>
-
-<pre>curl 
"http://localhost:8080/entityhub/sites/entity?id=http://dbpedia.org/resource/Paris";</pre>
-
-<h5>Test</h5>
-
-<a href="javascript:searchEntityParis()">Search for entity 'Paris' in 
DBPedia</a>.
-
-<script language="javascript">
-function searchEntityParis() {
- $("#searchEntityParisResult").show();   
- $.ajax({
-   type: "GET",
-   url: "${it.publicBaseUri}entityhub/sites/entity",
-   data: "id=http://dbpedia.org/resource/Paris";,
-   dataType: "text/plain",
-   cache: false,
-   success: function(result) {
-     $("#searchEntityParisResultText").text(result);
-   },
-   error: function(result) {
-     $("#searchEntityParisResultText").text(result);
-   }
- });             
-}
-</script>
-
-<div id="searchEntityParisResult" style="display: none">
-<p><a href="#" onclick="$('#searchEntityParisResult').hide(); return 
false;">Hide results</a>
-<pre id="searchEntityParisResultText">... waiting for results ...</pre>
-</div>
-
-<h4>Subresource /find?name={query}</h4>
-
-<table>
-<tbody>
-       <tr>
-               <th>Description</th>
-               <td>This service can be used to search all referenced sites for 
-    entities with the parsed name. Both a POST and a GET version are 
available.</td>
-       </tr>
-       <tr>
-               <th>Requests</th>
-               <td><ul>
-                       <li>GET 
/entityhub/sites/find?name={query}&field={field}&lang={lang}&limit={limit}&offset={offset}</li>
-            <li>POST -d 
"name={query}&field={field}&lang={lang}&limit={limit}&offset={offset}" 
/entityhub/sites/find</li>
-            </ul>
-        </td>
-       </tr>
-       <tr>
-               <th>Parameters</th>
-               <td><ul>
-                       <li>name: the name of the entity (supports wildcards 
e.g. "Frankf*")</li>
-            <li>field: the name of the field used for the query. One MUST 
parse the full
-                name. Namespace prefixes are not supported yet. (default is 
rdfs:label)</li>
-               <li>lang: optionally the language of the parsed name can be 
defined</li>
-               <li>limit: optionally the maximum number of results</li>
-               <li>offset: optionally the offset of first result</li>
-               </ul>
-       </td>
-       </tr>
-       <tr>
-               <th>Produces</th>
-               <td>Depends on requested media type</td>
-       </tr>
-</tbody>
-</table>
-
-<h5>Example</h5>
-
-<pre>curl -X POST -d "name=Bishofsh*&limit=10&offset=0" 
http://localhost:8080/entityhub/sites/find</pre>
-
-<h5>Test</h5>
-
-<form>
-<p>Start test search for
-<input type="text" id="testSearchValue" value="Paderb*" />
-<input type="submit" value="Search" onclick="startTestSearch(); return false;" 
/></p>
-</form>
-
-<script language="javascript">
-function startTestSearch() {
- $("#testSearchResultText").text("... waiting for results ...");
- $("#testSearchResult").show();
- var data = "name=" + $("#testSearchValue").val() + "&limit=10&offset=0";
- $.ajax({
-   type: "POST",
-   url: "${it.publicBaseUri}entityhub/sites/find",
-   data: data,
-   dataType: "text/plain",
-   cache: false,
-   success: function(result) {
-     $("#testSearchResultText").text(result);
-   },
-   error: function(result) {
-     $("#testSearchResultText").text(result);
-   }
- });             
-}
-</script>
-
-<div id="testSearchResult" style="display: none">
-<p><a href="#" onclick="$('#testSearchResult').hide(); return false;">Hide 
results</a>
-<pre id="testSearchResultText">... waiting for results ...</pre>
-</div>
-
-<h4>Subresource /query&query={query}</h4>
-
-<table>
-<tbody>
-       <tr>
-               <th>Description</th>
-               <td>Allows to parse JSON serialized field queries to the sites 
endpoint.</td>
-       </tr>
-       <tr>
-               <th>Request</th>
-               <td>POST -d "query={query}" /entityhub/sites/query</td>
-       </tr>
-       <tr>
-               <th>Parameter</th>
-               <td>query: the JSON serialized FieldQuery (see section 
"FieldQuery JSON format" 
-           below)</td>
-       </tr>
-       <tr>
-               <th>Produces</th>
-               <td>Depends on requested media type</td>
-       </tr>
-</tbody>
-</table>
-
-<h5>Example</h5>
-
-<pre>curl -X POST -F "[email protected]" 
http://localhost:8080/entityhub/site/dbpedia/query</pre>
-
-<p><em>Note</em>: "@fieldQuery.json" links to a local file that contains the 
parsed
-    Fieldquery (see ection "FieldQuery JSON format" for examples).</p>
-<p><em>Note</em>: This method suffers form very bad performance on SPARQL 
endpoints that do 
-    not support extensions for full text searches. On Virtuoso endpoints do 
-    performance well under normal conditions.</p>
-<p><em>Note</em>: Optional selects suffers form very bad performance on any 
SPRQL endpoint.
-    It is recommended to select only fields that are used for constraints. If
-    more data are required it is recommended to dereference found entities 
after
-    receiving initial results of the query.</p>
+<ul>
+       <li>Site Manager @ <a 
href="${it.publicBaseUri}entityhub/sites/">/entityhub/sites</a></li>
+</ul>
 
 </div>
 

Added: 
incubator/stanbol/trunk/entityhub/jersey/src/main/resources/org/apache/stanbol/entityhub/jersey/templates/org/apache/stanbol/entityhub/jersey/resource/SiteManagerRootResource/entity.ftl
URL: 
http://svn.apache.org/viewvc/incubator/stanbol/trunk/entityhub/jersey/src/main/resources/org/apache/stanbol/entityhub/jersey/templates/org/apache/stanbol/entityhub/jersey/resource/SiteManagerRootResource/entity.ftl?rev=1092141&view=auto
==============================================================================
--- 
incubator/stanbol/trunk/entityhub/jersey/src/main/resources/org/apache/stanbol/entityhub/jersey/templates/org/apache/stanbol/entityhub/jersey/resource/SiteManagerRootResource/entity.ftl
 (added)
+++ 
incubator/stanbol/trunk/entityhub/jersey/src/main/resources/org/apache/stanbol/entityhub/jersey/templates/org/apache/stanbol/entityhub/jersey/resource/SiteManagerRootResource/entity.ftl
 Thu Apr 14 11:29:54 2011
@@ -0,0 +1,8 @@
+<#import "sitemanager_common.ftl" as common>
+<#escape x as x?html>
+<@common.page> 
+
+<#include "inc_entity.ftl">
+
+</@common.page>
+</#escape>

Added: 
incubator/stanbol/trunk/entityhub/jersey/src/main/resources/org/apache/stanbol/entityhub/jersey/templates/org/apache/stanbol/entityhub/jersey/resource/SiteManagerRootResource/find.ftl
URL: 
http://svn.apache.org/viewvc/incubator/stanbol/trunk/entityhub/jersey/src/main/resources/org/apache/stanbol/entityhub/jersey/templates/org/apache/stanbol/entityhub/jersey/resource/SiteManagerRootResource/find.ftl?rev=1092141&view=auto
==============================================================================
--- 
incubator/stanbol/trunk/entityhub/jersey/src/main/resources/org/apache/stanbol/entityhub/jersey/templates/org/apache/stanbol/entityhub/jersey/resource/SiteManagerRootResource/find.ftl
 (added)
+++ 
incubator/stanbol/trunk/entityhub/jersey/src/main/resources/org/apache/stanbol/entityhub/jersey/templates/org/apache/stanbol/entityhub/jersey/resource/SiteManagerRootResource/find.ftl
 Thu Apr 14 11:29:54 2011
@@ -0,0 +1,8 @@
+<#import "sitemanager_common.ftl" as common>
+<#escape x as x?html>
+<@common.page> 
+
+<#include "inc_find.ftl">
+
+</@common.page>
+</#escape>

Added: 
incubator/stanbol/trunk/entityhub/jersey/src/main/resources/org/apache/stanbol/entityhub/jersey/templates/org/apache/stanbol/entityhub/jersey/resource/SiteManagerRootResource/inc_entity.ftl
URL: 
http://svn.apache.org/viewvc/incubator/stanbol/trunk/entityhub/jersey/src/main/resources/org/apache/stanbol/entityhub/jersey/templates/org/apache/stanbol/entityhub/jersey/resource/SiteManagerRootResource/inc_entity.ftl?rev=1092141&view=auto
==============================================================================
--- 
incubator/stanbol/trunk/entityhub/jersey/src/main/resources/org/apache/stanbol/entityhub/jersey/templates/org/apache/stanbol/entityhub/jersey/resource/SiteManagerRootResource/inc_entity.ftl
 (added)
+++ 
incubator/stanbol/trunk/entityhub/jersey/src/main/resources/org/apache/stanbol/entityhub/jersey/templates/org/apache/stanbol/entityhub/jersey/resource/SiteManagerRootResource/inc_entity.ftl
 Thu Apr 14 11:29:54 2011
@@ -0,0 +1,56 @@
+<h4>Subresource /entity?id={URI}</h4>
+
+<table>
+<tbody>
+       <tr>
+               <th>Description</th>
+               <td>This service searches all referenced sites for the entity 
with the 
+    parsed URI and returns the result in the requested entity in the media 
type. 
+    If the requested entity can not be found a 404 is returned.</td>
+       </tr>
+       <tr>
+               <th>Request</th>
+               <td>GET /entityhub/sites/entity?id={URI}</td>
+       </tr>
+       <tr>
+               <th>Parameter</th>
+               <td>id: the URI of the requested Entity</th>
+       </tr>
+       <tr>
+               <th>Produces</th>
+               <td>Depends on requested media type</td>
+       </tr>
+</tbody>
+</table>
+
+<h5>Example</h5>
+
+<pre>curl 
"http://localhost:8080/entityhub/sites/entity?id=http://dbpedia.org/resource/Paris";</pre>
+
+<h5>Test</h5>
+
+<a href="javascript:searchEntityParis()">Search for entity 'Paris' in 
DBPedia</a>.
+
+<script language="javascript">
+function searchEntityParis() {
+ $("#searchEntityParisResult").show();   
+ $.ajax({
+   type: "GET",
+   url: "${it.publicBaseUri}entityhub/sites/entity",
+   data: "id=http://dbpedia.org/resource/Paris";,
+   dataType: "text/plain",
+   cache: false,
+   success: function(result) {
+     $("#searchEntityParisResultText").text(result);
+   },
+   error: function(result) {
+     $("#searchEntityParisResultText").text(result);
+   }
+ });             
+}
+</script>
+
+<div id="searchEntityParisResult" style="display: none">
+<p><a href="#" onclick="$('#searchEntityParisResult').hide(); return 
false;">Hide results</a>
+<pre id="searchEntityParisResultText">... waiting for results ...</pre>
+</div>

Added: 
incubator/stanbol/trunk/entityhub/jersey/src/main/resources/org/apache/stanbol/entityhub/jersey/templates/org/apache/stanbol/entityhub/jersey/resource/SiteManagerRootResource/inc_find.ftl
URL: 
http://svn.apache.org/viewvc/incubator/stanbol/trunk/entityhub/jersey/src/main/resources/org/apache/stanbol/entityhub/jersey/templates/org/apache/stanbol/entityhub/jersey/resource/SiteManagerRootResource/inc_find.ftl?rev=1092141&view=auto
==============================================================================
--- 
incubator/stanbol/trunk/entityhub/jersey/src/main/resources/org/apache/stanbol/entityhub/jersey/templates/org/apache/stanbol/entityhub/jersey/resource/SiteManagerRootResource/inc_find.ftl
 (added)
+++ 
incubator/stanbol/trunk/entityhub/jersey/src/main/resources/org/apache/stanbol/entityhub/jersey/templates/org/apache/stanbol/entityhub/jersey/resource/SiteManagerRootResource/inc_find.ftl
 Thu Apr 14 11:29:54 2011
@@ -0,0 +1,73 @@
+<h4>Subresource /find?name={query}</h4>
+
+<table>
+<tbody>
+       <tr>
+               <th>Description</th>
+               <td>This service can be used to search all referenced sites for 
+    entities with the parsed name. Both a POST and a GET version are 
available.</td>
+       </tr>
+       <tr>
+               <th>Requests</th>
+               <td><ul>
+                       <li>GET 
/entityhub/sites/find?name={query}&field={field}&lang={lang}&limit={limit}&offset={offset}</li>
+            <li>POST -d 
"name={query}&field={field}&lang={lang}&limit={limit}&offset={offset}" 
/entityhub/sites/find</li>
+            </ul>
+        </td>
+       </tr>
+       <tr>
+               <th>Parameters</th>
+               <td><ul>
+                       <li>name: the name of the entity (supports wildcards 
e.g. "Frankf*")</li>
+            <li>field: the name of the field used for the query. One MUST 
parse the full
+                name. Namespace prefixes are not supported yet. (default is 
rdfs:label)</li>
+               <li>lang: optionally the language of the parsed name can be 
defined</li>
+               <li>limit: optionally the maximum number of results</li>
+               <li>offset: optionally the offset of first result</li>
+               </ul>
+       </td>
+       </tr>
+       <tr>
+               <th>Produces</th>
+               <td>Depends on requested media type</td>
+       </tr>
+</tbody>
+</table>
+
+<h5>Example</h5>
+
+<pre>curl -X POST -d "name=Bishofsh*&limit=10&offset=0" 
http://localhost:8080/entityhub/sites/find</pre>
+
+<h5>Test</h5>
+
+<form>
+<p>Start test search for
+<input type="text" id="testSearchValue" value="Paderb*" />
+<input type="submit" value="Search" onclick="startTestSearch(); return false;" 
/></p>
+</form>
+
+<script language="javascript">
+function startTestSearch() {
+ $("#testSearchResultText").text("... waiting for results ...");
+ $("#testSearchResult").show();
+ var data = "name=" + $("#testSearchValue").val() + "&limit=10&offset=0";
+ $.ajax({
+   type: "POST",
+   url: "${it.publicBaseUri}entityhub/sites/find",
+   data: data,
+   dataType: "text/plain",
+   cache: false,
+   success: function(result) {
+     $("#testSearchResultText").text(result);
+   },
+   error: function(result) {
+     $("#testSearchResultText").text(result);
+   }
+ });             
+}
+</script>
+
+<div id="testSearchResult" style="display: none">
+<p><a href="#" onclick="$('#testSearchResult').hide(); return false;">Hide 
results</a>
+<pre id="testSearchResultText">... waiting for results ...</pre>
+</div>
\ No newline at end of file

Added: 
incubator/stanbol/trunk/entityhub/jersey/src/main/resources/org/apache/stanbol/entityhub/jersey/templates/org/apache/stanbol/entityhub/jersey/resource/SiteManagerRootResource/inc_query.ftl
URL: 
http://svn.apache.org/viewvc/incubator/stanbol/trunk/entityhub/jersey/src/main/resources/org/apache/stanbol/entityhub/jersey/templates/org/apache/stanbol/entityhub/jersey/resource/SiteManagerRootResource/inc_query.ftl?rev=1092141&view=auto
==============================================================================
--- 
incubator/stanbol/trunk/entityhub/jersey/src/main/resources/org/apache/stanbol/entityhub/jersey/templates/org/apache/stanbol/entityhub/jersey/resource/SiteManagerRootResource/inc_query.ftl
 (added)
+++ 
incubator/stanbol/trunk/entityhub/jersey/src/main/resources/org/apache/stanbol/entityhub/jersey/templates/org/apache/stanbol/entityhub/jersey/resource/SiteManagerRootResource/inc_query.ftl
 Thu Apr 14 11:29:54 2011
@@ -0,0 +1,37 @@
+<h4>Subresource /query&query={query}</h4>
+
+<table>
+<tbody>
+       <tr>
+               <th>Description</th>
+               <td>Allows to parse JSON serialized field queries to the sites 
endpoint.</td>
+       </tr>
+       <tr>
+               <th>Request</th>
+               <td>POST -d "query={query}" /entityhub/sites/query</td>
+       </tr>
+       <tr>
+               <th>Parameter</th>
+               <td>query: the JSON serialized FieldQuery (see section 
"FieldQuery JSON format" 
+           below)</td>
+       </tr>
+       <tr>
+               <th>Produces</th>
+               <td>Depends on requested media type</td>
+       </tr>
+</tbody>
+</table>
+
+<h5>Example</h5>
+
+<pre>curl -X POST -F "[email protected]" 
http://localhost:8080/entityhub/site/dbpedia/query</pre>
+
+<p><em>Note</em>: "@fieldQuery.json" links to a local file that contains the 
parsed
+    Fieldquery (see ection "FieldQuery JSON format" for examples).</p>
+<p><em>Note</em>: This method suffers form very bad performance on SPARQL 
endpoints that do 
+    not support extensions for full text searches. On Virtuoso endpoints do 
+    performance well under normal conditions.</p>
+<p><em>Note</em>: Optional selects suffers form very bad performance on any 
SPRQL endpoint.
+    It is recommended to select only fields that are used for constraints. If
+    more data are required it is recommended to dereference found entities 
after
+    receiving initial results of the query.</p>
\ No newline at end of file

Added: 
incubator/stanbol/trunk/entityhub/jersey/src/main/resources/org/apache/stanbol/entityhub/jersey/templates/org/apache/stanbol/entityhub/jersey/resource/SiteManagerRootResource/inc_referenced.ftl
URL: 
http://svn.apache.org/viewvc/incubator/stanbol/trunk/entityhub/jersey/src/main/resources/org/apache/stanbol/entityhub/jersey/templates/org/apache/stanbol/entityhub/jersey/resource/SiteManagerRootResource/inc_referenced.ftl?rev=1092141&view=auto
==============================================================================
--- 
incubator/stanbol/trunk/entityhub/jersey/src/main/resources/org/apache/stanbol/entityhub/jersey/templates/org/apache/stanbol/entityhub/jersey/resource/SiteManagerRootResource/inc_referenced.ftl
 (added)
+++ 
incubator/stanbol/trunk/entityhub/jersey/src/main/resources/org/apache/stanbol/entityhub/jersey/templates/org/apache/stanbol/entityhub/jersey/resource/SiteManagerRootResource/inc_referenced.ftl
 Thu Apr 14 11:29:54 2011
@@ -0,0 +1,60 @@
+<h4>Subresource /referenced</h4>
+
+<table>
+<tbody>
+       <tr>
+               <th>Description</th>
+               <td>This service returns a json array containing the IDs of all 
+               referenced sites. Sites returned by this Method can be accessed 
via the SITE 
+               service endpoint.</td>
+       </tr>
+       <tr>
+               <th>Request</th>
+               <td>GET /entityhub/sites/referenced</td>
+       </tr>
+       <tr>
+               <th>Parameter</th>
+               <td>none</th>
+       </tr>
+       <tr>
+               <th>Produces</th>
+               <td>application/json</td>
+       </tr>
+</tbody>
+</table>
+
+<h5>Example</h5>
+<pre>curl "http://localhost:8080/entityhub/sites/referenced";</pre>
+
+<h5>Example response</h5>
+<pre>["http:\/\/localhost:8080\/entityhub\/site\/dbpedia\/",
+"http:\/\/localhost:8080\/entityhub\/site\/musicbrainz\/"]</pre>
+
+<h5>Test</h5>
+
+<p>You can check the referenced sites in this installation by
+<a href="#" onclick="listReferencedSites(); return false;">clicking 
here</a>.</p>
+
+<script language="javascript">
+function listReferencedSites() {
+ $("#listReferencedSitesResult").show();         
+ $.ajax({
+   type: "GET",
+   url: "${it.publicBaseUri}entityhub/sites/referenced",
+   data: "",
+   dataType: "text/plain",
+   cache: false,
+   success: function(result) {
+     $("#listReferencedSitesResultText").text(result);
+   },
+   error: function(result) {
+     $("#listReferencedSitesResultText").text(result);
+   }
+ });             
+}
+</script>
+
+<div id="listReferencedSitesResult" style="display: none">
+<p><a href="#" onclick="$('#listReferencedSitesResult').hide(); return 
false;">Hide results</a>
+<pre id="listReferencedSitesResultText">... waiting for results ...</pre>
+</div>
\ No newline at end of file

Added: 
incubator/stanbol/trunk/entityhub/jersey/src/main/resources/org/apache/stanbol/entityhub/jersey/templates/org/apache/stanbol/entityhub/jersey/resource/SiteManagerRootResource/index.ftl
URL: 
http://svn.apache.org/viewvc/incubator/stanbol/trunk/entityhub/jersey/src/main/resources/org/apache/stanbol/entityhub/jersey/templates/org/apache/stanbol/entityhub/jersey/resource/SiteManagerRootResource/index.ftl?rev=1092141&view=auto
==============================================================================
--- 
incubator/stanbol/trunk/entityhub/jersey/src/main/resources/org/apache/stanbol/entityhub/jersey/templates/org/apache/stanbol/entityhub/jersey/resource/SiteManagerRootResource/index.ftl
 (added)
+++ 
incubator/stanbol/trunk/entityhub/jersey/src/main/resources/org/apache/stanbol/entityhub/jersey/templates/org/apache/stanbol/entityhub/jersey/resource/SiteManagerRootResource/index.ftl
 Thu Apr 14 11:29:54 2011
@@ -0,0 +1,19 @@
+<#import "sitemanager_common.ftl" as common>
+<#escape x as x?html>
+<@common.page> 
+
+<p>List of subresources:</p>
+<ul>
+       <li><a 
href="${it.publicBaseUri}entityhub/sites/referenced">/entityhub/sites/referenced</a></li>
+       <li><a 
href="${it.publicBaseUri}entityhub/sites/entity">/entityhub/sites/entity</a></li>
+       <li><a 
href="${it.publicBaseUri}entityhub/sites/find">/entityhub/sites/find</a></li>
+       <li><a 
href="${it.publicBaseUri}entityhub/sites/query">/entityhub/sites/query</a></li>
+</ul>
+
+<#include "inc_referenced.ftl">
+<#include "inc_entity.ftl">
+<#include "inc_find.ftl">
+<#include "inc_query.ftl">
+
+</@common.page>
+</#escape>

Added: 
incubator/stanbol/trunk/entityhub/jersey/src/main/resources/org/apache/stanbol/entityhub/jersey/templates/org/apache/stanbol/entityhub/jersey/resource/SiteManagerRootResource/query.ftl
URL: 
http://svn.apache.org/viewvc/incubator/stanbol/trunk/entityhub/jersey/src/main/resources/org/apache/stanbol/entityhub/jersey/templates/org/apache/stanbol/entityhub/jersey/resource/SiteManagerRootResource/query.ftl?rev=1092141&view=auto
==============================================================================
--- 
incubator/stanbol/trunk/entityhub/jersey/src/main/resources/org/apache/stanbol/entityhub/jersey/templates/org/apache/stanbol/entityhub/jersey/resource/SiteManagerRootResource/query.ftl
 (added)
+++ 
incubator/stanbol/trunk/entityhub/jersey/src/main/resources/org/apache/stanbol/entityhub/jersey/templates/org/apache/stanbol/entityhub/jersey/resource/SiteManagerRootResource/query.ftl
 Thu Apr 14 11:29:54 2011
@@ -0,0 +1,8 @@
+<#import "sitemanager_common.ftl" as common>
+<#escape x as x?html>
+<@common.page> 
+
+<#include "inc_query.ftl">
+
+</@common.page>
+</#escape>

Added: 
incubator/stanbol/trunk/entityhub/jersey/src/main/resources/org/apache/stanbol/entityhub/jersey/templates/org/apache/stanbol/entityhub/jersey/resource/SiteManagerRootResource/referenced.ftl
URL: 
http://svn.apache.org/viewvc/incubator/stanbol/trunk/entityhub/jersey/src/main/resources/org/apache/stanbol/entityhub/jersey/templates/org/apache/stanbol/entityhub/jersey/resource/SiteManagerRootResource/referenced.ftl?rev=1092141&view=auto
==============================================================================
--- 
incubator/stanbol/trunk/entityhub/jersey/src/main/resources/org/apache/stanbol/entityhub/jersey/templates/org/apache/stanbol/entityhub/jersey/resource/SiteManagerRootResource/referenced.ftl
 (added)
+++ 
incubator/stanbol/trunk/entityhub/jersey/src/main/resources/org/apache/stanbol/entityhub/jersey/templates/org/apache/stanbol/entityhub/jersey/resource/SiteManagerRootResource/referenced.ftl
 Thu Apr 14 11:29:54 2011
@@ -0,0 +1,8 @@
+<#import "sitemanager_common.ftl" as common>
+<#escape x as x?html>
+<@common.page> 
+
+<#include "inc_referenced.ftl">
+
+</@common.page>
+</#escape>

Added: 
incubator/stanbol/trunk/entityhub/jersey/src/main/resources/org/apache/stanbol/entityhub/jersey/templates/org/apache/stanbol/entityhub/jersey/resource/SiteManagerRootResource/sitemanager_common.ftl
URL: 
http://svn.apache.org/viewvc/incubator/stanbol/trunk/entityhub/jersey/src/main/resources/org/apache/stanbol/entityhub/jersey/templates/org/apache/stanbol/entityhub/jersey/resource/SiteManagerRootResource/sitemanager_common.ftl?rev=1092141&view=auto
==============================================================================
--- 
incubator/stanbol/trunk/entityhub/jersey/src/main/resources/org/apache/stanbol/entityhub/jersey/templates/org/apache/stanbol/entityhub/jersey/resource/SiteManagerRootResource/sitemanager_common.ftl
 (added)
+++ 
incubator/stanbol/trunk/entityhub/jersey/src/main/resources/org/apache/stanbol/entityhub/jersey/templates/org/apache/stanbol/entityhub/jersey/resource/SiteManagerRootResource/sitemanager_common.ftl
 Thu Apr 14 11:29:54 2011
@@ -0,0 +1,15 @@
+<#macro page>
+<#import "/imports/common.ftl" as common>
+<#escape x as x?html>
+<@common.page title="Entityhub Site Manager" hasrestapi=false> 
+
+<div class="panel" id="restapi">
+<h3>Service Endpoint <a 
href="${it.publicBaseUri}entityhub/sites">/entityhub/sites</a></h3>
+
+<#nested>
+
+</div>
+
+</@common.page>
+</#escape>
+</#macro>
\ No newline at end of file


Reply via email to