Class DatasetFactory


  • public class DatasetFactory
    extends java.lang.Object
    Makes Datasets in various ways.
    • Constructor Summary

      Constructors 
      Constructor Description
      DatasetFactory()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static Dataset assemble​(java.lang.String filename)
      Assemble a dataset from the model in a file
      static Dataset assemble​(java.lang.String filename, java.lang.String resourceURI)
      Assemble a dataset from the model in a file
      static Dataset assemble​(Model model)
      Assemble a dataset from the model
      static Dataset assemble​(Resource resource)
      Assemble a dataset from a resource
      static Dataset create()
      Create an in-memory Dataset.
      static Dataset create​(java.lang.String uri)  
      static Dataset create​(java.lang.String uri, java.util.List<java.lang.String> namedSourceList)
      Create a dataset container based on two list of URIs.
      static Dataset create​(java.lang.String uri, java.util.List<java.lang.String> namedSourceList, java.lang.String baseURI)
      Create a named graph container based on two list of URIs.
      static Dataset create​(java.util.List<java.lang.String> uriList)  
      static Dataset create​(java.util.List<java.lang.String> uriList, java.util.List<java.lang.String> namedSourceList)
      Create a dataset based on two list of URIs.
      static Dataset create​(java.util.List<java.lang.String> uriList, java.util.List<java.lang.String> namedSourceList, java.lang.String baseURI)
      Create a named graph container based on two list of URIs.
      static Dataset create​(Model model)
      Create a dataset, starting with the model argument as the default graph of the dataset.
      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).
      static Dataset createNamed​(java.util.List<java.lang.String> namedSourceList)  
      static Dataset createTxnMem()
      Create an in-memory.
      static Dataset wrap​(Model model)
      Wrap a Model to make a dataset; the model is the default graph of the RDF Dataset.
      static Dataset wrap​(DatasetGraph dataset)
      Wrap a DatasetGraph to make a dataset
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • DatasetFactory

        public DatasetFactory()
    • Method Detail

      • 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
      • create

        public static Dataset create​(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​(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
      • create

        public static Dataset create​(java.util.List<java.lang.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​(java.lang.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​(java.util.List<java.lang.String> namedSourceList)
        Parameters:
        namedSourceList -
        Returns:
        a named graph container of graphs based on a list of URIs.
      • create

        public static Dataset create​(java.util.List<java.lang.String> uriList,
                                     java.util.List<java.lang.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​(java.lang.String uri,
                                     java.util.List<java.lang.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​(java.lang.String uri,
                                     java.util.List<java.lang.String> namedSourceList,
                                     java.lang.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​(java.util.List<java.lang.String> uriList,
                                     java.util.List<java.lang.String> namedSourceList,
                                     java.lang.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​(java.lang.String filename)
        Assemble a dataset from the model in a file
        Parameters:
        filename - The filename
        Returns:
        Dataset
      • assemble

        public static Dataset assemble​(java.lang.String filename,
                                       java.lang.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​(Model model)
        Assemble a dataset from the model
        Parameters:
        model -
        Returns:
        Dataset
      • assemble

        public static Dataset assemble​(Resource resource)
        Assemble a dataset from a resource
        Parameters:
        resource - The resource for the dataset
        Returns:
        Dataset