Class LocalParseContext
- java.lang.Object
-
- net.ontopia.topicmaps.query.parser.LocalParseContext
-
- All Implemented Interfaces:
DeclarationContextIF
,ParseContextIF
public class LocalParseContext extends Object implements ParseContextIF, DeclarationContextIF
INTERNAL: Represents the local context in which a tolog query or rule file is being parsed. Context may be the context bound to a QueryProcessorIF object, or it may be only a transient local context for a query.
-
-
Field Summary
-
Fields inherited from interface net.ontopia.topicmaps.query.parser.ParseContextIF
ITEM_IDENTIFIER, MODULE, SUBJECT_IDENTIFIER, SUBJECT_LOCATOR
-
-
Constructor Summary
Constructors Constructor Description LocalParseContext(ParseContextIF subcontext)
-
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
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
-
LocalParseContext
public LocalParseContext(ParseContextIF subcontext)
-
-
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) throws AntlrWrapException
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.)- Throws:
AntlrWrapException
-
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
-
addPredicate
public void addPredicate(PredicateIF predicate) throws AntlrWrapException
Description copied from interface:ParseContextIF
INTERNAL: Adds a new predicate to the context.- Specified by:
addPredicate
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
-
getObject
public TMObjectIF getObject(QName qname) throws AntlrWrapException
- Specified by:
getObject
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
-
absolutify
public LocatorIF absolutify(String uriref) throws AntlrWrapException
- Specified by:
absolutify
in interfaceParseContextIF
- Throws:
AntlrWrapException
-
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
-
dump
public void dump()
Description copied from interface:ParseContextIF
INTERNAL: Used for debugging.- Specified by:
dump
in interfaceParseContextIF
-
-