@@ -0,0 +1,2006 @@
+/*******************************************************************************%0A * Copyright (c) 2020 Eclipse RDF4J contributors.%0A * All rights reserved. This program and the accompanying materials%0A * are made available under the terms of the Eclipse Distribution License v1.0%0A * which accompanies this distribution, and is available at%0A * http://www.eclipse.org/org/documents/edl-v10.php.%0A *******************************************************************************/%0Apackage demos;%0A%0Aimport org.eclipse.rdf4j.federated.FedXFactory;%0Aimport org.eclipse.rdf4j.model.Statement;%0Aimport org.eclipse.rdf4j.model.vocabulary.FOAF;%0Aimport org.eclipse.rdf4j.model.vocabulary.RDF;%0Aimport org.eclipse.rdf4j.repository.Repository;%0Aimport org.eclipse.rdf4j.repository.RepositoryConnection;%0Aimport org.eclipse.rdf4j.repository.RepositoryResult;%0Aimport org.eclipse.rdf4j.repository.manager.RemoteRepositoryManager;%0Aimport org.eclipse.rdf4j.repository.manager.RepositoryManager;%0A%0A/**%0A * Demo which shows an example of a local federation which uses repositories from a remote RDF4J instance as federation%0A * members.%0A * %0A * @author Andreas Schwarte%0A *%0A */%0Apublic class FedXWithRemoteRepositoryManager %7B%0A%0A%09public static void main(String%5B%5D args) throws Exception %7B%0A%0A%09%09// connection URL of a RDF4J server which manages the repositories%0A%09%09String serverUrl = %22http://localhost:8080/rdf4j-server%22;%0A%09%09RepositoryManager repoManager = new RemoteRepositoryManager(serverUrl);%0A%0A%09%09// assumes that remote repositories exist%0A%09%09Repository localRepo = FedXFactory.newFederation()%0A%09%09%09%09.withRepositoryResolver(repoManager)%0A%09%09%09%09.withResolvableEndpoint(%22my-repository-1%22)%0A%09%09%09%09.withResolvableEndpoint(%22my-repository-2%22)%0A%09%09%09%09.create();%0A%0A%09%09localRepo.init();%0A%0A%09%09try (RepositoryConnection conn = localRepo.getConnection()) %7B%0A%09%09%09try (RepositoryResult%3CStatement%3E repoResult = conn.getStatements(null, RDF.TYPE, FOAF.PERSON)) %7B%0A%09%09%09%09repoResult.forEach(st -%3E System.out.println(st));%0A%09%09%09%7D%0A%09%09%7D%0A%0A%09%09localRepo.shutDown();%0A%09%09repoManager.shutDown();%0A%09%7D%0A%0A%7D%0A

add example on how to use FedX with RemoteRepositoryManager