You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@stanbol.apache.org by fc...@apache.org on 2011/04/15 16:48:01 UTC
svn commit: r1092727 - in /incubator/stanbol/trunk/entityhub/jersey/src/main:
java/org/apache/stanbol/entityhub/jersey/resource/
resources/org/apache/stanbol/entityhub/jersey/templates/org/apache/stanbol/entityhub/jersey/resource/EntityMappingResource/...
Author: fchrist
Date: Fri Apr 15 14:48:00 2011
New Revision: 1092727
URL: http://svn.apache.org/viewvc?rev=1092727&view=rev
Log:
STANBOL-173 improved doc by adding mapping/entity and mapping/symbol endpoint docs
Added:
incubator/stanbol/trunk/entityhub/jersey/src/main/resources/org/apache/stanbol/entityhub/jersey/templates/org/apache/stanbol/entityhub/jersey/resource/EntityMappingResource/entity.ftl
incubator/stanbol/trunk/entityhub/jersey/src/main/resources/org/apache/stanbol/entityhub/jersey/templates/org/apache/stanbol/entityhub/jersey/resource/EntityMappingResource/inc_entity.ftl
incubator/stanbol/trunk/entityhub/jersey/src/main/resources/org/apache/stanbol/entityhub/jersey/templates/org/apache/stanbol/entityhub/jersey/resource/EntityMappingResource/inc_symbol.ftl
incubator/stanbol/trunk/entityhub/jersey/src/main/resources/org/apache/stanbol/entityhub/jersey/templates/org/apache/stanbol/entityhub/jersey/resource/EntityMappingResource/symbol.ftl
incubator/stanbol/trunk/entityhub/jersey/src/main/resources/org/apache/stanbol/entityhub/jersey/templates/org/apache/stanbol/entityhub/jersey/resource/SymbolResource/find.ftl
incubator/stanbol/trunk/entityhub/jersey/src/main/resources/org/apache/stanbol/entityhub/jersey/templates/org/apache/stanbol/entityhub/jersey/resource/SymbolResource/inc_find.ftl
Modified:
incubator/stanbol/trunk/entityhub/jersey/src/main/java/org/apache/stanbol/entityhub/jersey/resource/EntityMappingResource.java
incubator/stanbol/trunk/entityhub/jersey/src/main/java/org/apache/stanbol/entityhub/jersey/resource/SymbolResource.java
incubator/stanbol/trunk/entityhub/jersey/src/main/resources/org/apache/stanbol/entityhub/jersey/templates/org/apache/stanbol/entityhub/jersey/resource/EntityMappingResource/inc_mapping.ftl
incubator/stanbol/trunk/entityhub/jersey/src/main/resources/org/apache/stanbol/entityhub/jersey/templates/org/apache/stanbol/entityhub/jersey/resource/EntityMappingResource/index.ftl
incubator/stanbol/trunk/entityhub/jersey/src/main/resources/org/apache/stanbol/entityhub/jersey/templates/org/apache/stanbol/entityhub/jersey/resource/EntityMappingResource/mapping_common.ftl
incubator/stanbol/trunk/entityhub/jersey/src/main/resources/org/apache/stanbol/entityhub/jersey/templates/org/apache/stanbol/entityhub/jersey/resource/SymbolResource/inc_lookup.ftl
incubator/stanbol/trunk/entityhub/jersey/src/main/resources/org/apache/stanbol/entityhub/jersey/templates/org/apache/stanbol/entityhub/jersey/resource/SymbolResource/index.ftl
Modified: incubator/stanbol/trunk/entityhub/jersey/src/main/java/org/apache/stanbol/entityhub/jersey/resource/EntityMappingResource.java
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/entityhub/jersey/src/main/java/org/apache/stanbol/entityhub/jersey/resource/EntityMappingResource.java?rev=1092727&r1=1092726&r2=1092727&view=diff
==============================================================================
--- incubator/stanbol/trunk/entityhub/jersey/src/main/java/org/apache/stanbol/entityhub/jersey/resource/EntityMappingResource.java (original)
+++ incubator/stanbol/trunk/entityhub/jersey/src/main/java/org/apache/stanbol/entityhub/jersey/resource/EntityMappingResource.java Fri Apr 15 14:48:00 2011
@@ -19,7 +19,6 @@ package org.apache.stanbol.entityhub.jer
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.TEXT_HTML;
-import static javax.ws.rs.core.Response.Status.BAD_REQUEST;
import static javax.ws.rs.core.Response.Status.INTERNAL_SERVER_ERROR;
import static org.apache.clerezza.rdf.core.serializedform.SupportedFormat.N3;
import static org.apache.clerezza.rdf.core.serializedform.SupportedFormat.N_TRIPLE;
@@ -74,12 +73,14 @@ public class EntityMappingResource exten
}
@GET
+ @Path("/")
@Produces(MediaType.TEXT_HTML)
- public Response getEntityMappingPage() {
+ public Response getMappingPage() {
return Response.ok(new Viewable("index", this), TEXT_HTML).build();
}
@GET
+ @Path("/")
@Produces( {APPLICATION_JSON, RDF_XML, N3, TURTLE, X_TURTLE, RDF_JSON, N_TRIPLE})
public Response getMapping(@QueryParam("id") String reference, @Context HttpHeaders headers)
throws WebApplicationException {
@@ -107,6 +108,13 @@ public class EntityMappingResource exten
return Response.ok(mapping, acceptedMediaType).build();
}
}
+
+ @GET
+ @Path("/entity")
+ @Produces(MediaType.TEXT_HTML)
+ public Response getEntityMappingPage() {
+ return Response.ok(new Viewable("entity", this), TEXT_HTML).build();
+ }
@GET
@Path("/entity")
@@ -115,11 +123,14 @@ public class EntityMappingResource exten
throws WebApplicationException {
log.debug("getEntityMapping() POST Request > entity: {} > accept: {}",
entity, headers.getAcceptableMediaTypes());
+
+ MediaType acceptedMediaType = JerseyUtils.getAcceptableMediaType(headers, APPLICATION_JSON_TYPE);
if (entity == null || entity.isEmpty()) {
- // TODO: how to parse an error message
- throw new WebApplicationException(BAD_REQUEST);
+ return Response.status(Status.BAD_REQUEST).entity("No entity given. Missing parameter ID.")
+ .header(HttpHeaders.ACCEPT, acceptedMediaType).build();
}
+
Entityhub entityhub = ContextHelper.getServiceFromContext(Entityhub.class, context);
EntityMapping mapping;
try {
@@ -128,24 +139,33 @@ public class EntityMappingResource exten
throw new WebApplicationException(e, INTERNAL_SERVER_ERROR);
}
if (mapping == null) {
- throw new WebApplicationException(404);
+ return Response.status(Status.NOT_FOUND).entity("No mapping found for entity '" + entity + "'.")
+ .header(HttpHeaders.ACCEPT, acceptedMediaType).build();
} else {
- MediaType acceptedMediaType = JerseyUtils.getAcceptableMediaType(headers, APPLICATION_JSON_TYPE);
return Response.ok(mapping, acceptedMediaType).build();
}
}
@GET
@Path("/symbol")
+ @Produces(MediaType.TEXT_HTML)
+ public Response getSymbolMappingPage() {
+ return Response.ok(new Viewable("symbol", this), TEXT_HTML).build();
+ }
+
+ @GET
+ @Path("/symbol")
@Produces( {APPLICATION_JSON, RDF_XML, N3, TURTLE, X_TURTLE, RDF_JSON, N_TRIPLE})
public Response getSymbolMappings(@QueryParam("id") String symbol, @Context HttpHeaders headers)
throws WebApplicationException {
log.debug("getSymbolMappings() POST Request > symbol: {} > accept: {}",
symbol, headers.getAcceptableMediaTypes());
+
+ MediaType acceptedMediaType = JerseyUtils.getAcceptableMediaType(headers, APPLICATION_JSON_TYPE);
if (symbol == null || symbol.isEmpty()) {
- // TODO: how to parse an error message
- throw new WebApplicationException(BAD_REQUEST);
+ return Response.status(Status.BAD_REQUEST).entity("No symbol given. Missing parameter ID.")
+ .header(HttpHeaders.ACCEPT, acceptedMediaType).build();
}
Entityhub entityhub = ContextHelper.getServiceFromContext(Entityhub.class, context);
Collection<EntityMapping> mappings;
@@ -155,9 +175,9 @@ public class EntityMappingResource exten
throw new WebApplicationException(e, INTERNAL_SERVER_ERROR);
}
if (mappings == null || mappings.isEmpty()) {
- throw new WebApplicationException(404);
+ return Response.status(Status.NOT_FOUND).entity("No mapping found for symbol '" + symbol + "'.")
+ .header(HttpHeaders.ACCEPT, acceptedMediaType).build();
} else {
- MediaType acceptedMediaType = JerseyUtils.getAcceptableMediaType(headers, APPLICATION_JSON_TYPE);
// TODO: Implement Support for list of Signs, Representations and Strings
// For now use a pseudo QueryResultList
QueryResultList<EntityMapping> mappingResultList = new QueryResultListImpl<EntityMapping>(null,
Modified: incubator/stanbol/trunk/entityhub/jersey/src/main/java/org/apache/stanbol/entityhub/jersey/resource/SymbolResource.java
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/entityhub/jersey/src/main/java/org/apache/stanbol/entityhub/jersey/resource/SymbolResource.java?rev=1092727&r1=1092726&r2=1092727&view=diff
==============================================================================
--- incubator/stanbol/trunk/entityhub/jersey/src/main/java/org/apache/stanbol/entityhub/jersey/resource/SymbolResource.java (original)
+++ incubator/stanbol/trunk/entityhub/jersey/src/main/java/org/apache/stanbol/entityhub/jersey/resource/SymbolResource.java Fri Apr 15 14:48:00 2011
@@ -167,6 +167,13 @@ public class SymbolResource extends Base
}
}
+ @GET
+ @Path("/find")
+ @Produces(MediaType.TEXT_HTML)
+ public Response getSymbolFindPage() {
+ return Response.ok(new Viewable("find", this), TEXT_HTML).build();
+ }
+
@POST
@Path("/find")
@Produces( {APPLICATION_JSON, RDF_XML, N3, TURTLE, X_TURTLE, RDF_JSON, N_TRIPLE})
@@ -242,7 +249,7 @@ public class SymbolResource extends Base
return executeQuery(JerseyUtils.parseFieldQuery(query, file), headers);
}
-/**
+ /**
* Executes the query parsed by {@link #queryEntities(String, File, HttpHeaders)}
* or created based {@link #findEntity(String, String, String, String, HttpHeaders)
* @param query The query to execute
Added: incubator/stanbol/trunk/entityhub/jersey/src/main/resources/org/apache/stanbol/entityhub/jersey/templates/org/apache/stanbol/entityhub/jersey/resource/EntityMappingResource/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/EntityMappingResource/entity.ftl?rev=1092727&view=auto
==============================================================================
--- incubator/stanbol/trunk/entityhub/jersey/src/main/resources/org/apache/stanbol/entityhub/jersey/templates/org/apache/stanbol/entityhub/jersey/resource/EntityMappingResource/entity.ftl (added)
+++ incubator/stanbol/trunk/entityhub/jersey/src/main/resources/org/apache/stanbol/entityhub/jersey/templates/org/apache/stanbol/entityhub/jersey/resource/EntityMappingResource/entity.ftl Fri Apr 15 14:48:00 2011
@@ -0,0 +1,8 @@
+<#import "mapping_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/EntityMappingResource/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/EntityMappingResource/inc_entity.ftl?rev=1092727&view=auto
==============================================================================
--- incubator/stanbol/trunk/entityhub/jersey/src/main/resources/org/apache/stanbol/entityhub/jersey/templates/org/apache/stanbol/entityhub/jersey/resource/EntityMappingResource/inc_entity.ftl (added)
+++ incubator/stanbol/trunk/entityhub/jersey/src/main/resources/org/apache/stanbol/entityhub/jersey/templates/org/apache/stanbol/entityhub/jersey/resource/EntityMappingResource/inc_entity.ftl Fri Apr 15 14:48:00 2011
@@ -0,0 +1,58 @@
+<h4>Subresource /mapping/entity</h4>
+
+<table>
+<tbody>
+ <tr>
+ <th>Description</th>
+ <td>This service allows to retrieve the mapping for an entity. If no mapping for the parsed URI is
+ defined, the service returns a 404 "Not Found".</td>
+ </tr>
+ <tr>
+ <th>Request</th>
+ <td>GET /mapping/entity?id={uri} </td>
+ </tr>
+ <tr>
+ <th>Parameter</th>
+ <td>id: The URI of the entity</td>
+ </tr>
+ <tr>
+ <th>Produces</th>
+ <td>Depends on requested media type</td>
+ </tr>
+</tbody>
+</table>
+
+<h5>Example</h5>
+
+<pre>curl ${it.publicBaseUri}entityhub/mapping/entity?id=http://dbpedia.org/resource/Paris</pre>
+
+<h5>Test</h5>
+
+<form id="getMappingForEntityForm">
+<p>Get mapping for entity
+<input type="text" size="50" id="mappingEntityId" name="id" value="" />
+<input type="submit" value="Get Mapping" onclick="getMappingForEntity(); return false;" /></p>
+</form>
+
+<script language="javascript">
+function getMappingForEntity() {
+ $("#mappingForEntityResult").show();
+ $.ajax({
+ type: "GET",
+ url: "${it.publicBaseUri}entityhub/mapping/entity?id=" + $("#mappingEntityId").val(),
+ dataType: "json",
+ cache: false,
+ success: function(data, textStatus, jqXHR) {
+ $("#mappingForEntityResultText").text(data.toString());
+ },
+ error: function(jqXHR, textStatus, errorThrown) {
+ $("#mappingForEntityResultText").text(jqXHR.statusText + " - " + jqXHR.responseText);
+ }
+ });
+}
+</script>
+
+<div id="mappingForEntityResult" style="display: none">
+<p><a href="#" onclick="$('#mappingForEntityResult').hide(); return false;">Hide results</a>
+<pre id="mappingForEntityResultText">... waiting for results ...</pre>
+</div>
Modified: incubator/stanbol/trunk/entityhub/jersey/src/main/resources/org/apache/stanbol/entityhub/jersey/templates/org/apache/stanbol/entityhub/jersey/resource/EntityMappingResource/inc_mapping.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/EntityMappingResource/inc_mapping.ftl?rev=1092727&r1=1092726&r2=1092727&view=diff
==============================================================================
--- incubator/stanbol/trunk/entityhub/jersey/src/main/resources/org/apache/stanbol/entityhub/jersey/templates/org/apache/stanbol/entityhub/jersey/resource/EntityMappingResource/inc_mapping.ftl (original)
+++ incubator/stanbol/trunk/entityhub/jersey/src/main/resources/org/apache/stanbol/entityhub/jersey/templates/org/apache/stanbol/entityhub/jersey/resource/EntityMappingResource/inc_mapping.ftl Fri Apr 15 14:48:00 2011
@@ -5,8 +5,7 @@
<tr>
<th>Description</th>
<td>Service to get a mapping by its ID which is encoded as an URI. You need to know the mapping URI
- to use this service and you can retrieve such a mapping URI by creating a new symbol using the
- <a href="${it.publicBaseUri}entityhub/symbol/lookup">symbol/lookup</a> endpoint.</td>
+ to use this service.</td>
</tr>
<tr>
<th>Request</th>
@@ -25,12 +24,9 @@
<h5>Example</h5>
-<pre>curl "${it.publicBaseUri}entityhub/mapping?id=urn:org.apache.stanbol:entityhub:symbol.1e05cc86-07bb-7281-5a19-0d4d0d8e054e"</pre>
-
+<pre>curl "${it.publicBaseUri}entityhub/mapping?id=</pre>
<h5>Test</h5>
-<p>To test this
-
<form id="getMappingForUriForm">
<p>Get mapping for URI
<input type="text" size="50" id="mappingId" name="id" value="" />
@@ -44,7 +40,7 @@ function getMappingForUri() {
type: "GET",
url: "${it.publicBaseUri}entityhub/mapping",
data: $("#getMappingForUriForm").serialize(),
- dataType: "json",
+ dataType: "text/plain",
cache: false,
success: function(data, textStatus, jqXHR) {
$("#mappingResultText").text(data);
Added: incubator/stanbol/trunk/entityhub/jersey/src/main/resources/org/apache/stanbol/entityhub/jersey/templates/org/apache/stanbol/entityhub/jersey/resource/EntityMappingResource/inc_symbol.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/EntityMappingResource/inc_symbol.ftl?rev=1092727&view=auto
==============================================================================
--- incubator/stanbol/trunk/entityhub/jersey/src/main/resources/org/apache/stanbol/entityhub/jersey/templates/org/apache/stanbol/entityhub/jersey/resource/EntityMappingResource/inc_symbol.ftl (added)
+++ incubator/stanbol/trunk/entityhub/jersey/src/main/resources/org/apache/stanbol/entityhub/jersey/templates/org/apache/stanbol/entityhub/jersey/resource/EntityMappingResource/inc_symbol.ftl Fri Apr 15 14:48:00 2011
@@ -0,0 +1,60 @@
+<h4>Subresource /mapping/symbol</h4>
+
+<table>
+<tbody>
+ <tr>
+ <th>Description</th>
+ <td>This service allows to retrieve the mapping for a symbol. If no mapping for the parsed URI is
+ defined, the service returns a 404 "Not Found". You can retrieve such an URI by looking up the symbol
+ of the entity using the <a href="${it.publicBaseUri}entityhub/symbol/lookup">symbol/lookup</a>
+ endpoint.</td>
+ </tr>
+ <tr>
+ <th>Request</th>
+ <td>GET /mapping/symbol?id={uri} </td>
+ </tr>
+ <tr>
+ <th>Parameter</th>
+ <td>id: The URI of the entity</td>
+ </tr>
+ <tr>
+ <th>Produces</th>
+ <td>Depends on requested media type</td>
+ </tr>
+</tbody>
+</table>
+
+<h5>Example</h5>
+
+<pre>curl ${it.publicBaseUri}entityhub/mapping/symbol?id=urn:org.apache.stanbol:entityhub:symbol.1265dfa5-f39a-a033-4d0a-0dc0bfb53fb7</pre>
+
+<h5>Test</h5>
+
+<form id="getMappingForSymbolForm">
+<p>Get mapping for symbol
+<input type="text" size="50" id="mappingSymbolId" name="id" value="" />
+<input type="submit" value="Get Mapping" onclick="getMappingForSymbol(); return false;" /></p>
+</form>
+
+<script language="javascript">
+function getMappingForSymbol() {
+ $("#mappingForSymbolResult").show();
+ $.ajax({
+ type: "GET",
+ url: "${it.publicBaseUri}entityhub/mapping/symbol?id=" + $("#mappingSymbolId").val(),
+ dataType: "text/plain",
+ cache: false,
+ success: function(data, textStatus, jqXHR) {
+ $("#mappingForSymbolResultText").text(data.toString());
+ },
+ error: function(jqXHR, textStatus, errorThrown) {
+ $("#mappingForSymbolResultText").text(jqXHR.statusText + " - " + jqXHR.responseText);
+ }
+ });
+}
+</script>
+
+<div id="mappingForSymbolResult" style="display: none">
+<p><a href="#" onclick="$('#mappingForSymbolResult').hide(); return false;">Hide results</a>
+<pre id="mappingForSymbolResultText">... waiting for results ...</pre>
+</div>
Modified: incubator/stanbol/trunk/entityhub/jersey/src/main/resources/org/apache/stanbol/entityhub/jersey/templates/org/apache/stanbol/entityhub/jersey/resource/EntityMappingResource/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/EntityMappingResource/index.ftl?rev=1092727&r1=1092726&r2=1092727&view=diff
==============================================================================
--- incubator/stanbol/trunk/entityhub/jersey/src/main/resources/org/apache/stanbol/entityhub/jersey/templates/org/apache/stanbol/entityhub/jersey/resource/EntityMappingResource/index.ftl (original)
+++ incubator/stanbol/trunk/entityhub/jersey/src/main/resources/org/apache/stanbol/entityhub/jersey/templates/org/apache/stanbol/entityhub/jersey/resource/EntityMappingResource/index.ftl Fri Apr 15 14:48:00 2011
@@ -4,8 +4,11 @@
<p>List of subresources:</p>
<ul>
+ <li><a href="${it.publicBaseUri}entityhub/mapping/symbol">/entityhub/mapping/symbol</a></li>
<li><a href="${it.publicBaseUri}entityhub/mapping/entity">/entityhub/mapping/entity</a></li>
</ul>
+<#include "inc_mapping.ftl">
+
</...@common.page>
</#escape>
Modified: incubator/stanbol/trunk/entityhub/jersey/src/main/resources/org/apache/stanbol/entityhub/jersey/templates/org/apache/stanbol/entityhub/jersey/resource/EntityMappingResource/mapping_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/EntityMappingResource/mapping_common.ftl?rev=1092727&r1=1092726&r2=1092727&view=diff
==============================================================================
--- incubator/stanbol/trunk/entityhub/jersey/src/main/resources/org/apache/stanbol/entityhub/jersey/templates/org/apache/stanbol/entityhub/jersey/resource/EntityMappingResource/mapping_common.ftl (original)
+++ incubator/stanbol/trunk/entityhub/jersey/src/main/resources/org/apache/stanbol/entityhub/jersey/templates/org/apache/stanbol/entityhub/jersey/resource/EntityMappingResource/mapping_common.ftl Fri Apr 15 14:48:00 2011
@@ -6,8 +6,6 @@
<div class="panel" id="restapi">
<h3>Service Endpoint <a href="${it.publicBaseUri}entityhub/mapping">/entityhub/mapping</a></h3>
-<#include "inc_mapping.ftl">
-
<#nested>
</div>
Added: incubator/stanbol/trunk/entityhub/jersey/src/main/resources/org/apache/stanbol/entityhub/jersey/templates/org/apache/stanbol/entityhub/jersey/resource/EntityMappingResource/symbol.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/EntityMappingResource/symbol.ftl?rev=1092727&view=auto
==============================================================================
--- incubator/stanbol/trunk/entityhub/jersey/src/main/resources/org/apache/stanbol/entityhub/jersey/templates/org/apache/stanbol/entityhub/jersey/resource/EntityMappingResource/symbol.ftl (added)
+++ incubator/stanbol/trunk/entityhub/jersey/src/main/resources/org/apache/stanbol/entityhub/jersey/templates/org/apache/stanbol/entityhub/jersey/resource/EntityMappingResource/symbol.ftl Fri Apr 15 14:48:00 2011
@@ -0,0 +1,8 @@
+<#import "mapping_common.ftl" as common>
+<#escape x as x?html>
+<@common.page>
+
+<#include "inc_symbol.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/SymbolResource/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/SymbolResource/find.ftl?rev=1092727&view=auto
==============================================================================
--- incubator/stanbol/trunk/entityhub/jersey/src/main/resources/org/apache/stanbol/entityhub/jersey/templates/org/apache/stanbol/entityhub/jersey/resource/SymbolResource/find.ftl (added)
+++ incubator/stanbol/trunk/entityhub/jersey/src/main/resources/org/apache/stanbol/entityhub/jersey/templates/org/apache/stanbol/entityhub/jersey/resource/SymbolResource/find.ftl Fri Apr 15 14:48:00 2011
@@ -0,0 +1,8 @@
+<#import "symbol_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/SymbolResource/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/SymbolResource/inc_find.ftl?rev=1092727&view=auto
==============================================================================
--- incubator/stanbol/trunk/entityhub/jersey/src/main/resources/org/apache/stanbol/entityhub/jersey/templates/org/apache/stanbol/entityhub/jersey/resource/SymbolResource/inc_find.ftl (added)
+++ incubator/stanbol/trunk/entityhub/jersey/src/main/resources/org/apache/stanbol/entityhub/jersey/templates/org/apache/stanbol/entityhub/jersey/resource/SymbolResource/inc_find.ftl Fri Apr 15 14:48:00 2011
@@ -0,0 +1,69 @@
+<h4>Subresource /symbol/find</h4>
+
+<table>
+<tbody>
+ <tr>
+ <th>Description</th>
+ <td>Find a symbol by specifying name, field, language, limit, offset, and selected fields.</td>
+ </tr>
+ <tr>
+ <th>Request</th>
+ <td>POST /symbol/find</td>
+ </tr>
+ <tr>
+ <th>Parameter</th>
+ <td><ul><li>name: </li>
+ <li>field: </li>
+ <li>language: </li>
+ <li>limit: </li>
+ <li>offset: </li>
+ <li>select: </li>
+ </ul>
+ </td>
+ </tr>
+ <tr>
+ <th>Produces</th>
+ <td>Depends on requested media type</td>
+ </tr>
+</tbody>
+</table>
+
+<h5>Example</h5>
+
+<pre>curl ${it.publicBaseUri}entityhub/symbol/find</pre>
+
+<h5>Test</h5>
+
+<p>Find symbol by searching for 'Paris' for the language 'de'.<br>
+<a href="#" onclick="findSymbol(); return false;">Go and find symbol</a>
+<form name="findSymbolForm" id="findSymbolForm" style="display: none">
+ <input type="hidden" name="name" value="Paris">
+ <input type="hidden" name="lang" value="de">
+</form>
+</p>
+
+<script language="javascript">
+function findSymbol() {
+ $("#findSymbolResult").hide();
+ $("#findSymbolResultText").text("... waiting for results ...");
+ $("#findSymbolResult").show();
+ $.ajax({
+ type: 'POST',
+ url: "${it.publicBaseUri}entityhub/symbol/find",
+ data: $("#findSymbolForm").serialize(),
+ dataType: "text/plain",
+ cache: false,
+ success: function(data) {
+ $("#findSymbolResultText").text(data);
+ },
+ error: function(jqXHR, textStatus, errorThrown) {
+ $("#findSymbolResultText").text(jqXHR.statusText + " - " + jqXHR.responseText);
+ }
+ });
+}
+</script>
+
+<div id="findSymbolResult" style="display: none">
+<p><a href="#" onclick="$('#findSymbolResult').hide(); return false;">Hide results</a>
+<pre id="findSymbolResultText">... waiting for results ...</pre>
+</div>
Modified: incubator/stanbol/trunk/entityhub/jersey/src/main/resources/org/apache/stanbol/entityhub/jersey/templates/org/apache/stanbol/entityhub/jersey/resource/SymbolResource/inc_lookup.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/SymbolResource/inc_lookup.ftl?rev=1092727&r1=1092726&r2=1092727&view=diff
==============================================================================
--- incubator/stanbol/trunk/entityhub/jersey/src/main/resources/org/apache/stanbol/entityhub/jersey/templates/org/apache/stanbol/entityhub/jersey/resource/SymbolResource/inc_lookup.ftl (original)
+++ incubator/stanbol/trunk/entityhub/jersey/src/main/resources/org/apache/stanbol/entityhub/jersey/templates/org/apache/stanbol/entityhub/jersey/resource/SymbolResource/inc_lookup.ftl Fri Apr 15 14:48:00 2011
@@ -44,7 +44,7 @@
<h5>Example</h5>
-<pre>curl "${it.publicBaseUri}entityhub/symbol/lookup/?id=http://dbpedia.org/resource/Paris"</pre>
+<pre>curl "${it.publicBaseUri}entityhub/symbol/lookup/?id=http://dbpedia.org/resource/Paris&create=false"</pre>
<h5>Test</h5>
Modified: incubator/stanbol/trunk/entityhub/jersey/src/main/resources/org/apache/stanbol/entityhub/jersey/templates/org/apache/stanbol/entityhub/jersey/resource/SymbolResource/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/SymbolResource/index.ftl?rev=1092727&r1=1092726&r2=1092727&view=diff
==============================================================================
--- incubator/stanbol/trunk/entityhub/jersey/src/main/resources/org/apache/stanbol/entityhub/jersey/templates/org/apache/stanbol/entityhub/jersey/resource/SymbolResource/index.ftl (original)
+++ incubator/stanbol/trunk/entityhub/jersey/src/main/resources/org/apache/stanbol/entityhub/jersey/templates/org/apache/stanbol/entityhub/jersey/resource/SymbolResource/index.ftl Fri Apr 15 14:48:00 2011
@@ -8,6 +8,7 @@
</ul>
<#include "inc_lookup.ftl">
+<#include "inc_find.ftl">
</...@common.page>
</#escape>