Class XponentsGeotagger

java.lang.Object
org.restlet.resource.Resource
org.restlet.resource.ServerResource
org.opensextant.xlayer.server.TaggerResource
org.opensextant.xlayer.server.xgeo.XponentsGeotagger

public class XponentsGeotagger extends TaggerResource
A RESTFul application of PlaceGeocoder
  • Field Summary

    Fields inherited from class org.opensextant.xlayer.server.TaggerResource

    DATE_TAGGER, extractorSet, FLD_FEATURES, FLD_STATUS, GEO_TAGGER, log, operation, POSTAL_TAGGER, TAXON_TAGGER
  • Constructor Summary

    Constructors
    Constructor
    Description
    Restlet resource that pulls its configuration from Context.
  • Method Summary

    Modifier and Type
    Method
    Description
    org.opensextant.extraction.Extractor
    get Xponents Exxtractor object from global attributes.
    org.restlet.representation.Representation
    process(org.opensextant.data.TextInput input, org.opensextant.processing.Parameters jobParams)
    Process the text for the given document.
    org.restlet.representation.Representation
    processForm(org.restlet.ext.json.JsonRepresentation params)
    Contract: docid optional; 'text' | 'doc-list' required.
    org.restlet.representation.Representation
    processGet(org.restlet.representation.Representation params)
    HTTP GET -- vanilla.

    Methods inherited from class org.opensextant.xlayer.server.TaggerResource

    debug, doInit, error, fromArray, fromRequest, fromRequest, getProperty, info, isDebug, parseParameters, ping, resetParameters, status

    Methods inherited from class org.restlet.resource.ServerResource

    abort, commit, delete, delete, describeVariants, doCatch, doConditionalHandle, doError, doHandle, doHandle, doNegotiatedHandle, get, get, getAttribute, getDescription, getInfo, getInfo, getName, getOnSent, getPreferredVariant, getRole, getVariants, getVariants, handle, hasAnnotations, head, head, isAnnotated, isAutoCommitting, isCommitted, isConditional, isExisting, isInRole, isNegotiated, options, options, patch, patch, post, post, put, put, redirectPermanent, redirectPermanent, redirectSeeOther, redirectSeeOther, redirectTemporary, redirectTemporary, setAllowedMethods, setAnnotated, setAttribute, setAutoCommitting, setChallengeRequests, setCommitted, setConditional, setCookieSettings, setDescription, setDimensions, setExisting, setLocationRef, setLocationRef, setName, setNegotiated, setOnSent, setProxyChallengeRequests, setServerInfo, setStatus, setStatus, setStatus, setStatus, updateAllowedMethods, updateDimensions

    Methods inherited from class org.restlet.resource.Resource

    doError, doRelease, getAllowedMethods, getApplication, getChallengeRequests, getChallengeResponse, getClientInfo, getConditions, getConnegService, getContext, getConverterService, getCookies, getCookieSettings, getDimensions, getHostRef, getLocationRef, getLogger, getMatrix, getMatrixValue, getMaxForwards, getMetadataService, getMethod, getOriginalRef, getProtocol, getProxyChallengeRequests, getProxyChallengeResponse, getQuery, getQueryValue, getRanges, getReference, getReferrerRef, getRequest, getRequestAttributes, getRequestCacheDirectives, getRequestEntity, getResponse, getResponseAttributes, getResponseCacheDirectives, getResponseEntity, getRootRef, getServerInfo, getStatus, getStatusService, init, isConfidential, isLoggable, release, setApplication, setQueryValue, setRequest, setResponse, toBoolean, toByte, toDouble, toFloat, toInteger, toLong, toObject, toRepresentation, toRepresentation, toRepresentation, toShort, toString

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • XponentsGeotagger

      public XponentsGeotagger()
      Restlet resource that pulls its configuration from Context.
  • Method Details

    • getExtractor

      public org.opensextant.extraction.Extractor getExtractor(String xid)
      get Xponents Exxtractor object from global attributes.
      Specified by:
      getExtractor in class TaggerResource
    • processForm

      @Post("application/json;charset=utf-8") public org.restlet.representation.Representation processForm(org.restlet.ext.json.JsonRepresentation params) throws org.json.JSONException
      Contract: docid optional; 'text' | 'doc-list' required. command: cmd=ping sends back a simple response text = UTF-8 encoded text docid = user's provided document ID doc-list = An array of text cmd=ping = report status. Where json-array contains { docs=[ {docid='A', text='...'}, {docid='B', text='...',...] } The entire array must be parsable in memory as a single, traversible JSON object. We make no assumption about one-JSON object per line or anything about line-endings as separators.
      Parameters:
      params - JSON parameters per REST API: docid, text, lang, features, options, and preferred_*
      Returns:
      the representation
      Throws:
      org.json.JSONException - the JSON exception
    • processGet

      @Get public org.restlet.representation.Representation processGet(org.restlet.representation.Representation params)
      HTTP GET -- vanilla. Do not use in production, unless you have really small data packages. This is useful for testing. Partial contract: miscellany: 'cmd' = 'ping' |... other commands. processing: 'docid' = ?, 'text' = ?
      Parameters:
      params - JSON parameters. see process()
      Returns:
      the representation
    • process

      public org.restlet.representation.Representation process(org.opensextant.data.TextInput input, org.opensextant.processing.Parameters jobParams)
      Process the text for the given document. NOTE: Please note this is NOT MT-safe. Internally there are single stateful instances of Extractor taggers, which may have significant memory and initialization phases. As a prototype that is one limitation. If you need multiple clients to hit this service, you ideally load-balance a bank of Xponents REST server.
      Specified by:
      process in class TaggerResource
      Parameters:
      input - the input
      jobParams - the job params
      Returns:
      the representation