public class StringPrintContext extends Object implements PrintContext
| Modifier and Type | Field and Description |
|---|---|
protected String |
indentationString |
| Constructor and Description |
|---|
StringPrintContext() |
StringPrintContext(StringBuilder sb) |
StringPrintContext(StringBuilder sb,
Map<String,org.apache.jena.rdf.model.RDFNode> initialBindings) |
| Modifier and Type | Method and Description |
|---|---|
PrintContext |
clone()
Creates a clone of this PrintContext so that it can be used recursively.
|
int |
getIndentation()
Gets the indentation level starting at 0.
|
org.apache.jena.rdf.model.RDFNode |
getInitialBinding(String varName)
Gets an initial binding for a variable, so that a constant
will be inserted into the query string instead of the variable name.
|
org.apache.jena.sparql.util.NodeToLabelMap |
getNodeToLabelMap()
Gets the Jena NodeToLabelMap associated with this.
|
boolean |
getPrintPrefixes()
Checks whether prefix declarations shall be printed into the
head of the query.
|
String |
getString() |
StringBuilder |
getStringBuilder() |
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 |
hasInitialBindings()
Checks whether any initial bindings have been declared for this context.
|
boolean |
isNamedBNodeMode()
Checks if we are inside of a mode (such as INSERT { GRAPH { ...
|
boolean |
isNested()
Checks if we are inside braces such as a nested expression.
|
void |
print(String str)
Prints a given string to the output stream.
|
void |
printIndentation(int depth)
Prints the indentation string depth times.
|
void |
printKeyword(String str)
Prints a keyword to the output stream.
|
void |
println()
Prints a line break to the output stream.
|
void |
printURIResource(org.apache.jena.rdf.model.Resource resource)
Prints a URI to the output stream.
|
void |
printVariable(String str)
Prints a variable to the output stream.
|
static String |
qnameFor(org.apache.jena.rdf.model.Resource resource)
Work-around for a bug in Jena: Jena would use the default
namespace of an imported Graph in a MultiUnion.
|
void |
setIndentation(int value)
Changes the indentation level.
|
void |
setIndentationString(String value) |
void |
setNamedBNodeMode(boolean value)
Activates or deactivates the mode in which bnodes are rendered as named
variables, such as _:b0.
|
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.
|
protected String indentationString
public StringPrintContext()
public StringPrintContext(StringBuilder sb)
public StringPrintContext(StringBuilder sb, Map<String,org.apache.jena.rdf.model.RDFNode> initialBindings)
public PrintContext clone()
PrintContextclone in interface PrintContextclone in class Objectpublic int getIndentation()
PrintContextgetIndentation in interface PrintContextPrintContext.setIndentation(int)public org.apache.jena.rdf.model.RDFNode getInitialBinding(String varName)
PrintContextgetInitialBinding in interface PrintContextvarName - the name of the variable to matchpublic org.apache.jena.sparql.util.NodeToLabelMap getNodeToLabelMap()
PrintContextgetNodeToLabelMap in interface PrintContextpublic boolean getPrintPrefixes()
PrintContextgetPrintPrefixes in interface PrintContextpublic String getString()
public StringBuilder getStringBuilder()
public boolean getUseExtraPrefixes()
PrintContextgetUseExtraPrefixes in interface PrintContextPrintContext.setUseExtraPrefixes(boolean)public boolean getUsePrefixes()
PrintContextgetUsePrefixes in interface PrintContextpublic boolean hasInitialBindings()
PrintContexthasInitialBindings in interface PrintContextpublic boolean isNamedBNodeMode()
PrintContextisNamedBNodeMode in interface PrintContextpublic boolean isNested()
PrintContextisNested in interface PrintContextpublic void print(String str)
PrintContextprint in interface PrintContextstr - Non-null string.public void printIndentation(int depth)
PrintContextprintIndentation in interface PrintContextdepth - the number of indentations to printpublic void printKeyword(String str)
PrintContextprintKeyword in interface PrintContextstr - the keyword stringpublic void println()
PrintContextprintln in interface PrintContextpublic void printVariable(String str)
PrintContextprintVariable in interface PrintContextstr - the variable string excluding the ?public void printURIResource(org.apache.jena.rdf.model.Resource resource)
PrintContextprintURIResource in interface PrintContextresource - the URI of the resource to printpublic static String qnameFor(org.apache.jena.rdf.model.Resource resource)
resource - the Resource to get the qname forpublic void setIndentation(int value)
PrintContextsetIndentation in interface PrintContextvalue - the new indentation levelpublic void setIndentationString(String value)
public void setNamedBNodeMode(boolean value)
PrintContextsetNamedBNodeMode in interface PrintContextvalue - true to activate, false to deactivatepublic void setNested(boolean value)
PrintContextsetNested in interface PrintContextvalue - the new valuePrintContext.isNested()public void setPrintPrefixes(boolean value)
PrintContextsetPrintPrefixes in interface PrintContextvalue - the new valuePrintContext.getPrintPrefixes()public void setUseExtraPrefixes(boolean value)
PrintContextsetUseExtraPrefixes in interface PrintContextvalue - the new valuePrintContext.getUseExtraPrefixes()public void setUsePrefixes(boolean value)
PrintContextsetUsePrefixes in interface PrintContextvalue - the new valuePrintContext.getUsePrefixes()Copyright © 2017 TopQuadrant, Inc.. All rights reserved.