java.lang.Object
org.apache.jena.sparql.util.Context
A class for setting and keeping named values. Used to pass
implementation-specific parameters across general interfaces.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
clear()
copy()
Return a copy of this context.static Context
create()
Create an empty contextstatic final Context
Empty, immutable contextboolean
static Context
fromDataset
(DatasetGraph dataset) Return the context of the dataset (not copied); if the dataset is null, return null<T> T
Get the object value of a property or null<T> T
Get the object value of a property - return the default value if not present .getAsString
(Symbol property) Get the value a string (uses .toString() if the value is not null)getAsString
(Symbol property, String defaultValue) Get the value a string (uses .toString() if the value is not null) - supply a default string valueint
Get the value as a long value.long
Get the value as a long value.getTrueOrFalse
(Symbol property) Is the value true or false, either as a Boolean or a string.int
hashCode()
boolean
Test whether a named value is a specific value (.equals)boolean
hasValueAsString
(Symbol property, String value) Test whether a named value (as a string) has a specific string formboolean
hasValueAsString
(Symbol property, String value, boolean ignoreCase) Test whether a named value (as a string) has a specific string form - can ignore caseboolean
Is a property set?boolean
Is the value 'false' (either set to the string "false" or Boolean.FALSE)boolean
isFalseOrUndef
(Symbol property) Is the value 'false' (either set to the string "false" or Boolean.FALSE) or undefinedboolean
Is the value 'true' (either set to the string "true" or Boolean.TRUE)boolean
isTrueOrUndef
(Symbol property) Is the value 'true' (either set to the string "true" or Boolean.TRUE) or undefined?boolean
Is a property not set?keys()
Set of properties (as Symbols) currently definedstatic Context
Merge an outer (defaults to the system global context) and local context to produce a new context The new context is always a separate copy.void
Store a named value - overwrites any previous set value.void
void
Remove any value associated with a propertyStore a named value - overwrites any previous set value.Store a named value - overwrites any previous set value.static void
setCurrentDateTime
(Context context) Set property value to be false.setIfUndef
(Symbol property, Object value) Store a named value only if it is not currently set.Set property value to be true.static Context
setupContextForDataset
(Context globalContext, DatasetGraph dataset) Setup a context using another context and a dataset.int
size()
Return the number of context itemstoString()
Remove any value associated with a property.
-
Constructor Details
-
Context
public Context()Create an empty context
-
-
Method Details
-
emptyContext
Empty, immutable context -
create
Create an empty context -
copy
Return a copy of this context. Modifications of the copy do not affect the original context. -
get
Get the object value of a property or null -
get
Get the object value of a property - return the default value if not present . -
put
Store a named value - overwrites any previous set value. -
set
Store a named value - overwrites any previous set value. Returns "this". -
set
Store a named value - overwrites any previous set value. Returns "this". -
setIfUndef
Store a named value only if it is not currently set. Returns "this". -
setTrue
Set property value to be true. Returns "this". -
setFalse
Set property value to be false. Returns "this". -
setAll
-
putAll
-
remove
Remove any value associated with a property -
unset
Remove any value associated with a property. Returns "this". -
isDefined
Is a property set? -
isUndef
Is a property not set? -
getAsString
Get the value a string (uses .toString() if the value is not null) - supply a default string value -
getAsString
Get the value a string (uses .toString() if the value is not null) -
getInt
Get the value as a long value. The context entry can be a string, Integer or Long. -
getLong
Get the value as a long value. The context entry can be a string, Integer or Long. -
isTrue
Is the value 'true' (either set to the string "true" or Boolean.TRUE) -
isTrueOrUndef
Is the value 'true' (either set to the string "true" or Boolean.TRUE) or undefined? -
isFalse
Is the value 'false' (either set to the string "false" or Boolean.FALSE) -
isFalseOrUndef
Is the value 'false' (either set to the string "false" or Boolean.FALSE) or undefined -
getTrueOrFalse
Is the value true or false, either as a Boolean or a string. If undefined, return null. Exception if not a boolean or a string. -
hasValue
Test whether a named value is a specific value (.equals) -
hasValueAsString
Test whether a named value (as a string) has a specific string form -
hasValueAsString
Test whether a named value (as a string) has a specific string form - can ignore case -
keys
Set of properties (as Symbols) currently defined -
size
public int size()Return the number of context items -
clear
public void clear() -
toString
-
fromDataset
Return the context of the dataset (not copied); if the dataset is null, return null -
setupContextForDataset
Setup a context using another context and a dataset. -
setCurrentDateTime
-
mergeCopy
Merge an outer (defaults to the system global context) and local context to produce a new context The new context is always a separate copy. -
hashCode
public int hashCode() -
equals
-