org.eclipse.rdf4j.repository.dataset

## Class DatasetRepository

- java.lang.Object
- - org.eclipse.rdf4j.repository.base.RepositoryWrapper
  - - org.eclipse.rdf4j.repository.dataset.DatasetRepository

- All Implemented Interfaces:
    DelegatingRepository, Repository

      public class DatasetRepository
      extends RepositoryWrapper

  A repository that automatically attempts to load the dataset supplied in a (SPARQL) query (using FROM and FROM NAMED clauses).
  Author:
    Arjohn Kampman, Jeen Broekstra

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `DatasetRepository()`
    `DatasetRepository(SailRepository delegate)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `RepositoryConnection` | `getConnection()` Opens a connection to this repository that can be used for querying and updating the contents of the repository.
    `SailRepository` | `getDelegate()`
    `void` | `loadDataset(URL url, IRI context, ParserConfig config)` Inspects if the dataset at the supplied URL location has been modified since the last load into this repository and if so loads it into the supplied context.
    `void` | `setDelegate(Repository delegate)`

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

      `getDataDir, getValueFactory, initialize, isInitialized, isWritable, setDataDir, shutDown, toString`

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

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

    - ### Methods inherited from interface org.eclipse.rdf4j.repository.Repository

      `init`

- - ### Constructor Detail

    - #### DatasetRepository

          public DatasetRepository()

    - #### DatasetRepository

          public DatasetRepository(SailRepository delegate)

  - ### Method Detail

    - #### setDelegate

          public void setDelegate(Repository delegate)

      Specified by:
        `setDelegate` in interface `DelegatingRepository`
      Overrides:
        `setDelegate` in class `RepositoryWrapper`

    - #### getDelegate

          public SailRepository getDelegate()

      Specified by:
        `getDelegate` in interface `DelegatingRepository`
      Overrides:
        `getDelegate` in class `RepositoryWrapper`

    - #### getConnection

          public RepositoryConnection 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.

    - #### loadDataset

          public void loadDataset(URL url,
                                  IRI context,
                                  ParserConfig config)
                           throws RepositoryException

      Inspects if the dataset at the supplied URL location has been modified since the last load into this repository and if so loads it into the supplied context.
      Parameters:
        `url` - the location of the dataset
        `context` - the context in which to load the dataset
        `config` - parser configuration to use for processing the dataset
      Throws:
        `RepositoryException` - if an error occurred while loading the dataset.

Copyright © 2015-2021 Eclipse Foundation. All Rights Reserved.