org.activemath.omdocjdom.rephrase
Class RephraseHeuristics

java.lang.Object
  extended by org.activemath.omdocjdom.rephrase.RephraseHeuristics

public class RephraseHeuristics
extends Object

The centerpoint for all "prior-knowledge" for rephrases.


Constructor Summary
RephraseHeuristics()
           
 
Method Summary
static void adjustAcceptedTypesList(List givenTypes, String userAgentString)
          Pack of heuristics to protect against senseless mime-types as well as re-order preference depening on the client-identification if available.
static String computePresentableFormat(String mimeType, String mimeSubType)
           
static List computePresentationFormatsContentTypes()
           
static void ensureStaticRephraseInitted()
           
static RephraseGraph getStaticRephraseGraph()
           
static void initStaticRephrase(Subconfiguration config)
          Builds a static rephrase-graph stored here and that can be used with staticRephrase(org.activemath.omdocjdom.OJElement, java.lang.String, java.lang.String).
static CDGroup makeMathMLCdGroup()
           
static OJElement staticRephrase(OJElement sourceOmobj, String contentType, String clientString)
          Uses the rephrase-information created by initStaticRephrase(org.activemath.abstractcontent.Subconfiguration) to rephrase the indicated OMOBJ to the wished ContentType or CDGroup. encoded as a MIME-type.
static OJElement staticRephraseToMathMLCDG(OJElement sourceOmobj)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RephraseHeuristics

public RephraseHeuristics()
Method Detail

makeMathMLCdGroup

public static CDGroup makeMathMLCdGroup()

computePresentationFormatsContentTypes

public static List computePresentationFormatsContentTypes()

computePresentableFormat

public static String computePresentableFormat(String mimeType,
                                              String mimeSubType)

initStaticRephrase

public static void initStaticRephrase(Subconfiguration config)
                               throws org.jdom.JDOMException,
                                      MBaseException
Builds a static rephrase-graph stored here and that can be used with staticRephrase(org.activemath.omdocjdom.OJElement, java.lang.String, java.lang.String).

Parameters:
config - the configuration of which one expects to find the MBaseRef service as well as cdgroups.xx properties. The values of the properties are MBaseIDs of theories which, along with all imported theories, represent the set of CDs.
Throws:
org.jdom.JDOMException
MBaseException

ensureStaticRephraseInitted

public static void ensureStaticRephraseInitted()
                                        throws org.jdom.JDOMException,
                                               MBaseException
Throws:
org.jdom.JDOMException
MBaseException

getStaticRephraseGraph

public static RephraseGraph getStaticRephraseGraph()

staticRephraseToMathMLCDG

public static OJElement staticRephraseToMathMLCDG(OJElement sourceOmobj)

staticRephrase

public static OJElement staticRephrase(OJElement sourceOmobj,
                                       String contentType,
                                       String clientString)
Uses the rephrase-information created by initStaticRephrase(org.activemath.abstractcontent.Subconfiguration) to rephrase the indicated OMOBJ to the wished ContentType or CDGroup. encoded as a MIME-type.

Parameters:
sourceOmobj - the OpenMath object to be rephrased
contentType - the string-descriptor of the mime-type (maybe several, comma or space separated)
clientString - a descriptor of the consumer user-agent string allowing to embed heuristics to embed special treatments in the rephrase.
Returns:
the rephrase OpenMath object
Throws:
RephraseException - is it cannot do it
See Also:
ContentType#asMimeType()}

adjustAcceptedTypesList

public static void adjustAcceptedTypesList(List givenTypes,
                                           String userAgentString)
Pack of heuristics to protect against senseless mime-types as well as re-order preference depening on the client-identification if available. Senseless mime-types include such types as text/xml which do not allow a server to propose anything. text/xml is converted to application/openmath+xml which is then expanded to the global CD-group.

Parameters:
givenTypes - a list ContentTypes to be re-arranged
userAgentString - a string describing the transfer-client.