Quick links: Examples - Files.
Classes: Hierarchy - Index - List - Members.
Packages: Index - base - jni.

JavaExternalJoin.java

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
{
// Load support and graphs
Environment environment = new cogitant.jni.Environment();
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();
// A simple external join
GraphObject cg1 = g1.findByIdentifier("c1");
System.out.println(cg1);
GraphObject cg2 = g2.findByIdentifier("c17");
System.out.println(cg2);
environment.graphExternalJoin(g1, cg1, g2, cg2);
// Print result
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);
}
}