Hey list,

I was implementing a OO-like inheritance for annotation properties
when I realized I can probably express it as custom Jena rules. I want
to push the properties down the subclass chains and preferably
materialize them. Currently my code looks like this:

        String rules = "[inheritance: (?class ?p ?o), (?p rdf:type
owl:AnnotationProperty), (?subClass rdfs:subClassOf ?class),
noValue(?subClass ?p) -> (?subClass ?p ?o) ]";
        Reasoner reasoner = new GenericRuleReasoner(Rule.parseRules(rules));
        reasoner.setDerivationLogging(true);
        reasoner.setParameter(ReasonerVocabulary.PROPtraceOn, Boolean.TRUE);
        OntModel ontModel =
OntDocumentManager.getInstance().getOntology(ontologyURI,
OntModelSpec.OWL_MEM);
        reasoner.bindSchema(ontModel);
        ontModel.prepare();

This does not seem to work however - subclasses without annotations do
not seem to inherit them from superclasses. Could the rule be wrong?
Should I be constructing the OntModel with a custom OntModelSpec
instead of bindSchema()? Or could it be smth else altogether?

Thanks.

Martynas

Reply via email to