AGReasoningSubClassOf.java
package com.franz.ag.examples;
import com.franz.ag.*;
public class AGReasoningSubClassOf {
@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("subclassof", AGPaths.TRIPLE_STORES);
ts.registerNamespace("ex","http://example.org/");
ts.addStatement("!ex:A","!rdfs:subClassOf", "!ex:B");
ts.addStatement("!ex:B","!rdfs:subClassOf", "!ex:C");
ts.addStatement("!ex:a","!rdf:type", "!ex:A");
Cursor cc = ts.getStatements(false,"!ex:A","!rdfs:subClassOf",null);
System.out.println("Superclasses of ex:A in the store:");
AGUtils.showTriples(cc);
cc = ts.getStatements(true,"!ex:A","!rdfs:subClassOf",null);
System.out.println("Superclasses of ex:A inferred:");
AGUtils.showTriples(cc);
cc = ts.getStatements(true,"!ex:a","!rdf:type",null);
System.out.println("Types of ex:a inferred:");
AGUtils.showTriples(cc);
ts.closeTripleStore();
ags.disable();
}
}
Up |
Next