Hi Lorenz,

Ah, no there is no equivalent of isEntailedBy in Jena.

If your graphs don't have bNodes then it would be easy: check if each statement in m1 is contained in the RDFS closure of m2.

If you have bNodes then you may be able to finesse it. You can check if m1 and m2 have the same closure:

    Model m1closure = ModelFactory.createDefaultModel();
    m1closure.add( ModelFactory.createInfModel(fullRDFSReasoner, m1) );
    Model m2closure = ModelFactory.createDefaultModel();
    m2closure.add( ModelFactory.createInfModel(fullRDFSReasoner, m2) );
    boolean sameClosure =  m1closure.isIsomorphicWith(m2closure);

Then you just need to test if m2 is a subset of m1, which you could do statement by statement by replacing bNodes with wildcards.

Without having thought about it deeply that might work. The isIsomorphicsWith handles the GI-COMPLETE step of comparing graphs with bNodes. Will still be limited that the lack of absolute completeness of the provided RDFS rules.

Dave

On 24/03/15 08:57, Lorenz Bühmann wrote:
Hello Dave,

thnaks for the quick reply. I'm aware of the different RDFS entailment
implementations, but I was more wondering how to check the entailment
between 2 graphs. My question was probably not specific enough, so
consider for instance 2 JENA models

Model m1
Model m2

What would be the way to go to check if for instance m1 is RDFS entailed
by m2? I know I can create an InfModel by assigning a reasoner, but I'm
more looking for something like

m1.isEntailedBy(m2):boolean

or

m2.entails(m1):boolean

Sorry if my first question wasn't clear enough.

Kind regards,
Lorenz

On 24/03/15 08:00, Lorenz Bühmann wrote:
Hello,

I'm using latest Apache JENA 2.13.0 and I'm wondering if it contains
algorithms for RDFS or even pD* entailment of graphs (aka. models)? I
couldn't find anything in the documentation
(https://jena.apache.org/documentation/inference/), that's why I'm
asking before I start to implement it by myself.

As it says in that documentation there is the RDFS rule reasoner which
implements different subsets of the RDFS entailment rules but, as it
says there, even the FULL mode omits the bNode datatype entailments.

If you need absolute and guaranteed completeness then indeed building
your own would be the way to go.

Dave


Reply via email to