AGReasoningDomainRange.java
package com.franz.ag.examples;
import com.franz.ag.*;
public class AGReasoningDomainRange {
@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("domainrange", AGPaths.TRIPLE_STORES);
ts.registerNamespace("ex","http://example.org/");
ts.addStatement("!ex:a","!ex:p", "!ex:b");
ts.addStatement("!ex:p","!rdfs:domain", "!ex:D");
ts.addStatement("!ex:p","!rdfs:range", "!ex:R");
Cursor cc = ts.getStatements(false,null,"!rdf:type",null);
System.out.println("Retrieving all rdf:type's in the store (should be none):");
AGUtils.showTriples(cc);
cc = ts.getStatements(true,"!ex:a","!rdf:type",null);
System.out.println("Inferring the rdf:type of ex:a");
AGUtils.showTriples(cc);
cc = ts.getStatements(true,"!ex:b","!rdf:type",null);
System.out.println("Inferring the rdf:type of ex:b");
AGUtils.showTriples(cc);
ts.closeTripleStore();
ags.disable();
}
}
Up |
Next