public class PrefixLogger extends Object
Modifier and Type | Field and Description |
---|---|
static Pattern |
candidatePrefix
A pattern that will match candidate prefixes, which will then be checked
against the provided prefix mapping.
|
protected com.hp.hpl.jena.shared.PrefixMapping |
pm |
protected Set<String> |
seen |
Constructor and Description |
---|
PrefixLogger() |
PrefixLogger(com.hp.hpl.jena.shared.PrefixMapping pm) |
Modifier and Type | Method and Description |
---|---|
void |
findPrefixesIn(String fragment)
Look for plausible candidates for prefixes in the SPARQL
fragment and add them to
seen . |
com.hp.hpl.jena.shared.PrefixMapping |
getPrefixMapping()
PrefixMapping is required by extension queries
|
String |
present(Any r) |
String |
present(String unsafeURI)
Present a URI as a SPARQL term, either <>-quoted, or
as a qname if there's a suitable prefix mapping for it.
|
static PrefixLogger |
some()
Answer a new PrefixLoggger with a few standard prefixes in it.
|
StringBuilder |
writePrefixes(StringBuilder out)
Write out the used prefixes as SPARQL prefix declarations
into the StringBuilder
out . |
protected final com.hp.hpl.jena.shared.PrefixMapping pm
public static final Pattern candidatePrefix
public PrefixLogger(com.hp.hpl.jena.shared.PrefixMapping pm)
public PrefixLogger()
public String present(String unsafeURI)
Present a URI as a SPARQL term, either <>-quoted, or as a qname if there's a suitable prefix mapping for it.
SPARQL qname local names can't end with ".", so we protect against generating illegal SPARQL by an ad-hoc check against the URL ending with dot. May need to consider other characters too, and may want to push this protection into Jena.
public StringBuilder writePrefixes(StringBuilder out)
out
. Answer that same
StringBuilder.public void findPrefixesIn(String fragment)
seen
.public static PrefixLogger some()
public com.hp.hpl.jena.shared.PrefixMapping getPrefixMapping()
Copyright © 2014. All Rights Reserved.