Package org.eclipse.rdf4j.repository.contextaware

## Class ContextAwareRepository

- java.lang.Object
- - org.eclipse.rdf4j.repository.base.RepositoryWrapper
  - - org.eclipse.rdf4j.repository.contextaware.ContextAwareRepository

- All Implemented Interfaces:
    `DelegatingRepository`, `Repository`

      public class ContextAwareRepository
      extends RepositoryWrapper

  Allows contexts to be specified at the repository level.
  Author:
    James Leigh

- - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `ContextAwareRepository()` |
    `ContextAwareRepository​(Repository delegate)` |

  - ### Method Summary

    All Methods Instance Methods Concrete Methods Deprecated Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `IRI[]` | `getAddContexts()` | Deprecated.
    `IRI[]` | `getArchiveContexts()` | Deprecated.
    `String` | `getBaseURI()` |
    `ContextAwareConnection` | `getConnection()` | Opens a connection to this repository that can be used for querying and updating the contents of the repository.
    `IRI` | `getInsertContext()` |
    `int` | `getMaxQueryTime()` |
    `QueryLanguage` | `getQueryLanguage()` |
    `IRI[]` | `getReadContexts()` |
    `IRI[]` | `getRemoveContexts()` |
    `boolean` | `isIncludeInferred()` |
    `void` | `setAddContexts​(IRI... addContexts)` | Deprecated.
    `void` | `setArchiveContexts​(IRI... archiveContexts)` | Deprecated.
    `void` | `setBaseURI​(String baseURI)` |
    `void` | `setIncludeInferred​(boolean includeInferred)` |
    `void` | `setInsertContext​(IRI insertContext)` |
    `void` | `setMaxQueryTime​(int maxQueryTime)` |
    `void` | `setQueryLanguage​(QueryLanguage ql)` |
    `void` | `setReadContexts​(IRI... readContexts)` |
    `void` | `setRemoveContexts​(IRI... removeContexts)` |

    - ### Methods inherited from class org.eclipse.rdf4j.repository.base.RepositoryWrapper

      `getDataDir, getDelegate, getValueFactory, init, isInitialized, isWritable, setDataDir, setDelegate, shutDown, toString`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Constructor Detail

    - #### ContextAwareRepository

          public ContextAwareRepository()

    - #### ContextAwareRepository

          public ContextAwareRepository​(Repository delegate)

  - ### Method Detail

    - #### getMaxQueryTime

          public int getMaxQueryTime()

    - #### setMaxQueryTime

          public void setMaxQueryTime​(int maxQueryTime)

    - #### getAddContexts

          @Deprecated
          public IRI[] getAddContexts()

      Deprecated.
      See Also:
        `ContextAwareConnection.getAddContexts()`

    - #### getArchiveContexts

          @Deprecated
          public IRI[] getArchiveContexts()

      Deprecated.
      See Also:
        `ContextAwareConnection.getArchiveContexts()`

    - #### getInsertContext

          public IRI getInsertContext()

      See Also:
        `ContextAwareConnection.getInsertContext()`

    - #### getQueryLanguage

          public QueryLanguage getQueryLanguage()

      See Also:
        `ContextAwareConnection.getQueryLanguage()`

    - #### getBaseURI

          public String getBaseURI()

      Returns:
        Returns the default baseURI.

    - #### getReadContexts

          public IRI[] getReadContexts()

      See Also:
        `ContextAwareConnection.getReadContexts()`

    - #### getRemoveContexts

          public IRI[] getRemoveContexts()

      See Also:
        `ContextAwareConnection.getRemoveContexts()`

    - #### isIncludeInferred

          public boolean isIncludeInferred()

      See Also:
        `ContextAwareConnection.isIncludeInferred()`

    - #### setAddContexts

          @Deprecated
          public void setAddContexts​(IRI... addContexts)

      Deprecated.
      See Also:
        `ContextAwareConnection.setAddContexts(IRI[])`

    - #### setArchiveContexts

          @Deprecated
          public void setArchiveContexts​(IRI... archiveContexts)

      Deprecated.
      See Also:
        `ContextAwareConnection.setArchiveContexts(IRI[])`

    - #### setInsertContext

          public void setInsertContext​(IRI insertContext)

      See Also:
        `ContextAwareConnection.setInsertContext(IRI)`

    - #### setIncludeInferred

          public void setIncludeInferred​(boolean includeInferred)

      See Also:
        `ContextAwareConnection.setIncludeInferred(boolean)`

    - #### setQueryLanguage

          public void setQueryLanguage​(QueryLanguage ql)

      See Also:
        `ContextAwareConnection.setQueryLanguage(QueryLanguage)`

    - #### setBaseURI

          public void setBaseURI​(String baseURI)

      Parameters:
        `baseURI` - The default baseURI to set.

    - #### setReadContexts

          public void setReadContexts​(IRI... readContexts)

      See Also:
        `ContextAwareConnection.setReadContexts(IRI[])`

    - #### setRemoveContexts

          public void setRemoveContexts​(IRI... removeContexts)

      See Also:
        `ContextAwareConnection.setRemoveContexts(IRI[])`

    - #### getConnection

          public ContextAwareConnection getConnection()
                                               throws RepositoryException

      Description copied from interface: `Repository`
      Opens a connection to this repository that can be used for querying and updating the contents of the repository. Created connections need to be closed to make sure that any resources they keep hold of are released. The best way to do this is to use a try-with-resources block, as follows:

           try (RepositoryConnection conn = repository.getConnection()) {
                  // perform operations on the connection
           }

      Note that `RepositoryConnection` is not guaranteed to be thread-safe! The recommended pattern for repository access in a multi-threaded application is to share the Repository object between threads, but have each thread create and use its own `RepositoryConnection`s.
      Specified by:
        `getConnection` in interface `Repository`
      Overrides:
        `getConnection` in class `RepositoryWrapper`
      Returns:
        A connection that allows operations on this repository.
      Throws:
        `RepositoryException` - If something went wrong during the creation of the Connection.