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 LocatorIF
absolutify(String uriref)
void
addPredicate(PredicateIF predicate)
INTERNAL: Adds a new predicate to the context.void
addPrefixBinding(String prefix, String uri, int qualification)
INTERNAL: Adds a prefix binding to the context.void
dump()
INTERNAL: Used for debugging.ModuleIF
getModule(String uri)
TMObjectIF
getObject(QName qname)
TMObjectIF
getObjectByIdentifier(String id)
TMObjectIF
getObjectByItemId(String uri)
TMObjectIF
getObjectByObjectId(String id)
PredicateIF
getPredicate(TopicIF topic, boolean assoc)
PredicateIF
getPredicate(ParsedRule rule)
PredicateIF
getPredicate(QName qname, boolean assoc)
INTERNAL: Returns the named predicate, or null if it does not exist.TopicIF
getTopic(QName qname)
INTERNAL: Interprets the given prefix and localname as a topic, returning null if none is found.TopicIF
getTopicBySubjectIdentifier(String uri)
TopicIF
getTopicBySubjectLocator(String uri)
TopicMapIF
getTopicMap()
INTERNAL: Returns the topic map being parsed against.boolean
isBuiltInPredicate(String name)
INTERNAL: Used to find out if the given predicate name is the name of a built-in predicate.boolean
isLoading(String uri)
INTERNAL: Returns true if the uri is being loaded or has already been loaded.LocatorIF
resolveQName(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:ParseContextIF
INTERNAL: Returns the topic map being parsed against.- Specified by:
getTopicMap
in interfaceParseContextIF
-
resolveQName
public LocatorIF resolveQName(QName qname)
Description copied from interface:ParseContextIF
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). FIXME: what exception to throw?- Specified by:
resolveQName
in interfaceParseContextIF
-
addPrefixBinding
public void addPrefixBinding(String prefix, String uri, int qualification)
Description copied from interface:ParseContextIF
INTERNAL: Adds a prefix binding to the context.- Specified by:
addPrefixBinding
in 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:ParseContextIF
INTERNAL: Adds a new predicate to the context.- Specified by:
addPredicate
in interfaceParseContextIF
-
absolutify
public LocatorIF absolutify(String uriref) throws AntlrWrapException
- Specified by:
absolutify
in interfaceParseContextIF
- Throws:
AntlrWrapException
-
getObjectByIdentifier
public TMObjectIF getObjectByIdentifier(String id)
-
getObjectByObjectId
public TMObjectIF getObjectByObjectId(String id) throws AntlrWrapException
- Specified by:
getObjectByObjectId
in interfaceParseContextIF
- Throws:
AntlrWrapException
-
getTopicBySubjectIdentifier
public TopicIF getTopicBySubjectIdentifier(String uri) throws AntlrWrapException
- Specified by:
getTopicBySubjectIdentifier
in interfaceParseContextIF
- Throws:
AntlrWrapException
-
getTopicBySubjectLocator
public TopicIF getTopicBySubjectLocator(String uri) throws AntlrWrapException
- Specified by:
getTopicBySubjectLocator
in interfaceParseContextIF
- Throws:
AntlrWrapException
-
getObjectByItemId
public TMObjectIF getObjectByItemId(String uri) throws AntlrWrapException
- Specified by:
getObjectByItemId
in interfaceParseContextIF
- Throws:
AntlrWrapException
-
getObject
public TMObjectIF getObject(QName qname) throws AntlrWrapException
- Specified by:
getObject
in interfaceParseContextIF
- Throws:
AntlrWrapException
-
getTopic
public TopicIF getTopic(QName qname) throws AntlrWrapException
Description copied from interface:ParseContextIF
INTERNAL: Interprets the given prefix and localname as a topic, returning null if none is found.- Specified by:
getTopic
in interfaceParseContextIF
- Throws:
AntlrWrapException
-
getPredicate
public PredicateIF getPredicate(QName qname, boolean assoc) throws AntlrWrapException
Description copied from interface:ParseContextIF
INTERNAL: Returns the named predicate, or null if it does not exist.- Specified by:
getPredicate
in interfaceParseContextIF
- Throws:
AntlrWrapException
-
getPredicate
public PredicateIF getPredicate(TopicIF topic, boolean assoc)
- Specified by:
getPredicate
in interfaceParseContextIF
-
getPredicate
public PredicateIF getPredicate(ParsedRule rule)
- Specified by:
getPredicate
in interfaceParseContextIF
-
getModule
public ModuleIF getModule(String uri)
- Specified by:
getModule
in interfaceParseContextIF
-
isLoading
public boolean isLoading(String uri)
Description copied from interface:ParseContextIF
INTERNAL: 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:
isLoading
in interfaceParseContextIF
-
isBuiltInPredicate
public boolean isBuiltInPredicate(String name)
Description copied from interface:ParseContextIF
INTERNAL: 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:
isBuiltInPredicate
in interfaceParseContextIF
-
dump
public void dump()
Description copied from interface:ParseContextIF
INTERNAL: Used for debugging.- Specified by:
dump
in interfaceParseContextIF
-
-