Hi all,
I do not really understand the inheritance of properties in class/sub
class constructs. As far as I understood the semantic web technologies a
subclass inherits all properties of its super-class(es). Having this in
mind I've build up the following construct:
String PREFIX = "TEST://";
/*create model.*/
Model tmp = ModelFactory.createDefaultModel();
/*create resources and properties.*/
Resource A = tmp.createResource(PREFIX + "A");
Resource A1 = tmp.createResource(PREFIX + "A1");
Resource B = tmp.createResource(PREFIX + "B");
Property a = tmp.createProperty(PREFIX + "a");
Property b = tmp.createProperty(PREFIX + "b");
/*create a simple statement, where property 'a' should be
inherited afterwards.*/
tmp.add(tmp.createStatement(A, a, B));
//add additional knowledge
//1) A is a class and
//2) A is a member of its own class extension (set of things
belonging to A)
tmp.add(tmp.createStatement(A, RDF.type, RDFS.Class));
tmp.add(tmp.createStatement(A, RDF.type, A));
//3) A1 is a subclass of A
//4) A1 is a member of its own class extension (set of things
belonging to A1)
tmp.add(tmp.createStatement(A1, RDFS.subClassOf, A));
tmp.add(tmp.createStatement(A1, RDF.type, A1));
/*build a inference model and list all statements about A1
In my opinion this should also list a statement like A1---a--->B.
as A1 is a subclass of A and a is a property of A.
Unfortunately it does not!*/
Model mDeductive =
ModelFactory.createOntologyModel(OntModelSpec.OWL_DL_MEM_RULE_INF, tmp);
//for(Statement stmt : tmp.listStatements(A1, null, (RDFNode)
null).toList()){
for(Statement stmt : mDeductive.listStatements(A1, null,
(RDFNode) null).toList()){
System.out.println(stmt);
}
}
Can you tell me, why I do not get a statement like A1---a--->B, although
A1 is a subclass of A and 'a' is a property of A? What do I have to do
to achieve this, what I'm doing wrong?
Best,
Thorben