org.openanzo.glitter.syntax.concrete
Class SPARQLParserBase

java.lang.Object
  extended by org.openanzo.glitter.syntax.concrete.SPARQLParserBase
Direct Known Subclasses:
SPARQLParser

public abstract class SPARQLParserBase
extends java.lang.Object

The base class for SPARQL parsers generated from a JavaCC grammar.

Author:
lee

Constructor Summary
SPARQLParserBase()
          Default constructor.
 
Method Summary
 void enterGroupScope()
          Define a new scope which will have a new set of blank nodes.
 java.lang.String evaluateStringLiteral(java.lang.String s)
          (1) Strip quotes from the beginning and end of the string.
 void exitGroupScope()
          Ends a blank node label scope.
 BlankNodeManager getBlankNodeManager()
           
 QueryController getQueryController()
           
 Variable getVariable(java.lang.String name)
          This accessor ensures that all variables with the same name will share the same Variable reference.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SPARQLParserBase

public SPARQLParserBase()
Default constructor.

Method Detail

enterGroupScope

public void enterGroupScope()
Define a new scope which will have a new set of blank nodes. Pushes the new scope onto a stack. Should be paired with exitGroupScope()


exitGroupScope

public void exitGroupScope()
Ends a blank node label scope. Should be paired with exitGroupScope()


getBlankNodeManager

public BlankNodeManager getBlankNodeManager()
Returns:
A BlankNodeManager for the current group scope.

getQueryController

public QueryController getQueryController()
Returns:
The QueryController for the query currently being parsed

getVariable

public Variable getVariable(java.lang.String name)
This accessor ensures that all variables with the same name will share the same Variable reference.

Parameters:
name - name of variable to get
Returns:
Variable for the given name

evaluateStringLiteral

public java.lang.String evaluateStringLiteral(java.lang.String s)
                                       throws StringLiteralException
(1) Strip quotes from the beginning and end of the string. (2) perform the following substitutions (a) \\uHHHH -> unicode code point at hex value HHHH (b) \UHHHHHHHH -> unicode code point at hex value HHHHHHHH (c) \t -> U+0009 (tab) (d) \n -> U+000A (line feed) (e) \r -> U+000D (carriage return) (f) \b -> U+0008 (backspace) (g) \f -> U+000C (form feed) (h) \" -> U+0022 (quotation mark, double quote mark) (i) \' -> U+0027 (apostrophe-quote, single quote mark) (j) \\ -> U+005C (backslash)

Parameters:
s - The lexical representation of the string from within a query.
Returns:
The value of the lexical representation.
Throws:
StringLiteralException


Copyright © 2007 Cambridge Semantics Inc.. All Rights Reserved.