@Override protected DatasetGraphAccessor getDatasetUpdater() { return DatasetAccessorFactory.make(dsg) ; } }
/** * Create an accessor for a remote HTTP service * @param serviceURI Service URI * @return Accessor */ public static DatasetAccessor createHTTP(String serviceURI) { return adapt(new DatasetGraphAccessorHTTP(serviceURI)) ; }
/** * Method adds (NOT replaces) the ontModel to the server. * * @param ontModel is the ontModel, which should be added to the server. * @param url is the url of the ontology database server without suffix (server service form). * @throws IOException is thrown in case the the ontModel could not be uploaded (because e.g. no connection, server offline, ...). * @throws NotAvailableException is thrown in case the input is null. */ static void addModelToServer(final OntModel ontModel, final String url) throws IOException, NotAvailableException { if (ontModel == null) { assert false; throw new NotAvailableException("OntModel is null."); } try { DatasetAccessorFactory.createHTTP(url + OntConfig.ServerService.DATA.getName()).add(ontModel); } catch (Exception ex) { throw new IOException("Could not add model to ontology server!", ex); } }
/** * Method returns the ontology model from the ontology server. Consider correct url. Consider the possible big size of the ontology (and download time). * * @param url is the url of the ontology database server without suffix (server service form). * @return the ontModel from the server. * @throws IOException is thrown in case the ontModel could not downloaded (because e.g. no connection, server offline, ...). * @throws NotAvailableException is thrown in case the server does not contain an ontModel. */ static OntModel downloadModelFromServer(final String url) throws IOException, NotAvailableException { try { Model model = DatasetAccessorFactory.createHTTP(url + OntConfig.ServerService.DATA.getName()).getModel(); if (model.isEmpty()) { throw new NotAvailableException("The server contains no ontology!"); } return ModelFactory.createOntologyModel(OntModelSpec.OWL_DL_MEM, model); } catch (NullPointerException | NotAvailableException ex) { throw new NotAvailableException("The server contains no ontology!"); } catch (Exception ex) { throw new IOException(ex); } }
@Override protected DatasetGraphAccessor getDatasetUpdater() { return DatasetAccessorFactory.make(dsg) ; } }
/** * Copies a dataset to a remote service that provides SPARQL 1.1 Graph Store * protocol support * * @param source * Source Dataset * @param service * Remote Graph Store protocol service * @param authenticator * HTTP Authenticator */ public static void copyToRemoteDataset(Dataset source, String service, HttpClient client) { DatasetAccessor target = DatasetAccessorFactory.createHTTP(service, client); target.putModel(source.getDefaultModel()); Iterator<String> uris = source.listNames(); while (uris.hasNext()) { String uri = uris.next(); target.putModel(uri, source.getNamedModel(uri)); } }
/** * Create an accessor for a remote HTTP service that requires a custom client (e.g. for authentication) * @param serviceURI Service URI * @param client HTTP client * @return Accessor */ public static DatasetAccessor createHTTP(String serviceURI, HttpClient client) { return adapt(new DatasetGraphAccessorHTTP(serviceURI, client)); }
@Override protected DatasetGraphAccessor getDatasetUpdater() { DatasetGraph dsg = TDBFactory.createDatasetGraph() ; return DatasetAccessorFactory.make(dsg) ; } }
/** * Create an accessor for a local dataset * @param dataset Dataset * @return Accessor */ public static DatasetAccessor create(DatasetGraph dataset) { return adapt(new DatasetGraphAccessorBasic(dataset)) ; }
@Override protected DatasetGraphAccessor getDatasetUpdater() { DatasetGraph dsg = DatasetGraphFactory.create() ; return DatasetAccessorFactory.make(dsg) ; } }
/** * Create an accessor for a local dataset * @param dataset Dataset * @return Accessor */ public static DatasetAccessor create(Dataset dataset) { return adapt(new DatasetGraphAccessorBasic(dataset.asDatasetGraph())) ; }
@Override protected DatasetGraphAccessor getDatasetUpdater() { DatasetGraph dsg = TDBFactory.createDatasetGraph() ; return DatasetAccessorFactory.make(dsg) ; } }