org.topbraid.strings
Class Labels

java.lang.Object
  extended by org.topbraid.strings.Labels

public class Labels
extends java.lang.Object

A Singleton that can be used to get a textual representation of resources, depending on the current settings (qnames etc).

Author:
Holger Knublauch

Field Summary
static java.lang.String COMPLEMENT_OF
           
static java.lang.String ONE_OF
           
 
Constructor Summary
Labels()
           
 
Method Summary
static void append(java.lang.StringBuffer buffer, com.hp.hpl.jena.ontology.DataRange dataRange)
           
static void append(java.lang.StringBuffer sb, java.util.Iterator<com.hp.hpl.jena.rdf.model.RDFNode> nodes)
           
static void append(java.lang.StringBuffer sb, java.util.Iterator<com.hp.hpl.jena.rdf.model.RDFNode> nodes, java.lang.String separator)
           
static void append(java.lang.StringBuffer sb, com.hp.hpl.jena.datatypes.RDFDatatype datatype)
           
static void append(java.lang.StringBuffer sb, com.hp.hpl.jena.rdf.model.RDFNode node)
           
static void append(java.lang.StringBuffer sb, com.hp.hpl.jena.rdf.model.RDFNode[] nodes)
           
static void append(java.lang.StringBuffer sb, com.hp.hpl.jena.rdf.model.RDFNode[] nodes, java.lang.String separator)
           
static void append(java.lang.StringBuffer sb, com.hp.hpl.jena.rdf.model.RDFNode node, boolean multiLine)
           
static void append(java.lang.StringBuffer s, com.hp.hpl.jena.rdf.model.Statement statement)
           
static void appendObjects(java.lang.StringBuffer sb, com.hp.hpl.jena.rdf.model.StmtIterator nodes)
           
static boolean appendQName(java.lang.StringBuffer sb, com.hp.hpl.jena.rdf.model.Resource resource)
          Tries to append the qname for a given resource.
static void appendWithoutPlugins(java.lang.StringBuffer sb, com.hp.hpl.jena.rdf.model.RDFNode node, boolean multiLine)
           
static void clearCache()
           
static java.lang.String getInlineURI(java.lang.String text)
           
static java.lang.String getLabel(com.hp.hpl.jena.datatypes.RDFDatatype datatype)
           
static java.lang.String getLabel(com.hp.hpl.jena.rdf.model.RDFNode node)
           
static java.lang.String getLabel(com.hp.hpl.jena.rdf.model.RDFNode node, boolean multiLine)
           
static com.hp.hpl.jena.rdf.model.Literal getLiteral(com.hp.hpl.jena.rdf.model.Model model, com.hp.hpl.jena.datatypes.RDFDatatype datatype, java.lang.String str)
           
static com.hp.hpl.jena.rdf.model.Literal getLiteral(com.hp.hpl.jena.rdf.model.Model model, java.lang.String datatypeURI, java.lang.String str)
           
static java.lang.String getLocalName(com.hp.hpl.jena.rdf.model.Model model, java.lang.String qname)
           
static java.lang.String getNamespace(com.hp.hpl.jena.rdf.model.Model model, java.lang.String qname)
           
static java.lang.String getQName(com.hp.hpl.jena.rdf.model.Model model, java.lang.String uri)
           
static java.lang.String getQName(com.hp.hpl.jena.rdf.model.Resource resource)
           
static java.lang.String getRDFSLabel(com.hp.hpl.jena.rdf.model.Resource resource)
           
static com.hp.hpl.jena.rdf.model.Resource getResource(com.hp.hpl.jena.rdf.model.Model model, java.lang.String str)
          Attempts to reverse a string representation into a Resource in a given Model.
static com.hp.hpl.jena.rdf.model.Resource getResourceByName(com.hp.hpl.jena.rdf.model.Model model, java.lang.String name)
           
static com.hp.hpl.jena.rdf.model.Literal getStringLiteral(java.lang.String str, boolean untyped)
          Resolves literals that may have an optional language tag in the {...} notation.
static java.lang.String getURI(com.hp.hpl.jena.rdf.model.Model model, java.lang.String name)
           
static java.lang.String getURIFlex(java.lang.String name)
           
static boolean isInlineURI(java.lang.String text)
           
static boolean isQNameCharacter(char c)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

COMPLEMENT_OF

public static final java.lang.String COMPLEMENT_OF
See Also:
Constant Field Values

ONE_OF

public static final java.lang.String ONE_OF
See Also:
Constant Field Values
Constructor Detail

Labels

public Labels()
Method Detail

append

public static void append(java.lang.StringBuffer sb,
                          com.hp.hpl.jena.rdf.model.RDFNode[] nodes)

append

public static void append(java.lang.StringBuffer sb,
                          com.hp.hpl.jena.rdf.model.RDFNode[] nodes,
                          java.lang.String separator)

append

public static void append(java.lang.StringBuffer sb,
                          java.util.Iterator<com.hp.hpl.jena.rdf.model.RDFNode> nodes)

append

public static void append(java.lang.StringBuffer sb,
                          java.util.Iterator<com.hp.hpl.jena.rdf.model.RDFNode> nodes,
                          java.lang.String separator)

append

public static void append(java.lang.StringBuffer buffer,
                          com.hp.hpl.jena.ontology.DataRange dataRange)

append

public static void append(java.lang.StringBuffer sb,
                          com.hp.hpl.jena.datatypes.RDFDatatype datatype)

append

public static void append(java.lang.StringBuffer sb,
                          com.hp.hpl.jena.rdf.model.RDFNode node)

append

public static void append(java.lang.StringBuffer sb,
                          com.hp.hpl.jena.rdf.model.RDFNode node,
                          boolean multiLine)

appendWithoutPlugins

public static void appendWithoutPlugins(java.lang.StringBuffer sb,
                                        com.hp.hpl.jena.rdf.model.RDFNode node,
                                        boolean multiLine)

append

public static void append(java.lang.StringBuffer s,
                          com.hp.hpl.jena.rdf.model.Statement statement)

appendObjects

public static void appendObjects(java.lang.StringBuffer sb,
                                 com.hp.hpl.jena.rdf.model.StmtIterator nodes)

appendQName

public static boolean appendQName(java.lang.StringBuffer sb,
                                  com.hp.hpl.jena.rdf.model.Resource resource)
Tries to append the qname for a given resource. This fails if no suitable prefix is defined for the namespace of the resource.

Parameters:
resource - the URI resource to add the qname of
Returns:
true if successful

clearCache

public static void clearCache()

getInlineURI

public static java.lang.String getInlineURI(java.lang.String text)

getLabel

public static java.lang.String getLabel(com.hp.hpl.jena.datatypes.RDFDatatype datatype)

getLabel

public static java.lang.String getLabel(com.hp.hpl.jena.rdf.model.RDFNode node)

getLabel

public static java.lang.String getLabel(com.hp.hpl.jena.rdf.model.RDFNode node,
                                        boolean multiLine)

getLocalName

public static java.lang.String getLocalName(com.hp.hpl.jena.rdf.model.Model model,
                                            java.lang.String qname)

getNamespace

public static java.lang.String getNamespace(com.hp.hpl.jena.rdf.model.Model model,
                                            java.lang.String qname)

getQName

public static java.lang.String getQName(com.hp.hpl.jena.rdf.model.Resource resource)

getQName

public static java.lang.String getQName(com.hp.hpl.jena.rdf.model.Model model,
                                        java.lang.String uri)

getRDFSLabel

public static java.lang.String getRDFSLabel(com.hp.hpl.jena.rdf.model.Resource resource)

getResource

public static com.hp.hpl.jena.rdf.model.Resource getResource(com.hp.hpl.jena.rdf.model.Model model,
                                                             java.lang.String str)
Attempts to reverse a string representation into a Resource in a given Model. This will also convert the <...> notations, but will not check whether the resource actually exists in the target model.

Parameters:
model - the target Model
str - the string representation
Returns:
the resource or null

getResourceByName

public static com.hp.hpl.jena.rdf.model.Resource getResourceByName(com.hp.hpl.jena.rdf.model.Model model,
                                                                   java.lang.String name)

getLiteral

public static com.hp.hpl.jena.rdf.model.Literal getLiteral(com.hp.hpl.jena.rdf.model.Model model,
                                                           com.hp.hpl.jena.datatypes.RDFDatatype datatype,
                                                           java.lang.String str)

getLiteral

public static com.hp.hpl.jena.rdf.model.Literal getLiteral(com.hp.hpl.jena.rdf.model.Model model,
                                                           java.lang.String datatypeURI,
                                                           java.lang.String str)

getStringLiteral

public static com.hp.hpl.jena.rdf.model.Literal getStringLiteral(java.lang.String str,
                                                                 boolean untyped)
Resolves literals that may have an optional language tag in the {...} notation. If the string ends with {...}, then a Literal with language tag is created, otherwise a plain untyped literal with the whole input string.

Parameters:
str - the literal serialization
untyped - true to return an untyped literal, otherwise it will have xsd:string
Returns:
a Literal, possibly with lang tag

getURI

public static java.lang.String getURI(com.hp.hpl.jena.rdf.model.Model model,
                                      java.lang.String name)

getURIFlex

public static java.lang.String getURIFlex(java.lang.String name)

isInlineURI

public static boolean isInlineURI(java.lang.String text)

isQNameCharacter

public static boolean isQNameCharacter(char c)