I/O and projection.This example shows how to use the projection operation. Its source code is under the samples/java
directory.
import java.io.FileInputStream;
public class JavaProjection
{
public static void run(String prefix) throws Exception
{
environment.
setIOConfig(IOHandler.ConfigPropertyBool.KEEPGRAPHOBJECTIDENTIFIERS,
true);
environment.loadSupport(new FileInputStream(prefix + "/xml/bucolic/bucolic_id.cogxml"), IOHandler.Format.COGXML);
environment.loadObjects(new FileInputStream(prefix + "/xml/bucolic/fact_coref.cogxml"), IOHandler.Format.COGXML);
environment.loadObjects(new FileInputStream(prefix + "/xml/bucolic/query.cogxml"), IOHandler.Format.COGXML);
Graph g = environment.findGraph("query");
Graph h = environment.findGraph("fact_coref");
System.out.println(environment.projectionHas(g, h));
System.out.println(environment.projectionNum(g, h));
System.out.println(environment.projectionFind(g, h));
Projection partialproj = environment.newProjection(g,h);
partialproj.newCouple(g.findByIdentifier("cn12"), h.findByIdentifier("cn15"));
environment.projectionConfig().setInitialProjection(partialproj);
System.out.println(environment.projectionFind(g, h));
environment.projectionConfig().setInitialProjection(null);
}
public static void main(String args[]) throws Exception
{
String prefix = "..";
if (args.length == 1)
prefix = args[0];
System.out.println("prefix: " + prefix);
run(prefix);
}
}