Tag library name: omcore-taglib


Index of Tags and Functions.
Tags
  1. out.
  2. set.
Functions
  1. copyOMObject.
  2. getCd.
  3. getName.
  4. isInteger.
  5. isOMApplication.
  6. isOMAttribution.
  7. isOMBinding.
  8. isOMError.
  9. isOMFalse.
  10. isOMFloat.
  11. isOMInteger.
  12. isOMObject.
  13. isOMString.
  14. isOMSymbol.
  15. isOMSymbolCDandName.
  16. isOMTrue.
  17. isOMVariable.
  18. toOMObject.



Authors:
NameInstitutione-mailRole
E. Reinaldo Barreiro Technical University of Eindhoven (TU/e) info@mathdox.org Main author



Description:

This tag library to perform some basic operations on OpenMath objects. Among such operations we have:

  1. Creating a ROML Java object from an XML-string representation of an OpenMath object (set tag) and vice versa (out tag).
  2. Testing whether an object match a certain pattern.



Download and Install:

Download:

The whole tag library project is available for dowloading, as tar.gz or as a zip file, here .

General INSTALL information:

This tag library is designed to be used in JSP pages compliant with the JSP 2.0 specification.

To get this tag library working you will have to copy the jar files

Jar fileDownloadDescription
omcore-taglib.jardownloadThe tag library jar file.
om-lib.jardownloadROML library

to the WEB-INF/lib/ directory on your web application.

NOTE: We advise you to use the versions of additional jar files comming with the tag library and not to download them directly from other of our related projects. By doing so, you may create imcompatibilities: though we will do our best to make sure a tag library is using the latest version of a jar file.

You will also need to copy the tld file omcore-taglib.tld to somewhere in the WEB-INF/ directory, for instance to WEB-INF/ itselft, and add to the web.xml file, in the part corresponding to the tag libraries, the following lines:

<taglib>
    <taglib-uri>URI identifying your tag lib</taglib-uri>
    <taglib-location>/WEB-INF/omcore-taglib.tld</taglib-location>

</taglib>
                            

For more information on how to modify the web.xml file peruse the documentation coming with your WEB server/container. For information on how to use tag extensions on your own JSP pages consult the JSP 2.0 specification.

Tag specific INSTALL information:

none




Tags


1-out (tag).
Description

Prints out the XML encoding of an OpenMath object. The object to be printed out should be passed to the tag via the value attribute. By default the result is escaped (see escapeXml attribute).

Body Content:

EMPTY

Tag Class:

nl.tue.win.riaca.taglib.omcore.OmOutTag



Attributes:
NameRequiredDynamicDescription
escapeXmlfalsetrue If the XML must be scaped or not. True is the default value.
valuetruetrue The OMObject whose XML has to be to be printed out. For any other object toString() is called.


Examples:
Snippet 1:
        
            <equation><c:out value="${a}"/></equation>
        
>




2-set (tag).
Description

This tag should be used to create an a ROML OMObject and place it in the scope under the name specified by the attribute var. If scope is not specified the value page is assumed (valid values are page, session, request and application).

For building the OMObject this tag first checks if the attribute value is present. If so, then it attempts to build an OMbject with it. The attribute can contain either another OMObject or a string containing the XML encoding of the OpenMath object. If value is not present then the tags tries to build an OpenMath with the string that results form evaluating its body.

Body Content:

JSP

Tag Class:

nl.tue.win.riaca.taglib.omcore.OmSetTag



Attributes:
NameRequiredDynamicDescription
scopefalsefalse The scope were var is instantiated. The default value for scope is "page".
valuefalsetrue The value to be assigned. That is other ROML object to be assigned to the variable specified by var or a string containing the XML encoding of the OpenMath object.
varfalsefalse The name of the variable you want to place in the scope.


Examples:
Snippet 1:
        
        <omcore:set var="OMObja">
            <OMOBJ>
                <OMI><c:out value="${param.a}"/></OMI>

            </OMOBJ>
        </omcore:set>
        
Snippet 2:
        
        <omcore:set var="OMObja" value="${param.a}" scope="session"/>

        




Functions


1- copyOMObject (function).
Description:

This function deep clone a RIACA OpenMath object. If the input object is null then it returns null.

Function Class:

nl.tue.win.riaca.taglib.omcore.OmcoreFunctions

Function Signature:

nl.tue.win.riaca.openmath.lang.OMObject toOMObject( nl.tue.win.riaca.openmath.lang.OMObject )



Examples:
Snippet 1:
        
            <!-- deep clone  A and store it in B (in the page scope) -->

            
            <omcore:set var="B" value="${omcore:copyOMObject(A)}"/>
       





2- getCd (function).
Description:

Returns the cd attribute of an OMS. This function should not exists but but ROML defines the access function getCD, which doesn't fit the bean specification, so we cannot use the expression language ${omobj.cd} to access the cd attribute.

Function Class:

nl.tue.win.riaca.taglib.omcore.OmcoreFunctions

Function Signature:

java.lang.String getCd( java.lang.Object )



Examples:
Snippet 1:
        
            <!-- The OpenMath object is contained in a OMObject object -->
            <c:if test="${omcore:isOMSymbol(a)}">

                The OMS belongs to the cd ${omcore:getCD(a)}.
            </if>
        





3- getName (function).
Description:

Returns the name of an OMS.

Function Class:

nl.tue.win.riaca.taglib.omcore.OmcoreFunctions

Function Signature:

java.lang.String getName( java.lang.Object )



Examples:
Snippet 1:
        
            <!-- The OpenMath object is contained in a OMObject object -->

            <c:if test="${omcore:isOMSymbol(a)}">
                The OMS is the ${omcore:getCD(a)}.${omcore:getName(a)}.
            </if>
        





4- isInteger (function).
Description:

Tests if string is an integer.

Function Class:

nl.tue.win.riaca.taglib.omcore.OmcoreFunctions

Function Signature:

java.lang.Boolean isInteger( java.lang.String )



Examples:
Snippet 1:
        
            <c:if test="${isInteger(param.a)}">

                <!-- do something with the (string) integer in a -->
            </if>
        





5- isOMApplication (function).
Description:

Tests if its argument is an OMApplication or can be parsed into one. The argument could be any java object. The function tests if it is either an string containing the XML encoding of an <OMA> or if it is an instance of a ROML OMApplication.

Function Class:

nl.tue.win.riaca.taglib.omcore.OmcoreFunctions

Function Signature:

java.lang.Boolean isOMApplication( java.lang.Object )



Examples:
Snippet 1:

        
            <!-- The OpenMath object is contained in a OMObject object -->
            <c:if test="${omcore:isOMApplication(a)}">
                <!-- do something with the OMApplication a -->
            </if>
        
Snippet 2:
        
            <!-- The OpenMath OMA is contained in a string -->
            <c:if test="${omcore:isOMApplication(param.a)}">
                <!-- do something with the string contained in a -->
            </if>

        





6- isOMAttribution (function).
Description:

Tests if its argument is an OMAttribution or can be parsed into one. The argument could be any java object. The function tests if it is either an string containing the XML encoding of an <OMATT> or if it is an instance of a ROML OMAttribution.

Function Class:

nl.tue.win.riaca.taglib.omcore.OmcoreFunctions

Function Signature:

java.lang.Boolean isOMAttribution( java.lang.Object )



Examples:
Snippet 1:
        
            <!-- The OpenMath object is contained in a OMObject object -->
            <c:if test="${omcore:isOMAttribution(a)}">

                <!-- do something with the OMAttribution a -->
            </if>
        
Snippet 2:

        
            <!-- The OpenMath OMATTR is contained in a string -->
            <c:if test="${omcore:isOMAttribution(param.a)}">
                <!-- do something with the string contained in a -->
            </if>
        





7- isOMBinding (function).
Description:

Tests if its argument is an OMBinding or can be parsed into one. The argument could be any java object. The function tests if it is either an string containing the XML encoding of an <OMBIND> or if it is an instance of a ROML OMBinding.

Function Class:

nl.tue.win.riaca.taglib.omcore.OmcoreFunctions

Function Signature:

java.lang.Boolean isOMBinding( java.lang.Object )



Examples:
Snippet 1:
        
            <!-- The OpenMath object is contained in a OMObject object -->
            <c:if test="${omcore:isOMBinding(a)}">
                <!-- do something with the OMBinding a -->

            </if>
        
Snippet 2:
        
            <!-- The OpenMath OMBIND is contained in a string -->

            <c:if test="${omcore:isOMBinding(param.a)}">
                <!-- do something with the string contained in a -->
            </if>
        





8- isOMError (function).
Description:

Tests if its argument is an OMError or can be parsed into one. The argument could be any java object. The function tests if it is either an string containing the XML encoding of an <OME> or if it is an instance of a ROML OMError.

Function Class:

nl.tue.win.riaca.taglib.omcore.OmcoreFunctions

Function Signature:

java.lang.Boolean isOMError( java.lang.Object )



Examples:
Snippet 1:

        
            <!-- The OpenMath object is contained in a OMObject object -->
            <c:if test="${omcore:isOMError(a)}">
                <!-- do something with the OMError a -->
            </if>
        
Snippet 2:
        
            <!-- The OpenMath OME is contained in a string -->
            <c:if test="${omcore:isOMError(param.a)}">
                <!-- do something with the string contained in a -->
            </if>

        





9- isOMFalse (function).
Description:

Test if an OpenMath object is an instance of OMS with name "false".

Function Class:

nl.tue.win.riaca.taglib.omcore.OmcoreFunctions

Function Signature:

java.lang.Boolean isOMFalse( java.lang.Object )



Examples:
Snippet 1:
        
            <!-- The OpenMath object is contained in a OMObject object -->
            <c:if test="${omcore:isOMFalse(a)}">
                <!-- do something with the OMS a -->

            </if>
        
Snippet 2:
        
            <!-- The OpenMath OMSTR is contained in a string -->

            <c:if test="${omcore:isOMFalse(param.a)}">
                <!-- do something with the string contained in a -->
            </if>
        





10- isOMFloat (function).
Description:

Tests if its argument is an isOMFloat or can be parsed into one. The argument could be any java object. The function tests if it is either an string containing the XML encoding of an <OMF> or if it is an instance of a ROML OMInteger.

Function Class:

nl.tue.win.riaca.taglib.omcore.OmcoreFunctions

Function Signature:

java.lang.Boolean isOMFloat( java.lang.Object )



Examples:
Snippet 1:

        
            <!-- The OpenMath object is contained in a OMObject object -->
            <c:if test="${omcore:isOMFloat(a)}">
                <!-- do something with the OMFloat a -->
            </if>
        
Snippet 2:
        
            <!-- The OpenMath OMF is contained in a string -->
            <c:if test="${omcore:isOMFloat(param.a)}">
                <!-- do something with the string contained in a -->
            </if>

        





11- isOMInteger (function).
Description:

Tests if its argument is an isOMInteger or can be parsed into one. The argument could be any java object. The function tests if it is either an string containing the XML encoding of an <OMI> or if it is an instance of a ROML OMInteger.

Function Class:

nl.tue.win.riaca.taglib.omcore.OmcoreFunctions

Function Signature:

java.lang.Boolean isOMInteger( java.lang.Object )



Examples:
Snippet 1:
        
            <!-- The OpenMath object is contained in a OMObject object -->
            <c:if test="${omcore:isOMInteger(a)}">

                <!-- do something with the OMInteger a -->
            </if>
        
Snippet 2:

        
            <!-- The OpenMath OMI is contained in a string -->
            <c:if test="${omcore:isOMInteger(param.a)}">
                <!-- do something with the string contained in a -->
            </if>
        





12- isOMObject (function).
Description:

Tests if its argument is an OMObject or can be parsed into one. The argument could be any java object. The function tests if it is either an string containing the XML encoding of an <OMOBJ> or if it is an instance of a ROML OMObject.

Function Class:

nl.tue.win.riaca.taglib.omcore.OmcoreFunctions

Function Signature:

java.lang.Boolean isOMObject( java.lang.Object )



Examples:
Snippet 1:
        
            <!-- The OpenMath object is contained in a OMObject object -->
            <c:if test="${omcore:isOMObject(a)}">
                <!-- do something with the string contained in a -->

            </if>
        
Snippet 2:
        
            <!-- The OpenMath object is contained in a string -->

            <c:if test="${omcore:isOMObject(param.a)}">
                <!-- do something with the string contained in a -->
            </if>
        





13- isOMString (function).
Description:

Tests if its argument is an isOMString or can be parsed into one. The argument could be any java object. The function tests if it is either an string containing the XML encoding of an <OMSTR> or if it is an instance of a ROML OMString.

Function Class:

nl.tue.win.riaca.taglib.omcore.OmcoreFunctions

Function Signature:

java.lang.Boolean isOMString( java.lang.Object )



Examples:
Snippet 1:

        
            <!-- The OpenMath object is contained in a OMObject object -->
            <c:if test="${omcore:isOMString(a)}">
                <!-- do something with the OMVariable a -->
            </if>
        
Snippet 2:
        
            <!-- The OpenMath OMSTR is contained in a string -->
            <c:if test="${omcore:isOMString(param.a)}">
                <!-- do something with the string contained in a -->
            </if>

        





14- isOMSymbol (function).
Description:

Tests if its argument is an OMSymbol or can be parsed into one. The argument could be any java object. The function tests if it is either an string containing the XML encoding of an <OMS> or if it is an instance of a ROML OMSymbol.

Function Class:

nl.tue.win.riaca.taglib.omcore.OmcoreFunctions

Function Signature:

java.lang.Boolean isOMSymbol( java.lang.Object )



Examples:
Snippet 1:
        
            <!-- The OpenMath object is contained in a OMObject object -->
            <c:if test="${omcore:isOMSymbol(a)}">

                <!-- do something with the OMApplication a -->
            </if>
        
Snippet 2:

        
            <!-- The OpenMath OMA is contained in a string -->
            <c:if test="${omcore:isOMSymbol(param.a)}">
                <!-- do something with the string contained in a -->
            </if>
        





15- isOMSymbolCDandName (function).
Description:

Tests if its first argument is an OMSymbol or can be parsed into one. The first argument could be any java object. The function tests if this first argument is either an string containing the XML encoding of an <OMS> or if it is an instance of a ROML OMSymbol. The second argument is the name of a CD and the third a Name of the symbol in the CD. So, you can test if this symbol is the symbol CD.Name. The use of wildcard, indicated by * or by the empty string, is allowed (see examples bellow).

Function Class:

nl.tue.win.riaca.taglib.omcore.OmcoreFunctions

Function Signature:

java.lang.Boolean isOMSymbolCDandName( java.lang.Object, java.lang.String, java.lang.String)



Examples:
Snippet 1:
        
            <!-- a is a string -->
            <c:set var="a"> 
                <OMOBJ>

                    <OMS cd="arith1" name="plus"/>
                </OMOBJ>
            </c:set>
                        
            <c:if test="${omcore:isOMSymbolCDandName(a,'arith1','plus')}">
                <!-- this part is executed -->
            </if>

            
            <c:if test="${omcore:isOMSymbolCDandName(a,'*','plus')}">
                <!-- this part is executed -->
            </if>
            
            <c:if test="${omcore:isOMSymbolCDandName(a,'arith1','*')}">
                <!-- this part is executed -->
            </if>

            
            <c:if test="${omcore:isOMSymbolCDandName(a,'*','*')}">
                <!-- this part is executed -->
            </if>
            
            <c:if test="${omcore:isOMSymbolCDandName(a,'relation1','*')}">
                <!-- this part is not executed -->
            </if>

            
            <c:if test="${omcore:isOMSymbolCDandName(a,'*','mod')}">
                <!-- this part is not executed -->
            </if>            
            
            <c:if test="${omcore:isOMSymbolCDandName(a,'relation1','lt')}">
                <!-- this part is not executed -->
            </if>

        
Snippet 2:
        
            <!-- a is a ROML OMObject -->
            
            <omcore:set var="a"> 
                <OMOBJ>

                    <OMS cd="arith1" name="plus"/>
                </OMOBJ>
            </omcore:set>
            
            <c:if test="${omcore:isOMSymbolCDandName(a,'arith1','plus')}">
                <!-- this part is executed -->
            </if>

            
            <c:if test="${omcore:isOMSymbolCDandName(a,'*','plus')}">
                <!-- this part is executed -->
            </if>
            
            <c:if test="${omcore:isOMSymbolCDandName(a,'arith1','*')}">
                <!-- this part is executed -->
            </if>

            
            <c:if test="${omcore:isOMSymbolCDandName(a,'*','*')}">
                <!-- this part is executed -->
            </if>
            
            <c:if test="${omcore:isOMSymbolCDandName(a,'relation1','*')}">
                <!-- this part is not executed -->
            </if>

            
            <c:if test="${omcore:isOMSymbolCDandName(a,'*','mod')}">
                <!-- this part is not executed -->
            </if>            
            
            <c:if test="${omcore:isOMSymbolCDandName(a,'relation1','lt')}">
                <!-- this part is not executed -->
            </if>

        





16- isOMTrue (function).
Description:

Test if an OpenMath object is an instance of OMS with a name "true".

Function Class:

nl.tue.win.riaca.taglib.omcore.OmcoreFunctions

Function Signature:

java.lang.Boolean isOMTrue( java.lang.Object )



Examples:
Snippet 1:
        
            <!-- The OpenMath object is contained in a OMObject object -->
            <c:if test="${omcore:isOMTrue(a)}">
                <!-- do something with the OMS a -->

            </if>
        
Snippet 2:
        
            <!-- The OpenMath OMSTR is contained in a string -->

            <c:if test="${omcore:isOMTrue(param.a)}">
                <!-- do something with the string contained in a -->
            </if>
        





17- isOMVariable (function).
Description:

Tests if its argument is an isOMVariable or can be parsed into one. The argument could be any java object. The function tests if it is either an string containing the XML encoding of an <OMV> or if it is an instance of a ROML OMVariable.

Function Class:

nl.tue.win.riaca.taglib.omcore.OmcoreFunctions

Function Signature:

java.lang.Boolean isOMVariable( java.lang.Object )



Examples:
Snippet 1:

        
            <!-- The OpenMath object is contained in a OMObject object -->
            <c:if test="${omcore:isOMVariable(a)}">
                <!-- do something with the OMVariable a -->
            </if>
        
Snippet 2:
        
            <!-- The OpenMath OMV is contained in a string -->
            <c:if test="${omcore:isOMVariable(param.a)}">
                <!-- do something with the string contained in a -->
            </if>

        





18- toOMObject (function).
Description:

Tries to parse a String into a RIACA OMObject. If it fails returns null.

Function Class:

nl.tue.win.riaca.taglib.omcore.OmcoreFunctions

Function Signature:

nl.tue.win.riaca.openmath.lang.OMObject toOMObject( java.lang.String )



Examples:
Snippet 1:
        
            <!-- The OpenMath OMSTR is contained in a string -->
            <c:if test="${omcore:isOMString(omcore:toOMObject(param.a))}">
                <!-- do something with the string contained in a -->

            </if>