AGSNACliques.java
package com.franz.ag.examples;
import com.franz.ag.*;
public class AGSNACliques {
@param
@throws
public static void main(String[] args) throws AllegroGraphException {
AllegroGraphConnection ags = new AllegroGraphConnection();
try {
ags.enable();
} catch (Exception e) {
throw new AllegroGraphException("Server connection problem", e);
}
AllegroGraph ts = ags.renew("snacliques", AGPaths.TRIPLE_STORES);
ts.registerNamespace("ex", "http://example.org/");
AGUtils.loadNTriplesWithTiming(ts, AGPaths.dataSources("sna-cycle.nt"));
SNAExtension sna = ts.getSNAExtension();
Object[] parts = new Object[2];
parts[0] = "objects-of";
parts[1] = "!ex:to";
sna.registerGenerator("to", parts);
String[] group = {"!ex:a","!ex:b","!ex:c","!ex:d","!ex:e","!ex:f","!ex:g","!ex:h"};
for (int i=0;i<group.length;i++) {
UPI[][] cliques = sna.getCliques(group[i], "to", 2);
System.out.println("There are " + cliques.length + " cliques involving " + group[i]);
}
ts.closeTripleStore();
ags.disable();
}
}
Up |
Next