Class GlobalParseContext
- java.lang.Object
-
- net.ontopia.topicmaps.query.parser.GlobalParseContext
-
- All Implemented Interfaces:
ParseContextIF
public class GlobalParseContext extends Object implements ParseContextIF
INTERNAL: Represents the global immutable context of all tolog queries.
-
-
Field Summary
-
Fields inherited from interface net.ontopia.topicmaps.query.parser.ParseContextIF
ITEM_IDENTIFIER, MODULE, SUBJECT_IDENTIFIER, SUBJECT_LOCATOR
-
-
Constructor Summary
Constructors Constructor Description GlobalParseContext(PredicateFactoryIF factory, TopicMapIF topicmap)GlobalParseContext(PredicateFactoryIF factory, TopicMapIF topicmap, LocatorIF base)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description LocatorIFabsolutify(String uriref)voidaddPredicate(PredicateIF predicate)INTERNAL: Adds a new predicate to the context.voidaddPrefixBinding(String prefix, String uri, int qualification)INTERNAL: Adds a prefix binding to the context.voiddump()INTERNAL: Used for debugging.ModuleIFgetModule(String uri)TMObjectIFgetObject(QName qname)TMObjectIFgetObjectByIdentifier(String id)TMObjectIFgetObjectByItemId(String uri)TMObjectIFgetObjectByObjectId(String id)PredicateIFgetPredicate(TopicIF topic, boolean assoc)PredicateIFgetPredicate(ParsedRule rule)PredicateIFgetPredicate(QName qname, boolean assoc)INTERNAL: Returns the named predicate, or null if it does not exist.TopicIFgetTopic(QName qname)INTERNAL: Interprets the given prefix and localname as a topic, returning null if none is found.TopicIFgetTopicBySubjectIdentifier(String uri)TopicIFgetTopicBySubjectLocator(String uri)TopicMapIFgetTopicMap()INTERNAL: Returns the topic map being parsed against.booleanisBuiltInPredicate(String name)INTERNAL: Used to find out if the given predicate name is the name of a built-in predicate.booleanisLoading(String uri)INTERNAL: Returns true if the uri is being loaded or has already been loaded.LocatorIFresolveQName(QName qname)INTERNAL: Returns the full locator for the given QName, or reports an error if the prefix is unbound, or if the prefix is bound to something other than a subject identifier namespace (since this is used for the CTM part of tolog INSERT only).
-
-
-
Constructor Detail
-
GlobalParseContext
public GlobalParseContext(PredicateFactoryIF factory, TopicMapIF topicmap)
-
GlobalParseContext
public GlobalParseContext(PredicateFactoryIF factory, TopicMapIF topicmap, LocatorIF base)
-
-
Method Detail
-
getTopicMap
public TopicMapIF getTopicMap()
Description copied from interface:ParseContextIFINTERNAL: Returns the topic map being parsed against.- Specified by:
getTopicMapin interfaceParseContextIF
-
resolveQName
public LocatorIF resolveQName(QName qname)
Description copied from interface:ParseContextIFINTERNAL: Returns the full locator for the given QName, or reports an error if the prefix is unbound, or if the prefix is bound to something other than a subject identifier namespace (since this is used for the CTM part of tolog INSERT only). FIXME: what exception to throw?- Specified by:
resolveQNamein interfaceParseContextIF
-
addPrefixBinding
public void addPrefixBinding(String prefix, String uri, int qualification)
Description copied from interface:ParseContextIFINTERNAL: Adds a prefix binding to the context.- Specified by:
addPrefixBindingin interfaceParseContextIF- Parameters:
prefix- The prefix whose binding is being defined.uri- The (possibly relative) URI reference to which the prefix is bound.qualification- The interpretation of the URI. (Defined using local constants.)
-
addPredicate
public void addPredicate(PredicateIF predicate)
Description copied from interface:ParseContextIFINTERNAL: Adds a new predicate to the context.- Specified by:
addPredicatein interfaceParseContextIF
-
absolutify
public LocatorIF absolutify(String uriref) throws AntlrWrapException
- Specified by:
absolutifyin interfaceParseContextIF- Throws:
AntlrWrapException
-
getObjectByIdentifier
public TMObjectIF getObjectByIdentifier(String id)
-
getObjectByObjectId
public TMObjectIF getObjectByObjectId(String id) throws AntlrWrapException
- Specified by:
getObjectByObjectIdin interfaceParseContextIF- Throws:
AntlrWrapException
-
getTopicBySubjectIdentifier
public TopicIF getTopicBySubjectIdentifier(String uri) throws AntlrWrapException
- Specified by:
getTopicBySubjectIdentifierin interfaceParseContextIF- Throws:
AntlrWrapException
-
getTopicBySubjectLocator
public TopicIF getTopicBySubjectLocator(String uri) throws AntlrWrapException
- Specified by:
getTopicBySubjectLocatorin interfaceParseContextIF- Throws:
AntlrWrapException
-
getObjectByItemId
public TMObjectIF getObjectByItemId(String uri) throws AntlrWrapException
- Specified by:
getObjectByItemIdin interfaceParseContextIF- Throws:
AntlrWrapException
-
getObject
public TMObjectIF getObject(QName qname) throws AntlrWrapException
- Specified by:
getObjectin interfaceParseContextIF- Throws:
AntlrWrapException
-
getTopic
public TopicIF getTopic(QName qname) throws AntlrWrapException
Description copied from interface:ParseContextIFINTERNAL: Interprets the given prefix and localname as a topic, returning null if none is found.- Specified by:
getTopicin interfaceParseContextIF- Throws:
AntlrWrapException
-
getPredicate
public PredicateIF getPredicate(QName qname, boolean assoc) throws AntlrWrapException
Description copied from interface:ParseContextIFINTERNAL: Returns the named predicate, or null if it does not exist.- Specified by:
getPredicatein interfaceParseContextIF- Throws:
AntlrWrapException
-
getPredicate
public PredicateIF getPredicate(TopicIF topic, boolean assoc)
- Specified by:
getPredicatein interfaceParseContextIF
-
getPredicate
public PredicateIF getPredicate(ParsedRule rule)
- Specified by:
getPredicatein interfaceParseContextIF
-
getModule
public ModuleIF getModule(String uri)
- Specified by:
getModulein interfaceParseContextIF
-
isLoading
public boolean isLoading(String uri)
Description copied from interface:ParseContextIFINTERNAL: Returns true if the uri is being loaded or has already been loaded. This method is used to make sure that there are no infinite recursion when importing modules.- Specified by:
isLoadingin interfaceParseContextIF
-
isBuiltInPredicate
public boolean isBuiltInPredicate(String name)
Description copied from interface:ParseContextIFINTERNAL: Used to find out if the given predicate name is the name of a built-in predicate. Needed for error checking, see bug #1082.- Specified by:
isBuiltInPredicatein interfaceParseContextIF
-
dump
public void dump()
Description copied from interface:ParseContextIFINTERNAL: Used for debugging.- Specified by:
dumpin interfaceParseContextIF
-
-