Class DatasetFactory

java.lang.Object
org.apache.jena.query.DatasetFactory

public class DatasetFactory extends Object
Makes Datasets in various ways.
  • Constructor Details

    • DatasetFactory

      public DatasetFactory()
  • Method Details

    • create

      public static Dataset create()
      Create an in-memory Dataset.

      See also createTxnMem() for a transactional dataset.

      This implementation copies models when Dataset.addNamedModel(String, Model) is called.

      This implementation does not support serialized transactions (it only provides MRSW locking).

      See Also:
    • createTxnMem

      public static Dataset createTxnMem()
      Create an in-memory. transactional Dataset.

      This fully supports transactions, including abort to roll-back changes. It provides "autocommit" if operations are performed outside a transaction but with a performance impact (the implementation adds a begin/commit around each add or delete so overheads can accumulate).

      Returns:
      a transactional, in-memory, modifiable Dataset
    • createGeneral

      public static Dataset createGeneral()
      Create a general-purpose Dataset.
      Any graphs needed are in-memory unless explicitly added with Dataset.addNamedModel(java.lang.String, org.apache.jena.rdf.model.Model).

      This dataset type can contain graphs from any source when added via Dataset.addNamedModel(java.lang.String, org.apache.jena.rdf.model.Model). These are held as links to the supplied graph and not copied.

      This dataset does not support the graph indexing feature of jena-text.

      This dataset does not support serialized transactions (it only provides MRSW locking).

      Returns:
      a general-purpose Dataset
      See Also:
    • create

      public static Dataset create(org.apache.jena.rdf.model.Model model)
      Create a dataset, starting with the model argument as the default graph of the dataset. Named graphs can be added.

      Use wrap(Model) to put dataset functionality around a single model when named graphs will not be added.

      Parameters:
      model - The model for the default graph
      Returns:
      a dataset with the given model as the default graph
    • wrap

      public static Dataset wrap(DatasetGraph dataset)
      Wrap a DatasetGraph to make a dataset
      Parameters:
      dataset - DatasetGraph
      Returns:
      Dataset
    • wrap

      public static Dataset wrap(org.apache.jena.rdf.model.Model model)
      Wrap a Model to make a dataset; the model is the default graph of the RDF Dataset. This dataset can not have additional models added to it, including indirectly through SPARQL Update adding new graphs.
      Parameters:
      model -
      Returns:
      Dataset
    • empty

      public static Dataset empty()
      An always empty Dataset. It has one graph (the default graph) with zero triples. No changes allowed - this is not a sink.
    • create

      public static Dataset create(List<String> uriList)
      Parameters:
      uriList - URIs merged to form the default dataset
      Returns:
      a dataset based on a list of URIs : these are merged into the default graph of the dataset.
    • create

      public static Dataset create(String uri)
      Parameters:
      uri - URIs merged to form the default dataset
      Returns:
      a dataset with a default graph and no named graphs
    • createNamed

      public static Dataset createNamed(List<String> namedSourceList)
      Parameters:
      namedSourceList -
      Returns:
      a named graph container of graphs based on a list of URIs.
    • create

      public static Dataset create(List<String> uriList, List<String> namedSourceList)
      Create a dataset based on two list of URIs. The first lists is used to create the background (unnamed graph) by merging, the second is used to create the collection of named graphs. (Jena calls graphs "Models" and triples "Statements")
      Parameters:
      uriList - graphs to be loaded into the unnamed, default graph
      namedSourceList - graphs to be attached as named graphs
      Returns:
      Dataset
    • create

      public static Dataset create(String uri, List<String> namedSourceList)
      Create a dataset container based on two list of URIs. The first is used to create the background (unnamed graph), the second is used to create the collection of named graphs. (Jena calls graphs "Models" and triples "Statements")
      Parameters:
      uri - graph to be loaded into the unnamed, default graph
      namedSourceList - graphs to be attached as named graphs
      Returns:
      Dataset
    • create

      public static Dataset create(String uri, List<String> namedSourceList, String baseURI)
      Create a named graph container based on two list of URIs. The first is used to create the background (unnamed graph), the second is used to create the collection of named graphs. (Jena calls graphs "Models" and triples "Statements")
      Parameters:
      uri - graph to be loaded into the unnamed, default graph
      namedSourceList - graphs to be attached as named graphs
      baseURI - baseURI for relative URI expansion
      Returns:
      Dataset
    • create

      public static Dataset create(List<String> uriList, List<String> namedSourceList, String baseURI)
      Create a named graph container based on two list of URIs. The first is used to create the background (unnamed graph), the second is used to create the collection of named graphs. (Jena calls graphs "Models" and triples "Statements")
      Parameters:
      uriList - graphs to be loaded into the unnamed, default graph
      namedSourceList - graphs to be attached as named graphs
      baseURI - baseURI for relative URI expansion
      Returns:
      Dataset
    • assemble

      public static Dataset assemble(String filename)
      Assemble a dataset from the model in a file
      Parameters:
      filename - The filename
      Returns:
      Dataset
    • assemble

      public static Dataset assemble(String filename, String resourceURI)
      Assemble a dataset from the model in a file
      Parameters:
      filename - The filename
      resourceURI - URI for the dataset to assembler
      Returns:
      Dataset
    • assemble

      public static Dataset assemble(org.apache.jena.rdf.model.Model model, String resourceURI)
      Assemble a dataset from a specific resource in a model.
      Parameters:
      model - The Model
      resourceURI - The URI for the the dataset in the assembler model.
      Returns:
      Dataset
    • assemble

      public static Dataset assemble(org.apache.jena.rdf.model.Model model, org.apache.jena.rdf.model.Resource resource)
      Assemble a dataset from a specific resource in a model.
      Parameters:
      model - The Model
      resource - The resource for the the dataset in the assembler model.
      Returns:
      Dataset
    • assemble

      public static Dataset assemble(org.apache.jena.rdf.model.Model model)
      Assemble a dataset from the model. There must be only one dataset description in the model; this function looks for the rdf:type. Use assemble(Model, String) or assemble(Model, Resource) to select a particular resource in the model.
      Parameters:
      model -
      Returns:
      Dataset
    • assemble

      public static Dataset assemble(org.apache.jena.rdf.model.Resource resource)
      Assemble a dataset from a resource
      Parameters:
      resource - The resource for the dataset
      Returns:
      Dataset