AGReasoningInverseOf.java
package com.franz.ag.examples;
import com.franz.ag.*;
public class AGReasoningInverseOf {
@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("inverseof", AGPaths.TRIPLE_STORES);
ts.registerNamespace("ex","http://example.org/");
ts.addStatement("!ex:a","!ex:owned-by","!ex:b");
ts.addStatement("!ex:c","!ex:owns","!ex:d");
ts.addStatement("!ex:jans","!ex:owns","!ex:birra");
ts.addStatement("!ex:owned-by","!owl:inverseOf","!ex:owns");
Cursor cc = ts.getStatements(false, null, null, null);
System.out.println("Ground triples in the store:");
AGUtils.showTriples(cc);
Cursor cc2 = ts.getStatements(true,null,"!ex:owned-by",null);
System.out.println("owned-by triples in the store and inferred:");
AGUtils.showTriples(cc2);
ts.closeTripleStore();
ags.disable();
}
}
Up |
Next