org.apache.stanbol.contenthub.web.resources
Class RelatedKeywordResource

java.lang.Object
  extended by org.apache.stanbol.commons.web.base.resource.BaseStanbolResource
      extended by org.apache.stanbol.contenthub.web.resources.RelatedKeywordResource

public class RelatedKeywordResource
extends BaseStanbolResource

This is the web resourceclass which implements the search functionality of Contenthub to look for related keywords, given a keyword.

Author:
anil.sinaci

Nested Class Summary
 
Nested classes/interfaces inherited from class org.apache.stanbol.commons.web.base.resource.BaseStanbolResource
BaseStanbolResource.MenuItem
 
Field Summary
 
Fields inherited from class org.apache.stanbol.commons.web.base.resource.BaseStanbolResource
LINK_RESOURCES, NAVIGATION_LINKS, ROOT_URL, SCRIPT_RESOURCES, servletContext, STATIC_RESOURCES_ROOT_URL, uriInfo
 
Constructor Summary
RelatedKeywordResource(javax.servlet.ServletContext context)
           
 
Method Summary
 javax.ws.rs.core.Response bringSuggestion(java.lang.String pattern)
          TODO: Not completed yet.
 javax.ws.rs.core.Response findAllRelatedKeywords(java.lang.String keyword, java.lang.String graphURI, javax.ws.rs.core.HttpHeaders headers)
          HTTP GET method to retrieve related keywords from all resources defined within Contenthub.
 javax.ws.rs.core.Response findOntologyRelatedKeywords(java.lang.String keyword, java.lang.String graphURI, javax.ws.rs.core.HttpHeaders headers)
          HTTP GET method to retrieve related keywords from ontology resources.
 javax.ws.rs.core.Response findReferencedSiteRelatedKeywords(java.lang.String keyword, javax.ws.rs.core.HttpHeaders headers)
          HTTP GET method to retrieve related keywords from the referenced sites.
 javax.ws.rs.core.Response handleCorsPreflight(javax.ws.rs.core.HttpHeaders headers)
           
 
Methods inherited from class org.apache.stanbol.commons.web.base.resource.BaseStanbolResource
getMainMenuItems, getNavigationLinks, getPublicBaseUri, getRegisteredLinkResources, getRegisteredScriptResources, getRootUrl, getStaticRootUrl
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RelatedKeywordResource

public RelatedKeywordResource(@Context
                              javax.servlet.ServletContext context)
Method Detail

handleCorsPreflight

public javax.ws.rs.core.Response handleCorsPreflight(@Context
                                                     javax.ws.rs.core.HttpHeaders headers)

findAllRelatedKeywords

public final javax.ws.rs.core.Response findAllRelatedKeywords(java.lang.String keyword,
                                                              java.lang.String graphURI,
                                                              @Context
                                                              javax.ws.rs.core.HttpHeaders headers)
                                                       throws SearchException
HTTP GET method to retrieve related keywords from all resources defined within Contenthub.

Parameters:
keyword - The keyword whose related keywords will be retrieved.
graphURI - URI of the ontology to be used during the step in which related keywords are searched in ontology resources. If this parameter is null, then no related keywords are returned from ontology resources.
headers - HTTP headers
Returns:
JSON string which is constructed by SearchResultWriter. SearchResult returned by RelatedKeywordSearchManager.getRelatedKeywordsFromAllSources(String, String) only contains related keywords (no resultant documents or facet fields are returned within the SearchResult).
Throws:
SearchException

findOntologyRelatedKeywords

public final javax.ws.rs.core.Response findOntologyRelatedKeywords(java.lang.String keyword,
                                                                   java.lang.String graphURI,
                                                                   @Context
                                                                   javax.ws.rs.core.HttpHeaders headers)
                                                            throws SearchException
HTTP GET method to retrieve related keywords from ontology resources. Given the ontology URI, this method looks for subsumption/hierarchy relations among the concepts to come up with related keywords.

Parameters:
keyword - The keyword whose related keywords will be retrieved from ontology resources.
graphURI - URI of the ontology in which related keywords will be searched. The ontology should be available in the Contenthub system.
headers - HTTP headers
Returns:
JSON string which is constructed by SearchResultWriter. SearchResult returned by RelatedKeywordSearchManager.getRelatedKeywordsFromOntology(String, String) contains only related keywords from ontology resources. (No resultant documents or facet fields are returned within the SearchResult).
Throws:
SearchException

findReferencedSiteRelatedKeywords

public final javax.ws.rs.core.Response findReferencedSiteRelatedKeywords(java.lang.String keyword,
                                                                         @Context
                                                                         javax.ws.rs.core.HttpHeaders headers)
                                                                  throws SearchException
HTTP GET method to retrieve related keywords from the referenced sites.

Parameters:
keyword - The keyword whose related keywords will be retrieved from referenced sites.
headers - HTTP headers
Returns:
JSON string which is constructed by SearchResultWriter. SearchResult returned by RelatedKeywordSearchManager.getRelatedKeywordsFromReferencedSites(String) contains only related keywords from referenced sites. (No resultant documents or facet fields are returned within the SearchResult).
Throws:
SearchException

bringSuggestion

public final javax.ws.rs.core.Response bringSuggestion(java.lang.String pattern)
TODO: Not completed yet. This method is used to provide data to autocomplete component. It queries entityhub with the provided query term.



Copyright © 2011-2012 The Apache Software Foundation. All Rights Reserved.