Class 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 graphs
      static 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
    • 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)
        Return whether or not the resource represents the meta-context ALL or LOCAL
      • isAllOrLocal

        public static boolean isAllOrLocal​(java.util.Collection<? extends Resource> theContexts)
        Return whether or not the collection contains the meta-contexts ALL or LOCAL
      • isAll

        public static boolean isAll​(Resource theContext)
        Return whether or not the resource represents the meta-context ALL
      • isLocal

        public static boolean isLocal​(Resource theContext)
        Return whether or not the resource represents the meta-context LOCAL
      • isNamed

        public static boolean isNamed​(Resource theContext)
        Return whether or not the resource represents the meta-context NAMED
        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-context VIRTUAL. So named to distinguish from the test 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 the DEFAULT 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 the DEFAULT 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)
        Returns true if the given context is one of the following "wildcard" (special) graph names: ALL, LOCAL, NAMED, VIRTUAL
      • 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 the virtual:// prefix).