|
Version: 1.1.1 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object ca.ucalgary.seahawk.services.MobyClient
public class MobyClient
The engine that finds MOBY data in unstructured text or DOM of other XML languages according to a rules database. The format of this database is described here. Used in Seahawk to provide the service options popup items.
Constructor Summary | |
---|---|
MobyClient()
Nullary constructor that differs significantly in behaviour from the one-arg c-tor: it uses the registry from SeahawkOptions, or if not available, the RegistryCache default registry. |
|
MobyClient(Registry reg)
Constructor specifying a particular registry to use. |
Method Summary | |
---|---|
void |
addMappingsFromURL(URL u)
Parses the XML formatted rules from the input stream specified by the URL. |
void |
addNamespaceContext(String prefix,
String nsURI)
|
void |
addRegexMapping(String regexp,
Map<String,String> nsRules,
String mobyDataType,
Map<String,String[]> membersMap)
|
void |
addRegexMapping(String regexp,
Map<String,String> nsRules,
String mobyDataType,
Map<String,String[]> membersMap,
String articleName,
String ruleName,
String urn)
|
void |
addRegexMapping(String regexp,
String[] mobyObj)
|
void |
addRegexMapping(String regexp,
String[] mobyObj,
String articleName,
String urn)
|
void |
addURLRegexMapping(String url_regexp,
Map<String,String> url_nsRules,
String mobyDataType,
Map<String,String[]> membersMap,
String articleName,
String urn)
|
void |
addURLRegexMapping(String url_regexp,
String[] mobyObj,
String articleName,
String urn)
|
void |
addXPathMapping(String xpath_exp,
Map<String,String> nsRules,
String mobyDataType,
Map<String,String[]> membersMap,
String articleName,
String urn)
|
void |
addXPathMapping(String xpath_exp,
Map<String,String> nsRules,
String articleName,
String urn)
|
void |
addXPathMapping(String xpath,
String[] mobyObj)
|
boolean |
canProduceDataTypeFromString(MobyDataType targetDataType)
Indicates whether at least one production rule exists for the data type or one of its children. |
void |
clear()
Removes all mapping rules. |
void |
clearRegexs()
|
void |
clearURLRegexs()
|
void |
clearXPaths()
|
MobyComplexBuilder |
getBuilder(String ruleName)
If a rule was given this name, or url/lsid, the MOBY object builder for the rule is returned. |
CentralImpl |
getMobyCentralImpl()
|
MobyDataInstance |
getMobyObject(Map<String,byte[]> resultParts,
MobyPrimaryData dataTemplate)
Create a MOBY data instance from a map of name->bytes[] by applying the rules of the given MobyClient. |
MobyDataInstance |
getMobyObject(Node n,
MobyPrimaryData dataTemplate)
Create a MOBY data instance from a DOM by applying the rules of the given MobyClient (xpaths). |
MobyDataInstance |
getMobyObject(String s,
MobyPrimaryData dataTemplate)
Create a MOBY data instance from a string by applying the rules of the given MobyClient (regexes). |
MobyDataObject[] |
getMobyObjects(byte[] rawData,
MobyDataType targetDataType)
Using the regular expression mappings that have been set up, maps a string using rules producing moby objects of the given type. |
MobyDataObject[] |
getMobyObjects(CharSequence textData)
Using the regular expression mappings that have been set up, maps a string to moby objects. |
MobyDataObject[] |
getMobyObjects(CharSequence textData,
byte[] bytes)
|
MobyDataObject[] |
getMobyObjects(CharSequence textData,
MobyDataType targetDataType)
|
MobyDataObject[] |
getMobyObjects(CharSequence textData,
MobyDataType targetDataType,
MobyNamespace targetNS)
Using the regular expression mappings that have been set up, maps a string using rules producing moby objects of the given type. |
MobyDataObject[] |
getMobyObjects(Node n)
Using the XPath mappings that have been set up, maps a DOM node to moby objects. |
MobyDataObject[] |
getMobyObjects(URL url)
Using the URL regular expression mappings that have been set up, maps a string to moby objects. |
MobyDataObject[] |
getMobyObjects(URL url,
MobyDataType targetDataType)
|
MobyDataObject[] |
getMobyObjects(URL url,
String linkText)
|
MobyDataObject[] |
getMobyObjects(URL url,
String linkText,
MobyDataType targetDataType)
|
Map<String,MobyDataObject[]> |
getMobyObjectsURNMap(CharSequence textData)
Same as getMobyObjects(String), but returns only those generated Moby objects that are derived from URN-addressable rules (which are the keys), mostly for provenance and reproducibility purposes. |
Map<String,MobyDataObject[]> |
getMobyObjectsURNMap(CharSequence textData,
byte[] bytes)
|
Map<String,MobyDataObject[]> |
getMobyObjectsURNMap(Node n)
Same as getMobyObjects(Node), but applies only those rules that have a URN associated with them, mainly for provenance and reuse purposes.Map |
static MobyPrimaryDataSimple |
getObjectProduced(URL ruleSource,
String ruleURI,
Registry reg)
Convenience method to backtrack from a mapping rule to the Moby datatype it produces. |
Pattern |
getPattern(String ruleName)
If a rule was given this name, the regex pattern for the rule is returned. |
Registry |
getRegistry()
|
MobyDataServiceAssocInstance |
getServices(MobyDataObject mdo)
|
MobyDataServiceAssocInstance[] |
getServices(MobyDataObject[] mdos)
|
MobyDataServiceAssocInstance |
getServices(MobyDataObjectSet mdos)
|
MobyDataServiceAssocInstance[] |
getServices(MobyDataObjectSet[] mdoss)
|
MobyDataServiceAssocInstance[] |
getServices(Node n)
Performs the moby object creation and service association together (XPath rules). |
MobyDataServiceAssocInstance[] |
getServices(String s)
Performs the moby object creation and service association together (regex rules). |
MobyDataServiceAssocInstance[] |
getServices(URL u)
Performs the moby object creation and service association together (url_regex rules). |
boolean |
isArticleNameRule(Element e)
|
boolean |
isDataTypeRule(Element e)
|
boolean |
isMapped(Node n)
|
boolean |
isMemberRule(Element e)
|
boolean |
isMembersRule(Element e)
|
boolean |
isNamespaceRule(Element e)
|
boolean |
isPrefixRule(Element e)
|
boolean |
isPrimitiveDataType(String dataType)
|
boolean |
isRegex(Element e)
|
boolean |
isURLRegex(Element e)
|
boolean |
isXPath(Element e)
|
void |
setRequiredServiceLevel(int level)
|
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String DATA_MAPPING_XML_RESOURCE
public static final String RESOURCE_SYSTEM_PROPERTY
public static final String RULE_SET_TAG
public static final String RULE_NAME_ATTR
public static final String PREFIX_TAG
public static final String PREFIX_ATTR
public static final String ARTICLENAME_RULE_TAG
public static final String NAMESPACE_RULE_TAG
public static final String NAMESPACE_MODEL_ATTR
public static final String NAMESPACE_VALUE_TAG
public static final String NAMESPACE_VALUE_ATTR
public static final String DATATYPE_RULE_TAG
public static final String DATATYPE_RULE_ATTR
public static final String MEMBER_RULE_TAG
public static final String MEMBER_RULE_ATTR
public static final String MEMBERS_RULE_TAG
public static final String MEMBERS_RULE_ATTR
public static final String URL_REGEX_TAG
public static final String REGEX_TAG
public static final String XPATH_TAG
public static final String WHITESPACE_ATTR
public static final String WHITESPACE_ATTR_STRIP_VAL
public static final String WHITESPACE_ATTR_NORMALIZE_VAL
public static final String WHITESPACE_ATTR_STRIP_FLANKING_VAL
public static final String WHITESPACE_ATTR_KEEP_VAL
public static final String DATATYPE_ATTR
public static final String ENCODING_ATTR
public static final String ENCODING_ATTR_BASE64_VAL
public static final String ENCODING_ATTR_NONE_VAL
public static final String SINGLE_RETURNED_VALUE_KEY
public static final String IS_ALIVE_SERVICE_URL
Constructor Detail |
---|
public MobyClient() throws MobyException
MobyException
public MobyClient(Registry reg) throws MobyException
reg
- the registry that will be called to validate ontology terms and determine available services. If null, the default registry will be used.
MobyException
Method Detail |
---|
public static MobyPrimaryDataSimple getObjectProduced(URL ruleSource, String ruleURI, Registry reg) throws Exception
ruleSource
- where the rule should be loaded fromruleURI
- a unique ID for the rule, in the source XML using Dublin Core
Exception
public Registry getRegistry()
public void addMappingsFromURL(URL u) throws Exception
Exception
public void addNamespaceContext(String prefix, String nsURI)
public boolean isPrefixRule(Element e)
public boolean isRegex(Element e)
public boolean isURLRegex(Element e)
public boolean isXPath(Element e)
public boolean isDataTypeRule(Element e)
public boolean isArticleNameRule(Element e)
public boolean isMemberRule(Element e)
public boolean isMembersRule(Element e)
public boolean isNamespaceRule(Element e)
public boolean isPrimitiveDataType(String dataType)
public CentralImpl getMobyCentralImpl()
public MobyDataServiceAssocInstance[] getServices(Node n) throws MobyException
MobyException
public MobyDataServiceAssocInstance[] getServices(String s) throws MobyException
MobyException
public MobyDataServiceAssocInstance[] getServices(URL u) throws MobyException
MobyException
public MobyDataObject[] getMobyObjects(CharSequence textData, MobyDataType targetDataType)
public MobyDataObject[] getMobyObjects(CharSequence textData, MobyDataType targetDataType, MobyNamespace targetNS)
targetDataType
- matches any data type if null, otherwise restricts returned items to those that are of (or inherit from) the given typepublic MobyDataInstance getMobyObject(Node n, MobyPrimaryData dataTemplate) throws Exception, MobyServiceException
MobyServiceException
- NOTE: these are just warning level exceptions about collection-simple casting that you can add to the service response, or ignore if you like
Exception
public MobyDataInstance getMobyObject(String s, MobyPrimaryData dataTemplate) throws Exception, MobyServiceException
MobyServiceException
- NOTE: these are just warning level exceptions about collection-simple casting that you can add to the service response, or ignore if you like
Exception
public MobyDataInstance getMobyObject(Map<String,byte[]> resultParts, MobyPrimaryData dataTemplate) throws Exception, MobyServiceException
MobyServiceException
- NOTE: these are just warning level exceptions about collection-simple casting that you can add to the service response, or ignore if you like
Exception
public MobyDataObject[] getMobyObjects(byte[] rawData, MobyDataType targetDataType)
public MobyDataObject[] getMobyObjects(CharSequence textData)
public Map<String,MobyDataObject[]> getMobyObjectsURNMap(CharSequence textData)
public Map<String,MobyDataObject[]> getMobyObjectsURNMap(CharSequence textData, byte[] bytes)
public MobyDataObject[] getMobyObjects(CharSequence textData, byte[] bytes)
public MobyDataObject[] getMobyObjects(URL url)
public MobyDataObject[] getMobyObjects(URL url, String linkText)
public MobyDataObject[] getMobyObjects(URL url, MobyDataType targetDataType)
public MobyDataObject[] getMobyObjects(URL url, String linkText, MobyDataType targetDataType)
public MobyDataObject[] getMobyObjects(Node n)
public Map<String,MobyDataObject[]> getMobyObjectsURNMap(Node n)
public void setRequiredServiceLevel(int level)
public MobyDataServiceAssocInstance getServices(MobyDataObjectSet mdos) throws MobyException
MobyException
public MobyDataServiceAssocInstance getServices(MobyDataObject mdo) throws MobyException
MobyException
public MobyDataServiceAssocInstance[] getServices(MobyDataObjectSet[] mdoss) throws MobyException
MobyException
public MobyDataServiceAssocInstance[] getServices(MobyDataObject[] mdos) throws MobyException
MobyException
public boolean isMapped(Node n)
public void addRegexMapping(String regexp, String[] mobyObj)
public void addRegexMapping(String regexp, String[] mobyObj, String articleName, String urn)
public void addURLRegexMapping(String url_regexp, String[] mobyObj, String articleName, String urn)
public void addRegexMapping(String regexp, Map<String,String> nsRules, String mobyDataType, Map<String,String[]> membersMap)
public void addRegexMapping(String regexp, Map<String,String> nsRules, String mobyDataType, Map<String,String[]> membersMap, String articleName, String ruleName, String urn)
public void addURLRegexMapping(String url_regexp, Map<String,String> url_nsRules, String mobyDataType, Map<String,String[]> membersMap, String articleName, String urn)
public void addXPathMapping(String xpath, String[] mobyObj)
public void addXPathMapping(String xpath_exp, Map<String,String> nsRules, String articleName, String urn)
public void addXPathMapping(String xpath_exp, Map<String,String> nsRules, String mobyDataType, Map<String,String[]> membersMap, String articleName, String urn)
public void clear()
public void clearXPaths()
public void clearRegexs()
public void clearURLRegexs()
public boolean canProduceDataTypeFromString(MobyDataType targetDataType)
public MobyComplexBuilder getBuilder(String ruleName)
public Pattern getPattern(String ruleName)
|
Version: 1.1.1 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |