alphaville / ToxOtis

An HTTP client for consuming OpenTox predictive toxicology web services.
http://opentox.ntua.gr/wiki
6 stars 1 forks source link

Validate RDF #41

Closed alphaville closed 10 years ago

alphaville commented 10 years ago

Use this http://www.jevon.org/wiki/OWL_Validation_with_Jena or something similar to validate our ontological models against the OpenTox ontology (http://opentox.org/data/documents/development/RDF%20files/OpenToxOntology/at_download/file).

alphaville commented 10 years ago

OK, the following code works. Now, need to write a class and use it for testing.

    @Test
    public void testValidateMe() throws Exception{
            OntModelSpec ontModelSpec = OntModelSpec.OWL_DL_MEM;
            Reasoner reasoner = ReasonerRegistry.getOWLReasoner();
            OntModel schema = ModelFactory.createOntologyModel( ontModelSpec );
            reasoner = reasoner.bindSchema(schema);
            Algorithm a = new Algorithm("http://opentox.ntua.gr:8080/algorithm/mlr");
            a.loadFromRemote();
            OntModel model = a.asOntModel();
            InfModel inf = ModelFactory.createInfModel(reasoner, model);
            ValidityReport valid = inf.validate();
            System.out.println(valid.isValid());
            for (Iterator i = valid.getReports(); i.hasNext(); ) {
            System.out.println(" - " + i.next());
        }

    }

This tests whether the model is OWL-DL valid. If one needs to check whether is satisfies the rules of the OpenTox ontology, we would need to add:

schema.read("http://opentox.org/data/documents/development"+
  "/RDF%20files/OpenToxOntology/at_download/file", null);            

but inference becomes too slow and there are some problems with the OpenTox OWL file that hinder the whole process.

alphaville commented 10 years ago

Resolved