External join.This example shows how to use external joins between graphs. Its source code is under the samples/java
directory.
import java.io.FileInputStream;
import java.util.Collection;
import java.util.Vector;
public class JavaExternalJoin
{
public static void run(String prefix) throws Exception
{
environment.
setIOConfig(IOHandler.ConfigPropertyBool.KEEPGRAPHOBJECTIDENTIFIERS,
true);
environment.loadSupport(new FileInputStream(prefix + "/bcgct/sisyphus/sisyphus.bcs"), IOHandler.Format.BCGCT);
Collection<EnvironmentObject> loadedgraphs = environment.loadObjects(new FileInputStream(prefix + "/bcgct/sisyphus/query_noanswer.bcg"), IOHandler.Format.BCGCT);
Graph g1 = loadedgraphs.iterator().next().asGraph();
loadedgraphs = environment.loadObjects(new FileInputStream(prefix + "/bcgct/sisyphus/query.bcg"), IOHandler.Format.BCGCT);
Graph g2 = loadedgraphs.iterator().next().asGraph();
GraphObject cg1 = g1.findByIdentifier("c1");
System.out.println(cg1);
GraphObject cg2 = g2.findByIdentifier("c17");
System.out.println(cg2);
environment.graphExternalJoin(g1, cg1, g2, cg2);
Vector<EnvironmentObject> vout = new Vector<EnvironmentObject>();
vout.add(g1);
System.out.println(environment.saveObjectsString(vout, IOHandler.Format.BCGCT));
}
public static void main(String args[]) throws Exception
{
String prefix = "..";
if (args.length == 1)
prefix = args[0];
System.out.println("prefix: " + prefix);
run(prefix);
}
}