use of com.hp.hpl.jena.rdf.model.Statement in project stanbol by apache.
the class JenaRDFSReasoningServiceTest method testRDFSSubPropertyOf.
@Test
public void testRDFSSubPropertyOf() {
log.info("Testing rdfs:subPropertyOf inference with RDFS reasoner");
// We invent a property to extend foaf:knows
Property collegueOf = TestData.model.createProperty(TestData.TEST_NS + "collegueOf");
collegueOf.addProperty(RDFS.subPropertyOf, TestData.foaf_knows);
// Prepare data
TestData.alexdma.addProperty(collegueOf, TestData.enridaga);
// Setup input for the reasoner
Model input = ModelFactory.createUnion(TestData.foaf, TestData.alexdma.getModel());
// Does alexdma know enridaga?
InfModel inferred = reasoningService.run(input);
Statement knowsHim = TestData.model.createStatement(TestData.alexdma, TestData.foaf_knows, TestData.enridaga);
// log.info("Statements: {}", TestUtils.printStatements(inferred,
// TestData.enridaga, RDF.type));
log.info("Does alexdma foaf:knows enridaga?...(true)? {}", inferred.contains(knowsHim));
assertTrue(inferred.contains(knowsHim));
// Reset resource to be clean for other tests
TestData.alexdma.removeProperties();
}
use of com.hp.hpl.jena.rdf.model.Statement in project stanbol by apache.
the class JenaRDFSReasoningServiceTest method testRDFSRange.
@Test
public void testRDFSRange() {
log.info("Testing rdfs:range inference with RDFS reasoner");
// Prepare data
TestData.alexdma.addProperty(TestData.foaf_knows, TestData.enridaga);
// Setup input for the reasoner
Model input = ModelFactory.createUnion(TestData.foaf, TestData.alexdma.getModel());
// Is enridaga a foaf:Person?
InfModel inferred = reasoningService.run(input);
Statement isPerson = TestData.model.createStatement(TestData.enridaga, RDF.type, TestData.foaf_Person);
// log.info("Statements: {}", TestUtils.printStatements(inferred,
// TestData.enridaga, RDF.type));
log.info("Is any rdfs:range of foaf:knows a foaf:Person...(true)? {}", inferred.contains(isPerson));
assertTrue(inferred.contains(isPerson));
// Reset resource to be clean for other tests
TestData.alexdma.removeProperties();
}
Aggregations