Package org.topbraid.jenax.util
Class RDFLabels
- java.lang.Object
-
- org.topbraid.jenax.util.RDFLabels
-
public class RDFLabels extends Object
A singleton that is used to render resources into strings. By default this displays qnames (if possible). Can be changed, for example, to switch to displaying rdfs:labels instead of qnames etc.- Author:
- Holger Knublauch
-
-
Constructor Summary
Constructors Constructor Description RDFLabels()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static voidappendTemplateCallLabel(StringBuffer buffer, String labelTemplate, Map<String,org.apache.jena.rdf.model.RDFNode> args)Renders a template call's label template into a label by inserting the evaluated SPARQL expressions into appropriate spaces marked with {expression}.static RDFLabelsget()Gets the singleton instance of this class.StringgetBlankNodeLabel(org.apache.jena.rdf.model.Resource resource)Gets a "human-readable" label for a blank node, e.g.StringgetCustomizedLabel(org.apache.jena.rdf.model.Resource resource)Gets a "human-readable" label for a given Resource.StringgetLabel(org.apache.jena.rdf.model.Resource resource)Gets the label for a given Resource.StringgetNodeLabel(org.apache.jena.rdf.model.RDFNode node)static voidset(RDFLabels value)Replaces the singleton to a subclass with different behavior.static StringunCamelCase(String camelCase)Takes a string that is (likely) in camelCase and attempts to produce an un-camel-cased version of that.
-
-
-
Method Detail
-
get
public static RDFLabels get()
Gets the singleton instance of this class.- Returns:
- the singleton
-
set
public static void set(RDFLabels value)
Replaces the singleton to a subclass with different behavior. This is used by TopBraid, which has its own rendering engine.- Parameters:
value- the new engine
-
getBlankNodeLabel
public String getBlankNodeLabel(org.apache.jena.rdf.model.Resource resource)
Gets a "human-readable" label for a blank node, e.g. Manchester Syntax for OWL restrictions. The default implementation doesn't do much yet it's overloaded in TopBraid.- Parameters:
resource- the blank node resource to get the label for- Returns:
- a label for the bnode
-
getCustomizedLabel
public String getCustomizedLabel(org.apache.jena.rdf.model.Resource resource)
Gets a "human-readable" label for a given Resource. This checks for any existing rdfs:label, otherwise falls back togetLabel().- Parameters:
resource- the resource to get the label for- Returns:
- the label (never null)
-
getLabel
public String getLabel(org.apache.jena.rdf.model.Resource resource)
Gets the label for a given Resource.- Parameters:
resource- the Resource to get the label of- Returns:
- the label (never null)
-
getNodeLabel
public String getNodeLabel(org.apache.jena.rdf.model.RDFNode node)
-
appendTemplateCallLabel
public static void appendTemplateCallLabel(StringBuffer buffer, String labelTemplate, Map<String,org.apache.jena.rdf.model.RDFNode> args)
Renders a template call's label template into a label by inserting the evaluated SPARQL expressions into appropriate spaces marked with {expression}. Currently only simple variables are supported, e.g. {?test }.- Parameters:
buffer- the StringBuffer to write tolabelTemplate- the labelTemplateargs- the arguments a Map of pre-bound variables (supplied arguments)
-
-