/** Wrap an existing DatasetGraph */ public static Dataset wrap(DatasetGraph datasetGraph) { return new DatasetImpl(datasetGraph) ; }
/** * Create a dataset, starting with the model argument as the default graph of the * dataset. Named graphs can be added. * <p> * Use {@link #wrap(Model)} to put dataset functionality around a single * model when named graphs will not be added. * * @param model The model for the default graph * @return a dataset with the given model as the default graph */ public static Dataset create(Model model) { Objects.requireNonNull(model, "Default model must be provided") ; return new DatasetImpl(model); }
/** * @param dataset Dataset to clone structure from. * @return a dataset: clone the dataset structure of named graphs, and share the graphs themselves. * @deprecated This operation may be removed. */ @Deprecated public static Dataset create(Dataset dataset) { Objects.requireNonNull(dataset, "Clone dataset is null") ; return new DatasetImpl(dataset); }
/** * Specifies a Dataset that shall be used for query execution. * Returns a new DatasetImpl by default but may be overloaded in subclasses. * For example, TopBraid delegates this to the currently open Graphs. * @param defaultModel the default Model of the Dataset * @return the Dataset */ public Dataset getDataset(Model defaultModel) { if(defaultModel != null) { return new DatasetImpl(defaultModel); } else { return new DatasetImpl(JenaUtil.createMemoryModel()); } }
/** * Specifies a Dataset that shall be used for query execution. * Returns a new DatasetImpl by default but may be overloaded in subclasses. * For example, TopBraid delegates this to the currently open Graphs. * @param defaultModel the default Model of the Dataset * @return the Dataset */ public Dataset getDataset(Model defaultModel) { if(defaultModel != null) { return new DatasetImpl(defaultModel); } else { return new DatasetImpl(JenaUtil.createMemoryModel()); } }
/** * Creates quality metadata * * @return Dataset with quality metadata which needs to be attached to the assessed dataset. * @throws MetadataException if there is no observation data calculated. */ public Dataset createQualityMetadata() throws MetadataException{ Model defaultModel = ModelFactory.createDefaultModel(); Dataset dataset = null; if (this.metadata.size() == 0) throw new MetadataException("No Metric Observations Recorded"); defaultModel.add(qualityGraph, RDF.type, DAQ.QualityGraph); defaultModel.add(qualityGraph, CUBE.structure, DAQ.dsd); dataset = new DatasetImpl(defaultModel); dataset.addNamedModel(this.qualityGraph.getURI(), this.metadata); return dataset; }