org.topbraid.spin.model.print
Interface PrintContext

All Known Implementing Classes:
StringPrintContext

public interface PrintContext

A status object passed along during printing of SPIN expressions in SPARQL syntax.

Author:
Holger Knublauch

Method Summary
 PrintContext clone()
          Creates a clone of this PrintContext so that it can be used recursively.
 int getIndentation()
          Gets the indentation level starting at 0.
 NodeToLabelMap getNodeToLabelMap()
          Gets the Jena NodeToLabelMap associated with this.
 boolean getPrintPrefixes()
          Checks whether prefix declarations shall be printed into the head of the query.
 boolean getUseExtraPrefixes()
          Checks if the extra prefixes (such as afn:) shall be used to resolve qnames, even if they are not imported by the current model.
 boolean getUsePrefixes()
          Checks if resource URIs shall be abbreviated with qnames at all.
 boolean isNested()
          Checks if we are inside braces such as a nested expression.
 void print(java.lang.String str)
          Prints a given string to the output stream.
 void printIndentation(int depth)
          Prints the indentation string depth times.
 void printKeyword(java.lang.String str)
          Prints a keyword to the output stream.
 void println()
          Prints a line break to the output stream.
 void printURIResource(Resource resource)
          Prints a URI to the output stream.
 void printVariable(java.lang.String str)
          Prints a variable to the output stream.
 void setIndentation(int value)
          Changes the indentation level.
 void setNested(boolean value)
          Sets the nested flag.
 void setPrintPrefixes(boolean value)
          Sets the printPrefixes flag.
 void setUseExtraPrefixes(boolean value)
          Specifies whether the context shall use extra prefixes.
 void setUsePrefixes(boolean value)
          Specifies whether the context shall use any prefixes at all.
 

Method Detail

clone

PrintContext clone()
Creates a clone of this PrintContext so that it can be used recursively.

Returns:
a clone

getIndentation

int getIndentation()
Gets the indentation level starting at 0. Indentation increases in element groups.

Returns:
the indentation level
See Also:
setIndentation(int)

getNodeToLabelMap

NodeToLabelMap getNodeToLabelMap()
Gets the Jena NodeToLabelMap associated with this.

Returns:
the NodeToLabelMap

getPrintPrefixes

boolean getPrintPrefixes()
Checks whether prefix declarations shall be printed into the head of the query. By default this is switched off, but if turned on then the system should print all used prefixes.

Returns:
true to print prefixes

getUseExtraPrefixes

boolean getUseExtraPrefixes()
Checks if the extra prefixes (such as afn:) shall be used to resolve qnames, even if they are not imported by the current model.

Returns:
true if the extra prefixes shall be used
See Also:
setUseExtraPrefixes(boolean)

getUsePrefixes

boolean getUsePrefixes()
Checks if resource URIs shall be abbreviated with qnames at all. If not, then the URIs are rendered using the <...> notation.

Returns:
true if this is using prefixes

isNested

boolean isNested()
Checks if we are inside braces such as a nested expression.

Returns:
if the context is currently in nested mode

print

void print(java.lang.String str)
Prints a given string to the output stream.

Parameters:
str - the String to print

printIndentation

void printIndentation(int depth)
Prints the indentation string depth times. For example, for depth=2 this might print " ".

Parameters:
depth - the number of indentations to print

printKeyword

void printKeyword(java.lang.String str)
Prints a keyword to the output stream. This can be overloaded by subclasses to do special rendering such as syntax highlighting.

Parameters:
str - the keyword string

println

void println()
Prints a line break to the output stream. Typically this would be a /n but implementations may also do
.


printURIResource

void printURIResource(Resource resource)
Prints a URI to the output stream. This can be overloaded by subclasses to do special rendering such as syntax highlighting.

Parameters:
resource - the URI of the resource to print

printVariable

void printVariable(java.lang.String str)
Prints a variable to the output stream. This can be overloaded by subclasses to do special rendering such as syntax highlighting.

Parameters:
str - the variable string excluding the ?

setIndentation

void setIndentation(int value)
Changes the indentation level.

Parameters:
value - the new indentation level

setNested

void setNested(boolean value)
Sets the nested flag.

Parameters:
value - the new value
See Also:
isNested()

setPrintPrefixes

void setPrintPrefixes(boolean value)
Sets the printPrefixes flag.

Parameters:
value - the new value
See Also:
getPrintPrefixes()

setUseExtraPrefixes

void setUseExtraPrefixes(boolean value)
Specifies whether the context shall use extra prefixes.

Parameters:
value - the new value
See Also:
getUseExtraPrefixes()

setUsePrefixes

void setUsePrefixes(boolean value)
Specifies whether the context shall use any prefixes at all.

Parameters:
value - the new value
See Also:
getUsePrefixes()