AGReasoningTransitiveProperty.java
package com.franz.ag.examples;
import com.franz.ag.*;
public class AGReasoningTransitiveProperty {
@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("transitiveproperty", AGPaths.TRIPLE_STORES);
ts.registerNamespace("ex","http://example.org/");
ts.addStatement("!ex:a","!ex:p", "!ex:b");
ts.addStatement("!ex:b","!ex:p", "!ex:c");
ts.addStatement("!ex:c","!ex:p", "!ex:d");
ts.addStatement("!ex:p","!rdf:type", "!owl:TransitiveProperty");
Cursor cc = ts.getStatements(false,"!ex:a","!ex:p",null);
System.out.println("Ground triples in the store:");
AGUtils.showTriples(cc);
cc = ts.getStatements(true,"!ex:a","!ex:p",null);
System.out.println("Infer statements in the transitive closure of ex:a under ex:p");
AGUtils.showTriples(cc);
ts.closeTripleStore();
ags.disable();
}
}
Up |
Next