Package com.complexible.stardog
Class Contexts
- java.lang.Object
-
- com.complexible.stardog.Contexts
-
public final class Contexts extends java.lang.Object
Defines constants that represent special URIs for contexts (named graphs).- Since:
- 0.9
- Version:
- 6.0
- Author:
- Evren Sirin, Michael Grove
-
-
Field Summary
Fields Modifier and Type Field Description static IRI
ALL
Special URI representing all local and virtual graphsstatic IRI
DEFAULT
Special URI representing the default (no) context in Stardog.static IRI
LOCAL
Special URI representing all contexts in Stardog, including the default (no) context graph.static IRI
NAMED
Special URI representing all local named graphs in Stardog, excluding the default graph.static IRI
VIRTUAL
Special URI representing all virtual graphs
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static Resource
defaultToNull(Resource theResource)
Takes a Resource identifying a named graph, and if it is the constant for theDEFAULT
graph, it will return null, otherwise it returns the parameter as-is.static boolean
isAll(Resource theContext)
Return whether or not the resource represents the meta-contextALL
static boolean
isAllOrLocal(Resource theContext)
static boolean
isAllOrLocal(java.util.Collection<? extends Resource> theContexts)
static <T extends Value>
java.util.function.Predicate<T>isDefaultGraph()
static boolean
isDefaultGraphOrWildcard(Resource theContext)
static boolean
isLocal(Resource theContext)
Return whether or not the resource represents the meta-contextLOCAL
static boolean
isNamed(Resource theContext)
Return whether or not the resource represents the meta-contextNAMED
static boolean
isSingleton(java.util.Set<Resource> theContexts)
Returns true if the set of contexts is a singletonstatic boolean
isVirtualOrVirtualWildcard(Resource g)
Tests whether the supplied graph name is either the virtual wildcard (VIRTUAL
) or any particular virtual graph IRI (one beginning with thevirtual://
prefix).static boolean
isVirtualWildcard(Resource theContext)
Return whether or not the resource represents the meta-contextVIRTUAL
.static boolean
isWildcard(Resource theContext)
static Resource
nullToDefault(Resource theResource)
Takes a Resource identifying a named graph, and if it is null, returns the constant for theDEFAULT
graph.
-
-
-
Field Detail
-
DEFAULT
public static final IRI DEFAULT
Special URI representing the default (no) context in Stardog.
-
LOCAL
public static final IRI LOCAL
Special URI representing all contexts in Stardog, including the default (no) context graph.
-
NAMED
public static final IRI NAMED
Special URI representing all local named graphs in Stardog, excluding the default graph.
-
VIRTUAL
public static final IRI VIRTUAL
Special URI representing all virtual graphs
-
ALL
public static final IRI ALL
Special URI representing all local and virtual graphs
-
-
Method Detail
-
isAllOrLocal
public static boolean isAllOrLocal(Resource theContext)
-
isAllOrLocal
public static boolean isAllOrLocal(java.util.Collection<? extends Resource> theContexts)
-
isAll
public static boolean isAll(Resource theContext)
Return whether or not the resource represents the meta-contextALL
-
isLocal
public static boolean isLocal(Resource theContext)
Return whether or not the resource represents the meta-contextLOCAL
-
isNamed
public static boolean isNamed(Resource theContext)
Return whether or not the resource represents the meta-contextNAMED
- Parameters:
theContext
- the context- Returns:
- true if its
NAMED
, false otherwise
-
isVirtualWildcard
public static boolean isVirtualWildcard(Resource theContext)
Return whether or not the resource represents the meta-contextVIRTUAL
. So named to distinguish from thetest for virtual prefix
.
-
nullToDefault
public static Resource nullToDefault(Resource theResource)
Takes a Resource identifying a named graph, and if it is null, returns the constant for theDEFAULT
graph. Otherwise, returns the parameter as-is.- Parameters:
theResource
- the named graph- Returns:
- the named graph,
DEFAULT
if the parameter is null.
-
defaultToNull
public static Resource defaultToNull(Resource theResource)
Takes a Resource identifying a named graph, and if it is the constant for theDEFAULT
graph, it will return null, otherwise it returns the parameter as-is.- Parameters:
theResource
- the named graph- Returns:
- the named graph; null if it was the default graph
-
isDefaultGraph
public static <T extends Value> java.util.function.Predicate<T> isDefaultGraph()
-
isWildcard
public static boolean isWildcard(Resource theContext)
-
isDefaultGraphOrWildcard
public static boolean isDefaultGraphOrWildcard(Resource theContext)
-
isSingleton
public static boolean isSingleton(java.util.Set<Resource> theContexts)
Returns true if the set of contexts is a singleton- Parameters:
theContexts
-- Returns:
-
isVirtualOrVirtualWildcard
public static boolean isVirtualOrVirtualWildcard(Resource g)
Tests whether the supplied graph name is either the virtual wildcard (VIRTUAL
) or any particular virtual graph IRI (one beginning with thevirtual://
prefix).
-
-