org.nlp2rdf.webservice
Class NIFParameters

java.lang.Object
  extended by org.nlp2rdf.webservice.NIFParameters

public class NIFParameters
extends Object

User: Sebastian Hellmann See http://nlp2rdf.org/nif-1-0#toc-parameters A simple wrapper for the common options in NIF Services Use the following to retrieve the input variable: if (nifParameters.inputWasText()) { String text = nifParameters.getInputAsText() ; }else { OntModel model = getInputAsOntModel(); }


Constructor Summary
NIFParameters(Object input, Map<String,String> parameterMap, String prefix, String uriRecipe, int contextLength, String format, String output)
           
 
Method Summary
static Map<String,String> copyParameterMap(javax.servlet.http.HttpServletRequest httpServletRequest)
           
 int getContextLength()
           
static String getDocumentation(String serviceUrl)
           
 String getFormat()
           
 com.hp.hpl.jena.ontology.OntModel getInputAsOntModel()
          Casts the input var to OntModel
 String getInputAsText()
          Casts the input var to String
static NIFParameters getInstance(javax.servlet.http.HttpServletRequest httpServletRequest)
          Factory method
 String getOutput()
           
 Map<String,String> getParameterMap()
           
 String getPrefix()
           
 String getUriRecipe()
           
 boolean inputWasRDF()
          Tests whether the input was RDF in opposition to inputWasText()
 boolean inputWasText()
          Tests whether the input was text in opposition to inputWasRDF()
static boolean isSet(String parameterName, javax.servlet.http.HttpServletRequest hsr)
           
static boolean oneOf(String value, String... possibleValues)
           
static String requiredParameter(String parameterName, javax.servlet.http.HttpServletRequest hsr)
           
static String requiredParameter(String parameterName, javax.servlet.http.HttpServletRequest hsr, String... requiredValues)
           
 String toString()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

NIFParameters

public NIFParameters(Object input,
                     Map<String,String> parameterMap,
                     String prefix,
                     String uriRecipe,
                     int contextLength,
                     String format,
                     String output)
Method Detail

inputWasText

public boolean inputWasText()
Tests whether the input was text in opposition to inputWasRDF()

Returns:
true if the input is an instance of String

inputWasRDF

public boolean inputWasRDF()
Tests whether the input was RDF in opposition to inputWasText()

Returns:
true if the input is an instance of OntModel

getInputAsText

public String getInputAsText()
                      throws ClassCastException
Casts the input var to String

Returns:
the text of the input variable
Throws:
ClassCastException

getInputAsOntModel

public com.hp.hpl.jena.ontology.OntModel getInputAsOntModel()
                                                     throws ClassCastException
Casts the input var to OntModel

Returns:
the OntModel from the input variable
Throws:
ClassCastException

getInstance

public static NIFParameters getInstance(javax.servlet.http.HttpServletRequest httpServletRequest)
Factory method

Parameters:
httpServletRequest -
Returns:

toString

public String toString()
Overrides:
toString in class Object

getParameterMap

public Map<String,String> getParameterMap()

getPrefix

public String getPrefix()

getUriRecipe

public String getUriRecipe()

getFormat

public String getFormat()

getOutput

public String getOutput()

getContextLength

public int getContextLength()

requiredParameter

public static String requiredParameter(String parameterName,
                                       javax.servlet.http.HttpServletRequest hsr)

requiredParameter

public static String requiredParameter(String parameterName,
                                       javax.servlet.http.HttpServletRequest hsr,
                                       String... requiredValues)

getDocumentation

public static String getDocumentation(String serviceUrl)

oneOf

public static boolean oneOf(String value,
                            String... possibleValues)

isSet

public static boolean isSet(String parameterName,
                            javax.servlet.http.HttpServletRequest hsr)

copyParameterMap

public static Map<String,String> copyParameterMap(javax.servlet.http.HttpServletRequest httpServletRequest)


Copyright © 2011. All Rights Reserved.