Package org.apache.jena.util
Class PrintUtil
- java.lang.Object
-
- org.apache.jena.util.PrintUtil
-
public class PrintUtil extends java.lang.Object
A collection of small utilities for pretty printing nodes, triples and associated things. The core functionality here is a static prefix map which is preloaded with known prefixes.
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
egNS
Default built in eg namespace used in testing
-
Constructor Summary
Constructors Constructor Description PrintUtil()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.lang.String
expandQname(java.lang.String uri)
Expand qnames to URIs.static void
init()
Load built in prefixes.static java.lang.String
print(java.lang.Object obj)
Default print which just uses tostringstatic java.lang.String
print(Node node)
Return a simplified print string for a Node.static java.lang.String
print(Triple triple)
Return a simplified print string for a Triplestatic java.lang.String
print(RDFNode node)
Return a simplified print string for an RDFNode.static java.lang.String
print(Statement stmt)
Return a simplified print string for a statementstatic java.lang.String
print(TriplePattern triple)
Return a simplified print string for a TriplePatternstatic void
printIndent(java.io.PrintWriter out, int indent)
Print an n-space indent to the given output streamstatic void
printOut(java.util.Iterator<?> it)
Print all the Triple values from a find iterator.static void
registerPrefix(java.lang.String prefix, java.lang.String namespace)
Register a new prefix/namespace mapping which will be used to shorten the print strings for resources in known namespaces.static void
registerPrefixMap(java.util.Map<java.lang.String,java.lang.String> map)
Register a set of new prefix/namespace mapping which will be used to shorten the print strings for resources in known namespaces.static void
removePrefix(java.lang.String prefix)
Remove a registered prefix from the table of known short formsstatic void
removePrefixMap(java.util.Map<java.lang.String,java.lang.String> map)
Remove a set of prefix mappings from the table of known short forms
-
-
-
Field Detail
-
egNS
public static final java.lang.String egNS
Default built in eg namespace used in testing- See Also:
- Constant Field Values
-
-
Method Detail
-
init
public static void init()
Load built in prefixes.
-
registerPrefix
public static void registerPrefix(java.lang.String prefix, java.lang.String namespace)
Register a new prefix/namespace mapping which will be used to shorten the print strings for resources in known namespaces.
-
registerPrefixMap
public static void registerPrefixMap(java.util.Map<java.lang.String,java.lang.String> map)
Register a set of new prefix/namespace mapping which will be used to shorten the print strings for resources in known namespaces.
-
removePrefix
public static void removePrefix(java.lang.String prefix)
Remove a registered prefix from the table of known short forms
-
removePrefixMap
public static void removePrefixMap(java.util.Map<java.lang.String,java.lang.String> map)
Remove a set of prefix mappings from the table of known short forms
-
print
public static java.lang.String print(Node node)
Return a simplified print string for a Node.
-
print
public static java.lang.String print(RDFNode node)
Return a simplified print string for an RDFNode.
-
print
public static java.lang.String print(Triple triple)
Return a simplified print string for a Triple
-
print
public static java.lang.String print(TriplePattern triple)
Return a simplified print string for a TriplePattern
-
print
public static java.lang.String print(Statement stmt)
Return a simplified print string for a statement
-
print
public static java.lang.String print(java.lang.Object obj)
Default print which just uses tostring
-
expandQname
public static java.lang.String expandQname(java.lang.String uri)
Expand qnames to URIs. If the given URI appears to start with one of the registered prefixes then expand the prefix, otherwise return the original URI
-
printIndent
public static void printIndent(java.io.PrintWriter out, int indent)
Print an n-space indent to the given output stream
-
printOut
public static void printOut(java.util.Iterator<?> it)
Print all the Triple values from a find iterator.
-
-