org.activemath.webapp.clip
Class OMSDisambiguator

java.lang.Object
  extended by org.activemath.webapp.clip.OMSDisambiguator

public class OMSDisambiguator
extends Object

Simple utility to inject the xref attribute to OMS elements using either the cdbase attribute (of itself or a parent) or searching through the knowledge-base.


Nested Class Summary
static class OMSDisambiguator.DisambiguationException
           
 
Constructor Summary
OMSDisambiguator(AuthorExtendedMBaseRef mbaseRef)
           
 
Method Summary
 OJElement fixOMnamespaces(OJElement e)
           
 void injectXref(OJElement oms)
           
 OJElement injectXrefInAll(OJElement any)
           
 String trySearchingMBaseForId(String cd, String name)
          Searches MBase using AuthorExtendedMBaseRef.searchIDs(java.lang.String) to find the ID matching cd and name.
 String trySearchingMBaseForOMSTarget(OJElement elt)
          Searches MBase using AuthorExtendedMBaseRef.searchIDs(java.lang.String) to find the ID matching cd and name.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

OMSDisambiguator

public OMSDisambiguator(AuthorExtendedMBaseRef mbaseRef)
Method Detail

fixOMnamespaces

public OJElement fixOMnamespaces(OJElement e)

injectXrefInAll

public OJElement injectXrefInAll(OJElement any)
                          throws OMSDisambiguator.DisambiguationException
Throws:
OMSDisambiguator.DisambiguationException

injectXref

public void injectXref(OJElement oms)
                throws OMSDisambiguator.DisambiguationException
Throws:
OMSDisambiguator.DisambiguationException

trySearchingMBaseForOMSTarget

public String trySearchingMBaseForOMSTarget(OJElement elt)
Searches MBase using AuthorExtendedMBaseRef.searchIDs(java.lang.String) to find the ID matching cd and name.

Parameters:
elt - the OMS element out of which the attributes cd and name are used
Returns:
an ID whose theory and name match
Throws:
OMSDisambiguator.DisambiguationException - if such an ID appears twice or more

trySearchingMBaseForId

public String trySearchingMBaseForId(String cd,
                                     String name)
Searches MBase using AuthorExtendedMBaseRef.searchIDs(java.lang.String) to find the ID matching cd and name.

Parameters:
cd - the theory id-name
name - the id-name
Returns:
an ID whose theory and name match
Throws:
OMSDisambiguator.DisambiguationException - if such an ID appears twice or more