Package org.eclipse.rdf4j.console
Class Util
- java.lang.Object
-
- org.eclipse.rdf4j.console.Util
-
public class Util extends Object
Helper class- Author:
- Bart Hanssens
-
-
Constructor Summary
Constructors Constructor Description Util()
-
Method Summary
All Methods Static Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static StringformatToWidth(int width, String padding, String str, String separator)Deprecated.static org.eclipse.rdf4j.model.ResourcegetContext(org.eclipse.rdf4j.repository.Repository repository, String ctxID)Get context IRI from string representationstatic org.eclipse.rdf4j.model.Resource[]getContexts(String[] tokens, int pos, org.eclipse.rdf4j.repository.Repository repository)Get context IRIs from a series of tokens, starting from (zero-based) position within the series.static PathgetNormalizedPath(Path workDir, String file)Get path from file string if it's absolute, or from working directory if the file is relative.static PathgetPath(String file)Deprecated.static StringgetPrefixedValue(org.eclipse.rdf4j.model.Value value, Map<String,String> namespaces)Get string representation for a value.static booleanisHttpOrFile(String str)Check if a string looks like a HTTP, HTTPS or file URI.
-
-
-
Method Detail
-
getContext
public static org.eclipse.rdf4j.model.Resource getContext(org.eclipse.rdf4j.repository.Repository repository, String ctxID)Get context IRI from string representation- Parameters:
repository- repositoryctxID- context as string- Returns:
- context IRI
-
getContexts
public static org.eclipse.rdf4j.model.Resource[] getContexts(String[] tokens, int pos, org.eclipse.rdf4j.repository.Repository repository) throws IllegalArgumentException
Get context IRIs from a series of tokens, starting from (zero-based) position within the series.- Parameters:
tokens- command as series of tokenspos- position to start fromrepository- repository- Returns:
- array of contexts or null for default context
- Throws:
IllegalArgumentException
-
getPath
@Deprecated public static Path getPath(String file)
Deprecated.Get path from file or URI- Parameters:
file- file name- Returns:
- path or null
-
isHttpOrFile
public static boolean isHttpOrFile(String str)
Check if a string looks like a HTTP, HTTPS or file URI.- Parameters:
str- string- Returns:
- true if
-
getNormalizedPath
public static Path getNormalizedPath(Path workDir, String file)
Get path from file string if it's absolute, or from working directory if the file is relative.- Parameters:
workDir- working dirfile- file name- Returns:
- path normalized path
-
getPrefixedValue
public static String getPrefixedValue(org.eclipse.rdf4j.model.Value value, Map<String,String> namespaces)
Get string representation for a value. If the value is an IRI and is part of a known namespace, the prefix will be used to shorten it.- Parameters:
value- valuenamespaces- mapping (uri,prefix)- Returns:
- string representation
-
formatToWidth
@Deprecated public static String formatToWidth(int width, String padding, String str, String separator)
Deprecated.Format a string of values, starting new line(s) when the joined values exceed the width. Primarily used for displaying formatted help (e.g namespaces, config files) to the console. To be replaced by a commons text method- Parameters:
width- maximum column widthpadding- left paddingstr- joined stringseparator- value separator- Returns:
- list of values as a formatted string, or empty
-
-