SourceForge.net Logo

DIG Interface

The DIG Interface is a standardised XML interface to Description Logics systems developed by the DL Implementation Group (DIG).

This project provides:

  1. XML Schemas;
  2. Java XMLBeans for parsing, creating, and manipulating instances of the schemas;
  3. Java Reasoners API using the above to actually communicate with DIG reasoners such as FaCT++ and Racer.

Contents

XML Schemas

There are currently two XML schemas for DIG:

Version 1.1 allows for multiple knowledge bases.

XMLBeans

The DIG XMLBeans Java APIs are automatically derived from the DIG XML schemas using Apache Foundation's XMLBeans. They provide a very elegant and efficient way of parsing, creating, and manipulating XML documents.

See Javadoc and Examples.

Reasoners API

Java API for communicating with DIG compliant reasoners, such as Racer and FaCT++. It relies on the DIG XMLBeans.

See Javadoc and Examples.

Downloads

You can download from our SourceForge download site:

Mailing List

A DIG users mailing list is available: subscribe.

Examples

        // Connect to a DIG HTTP reasoner, eg Racer, running on localhost:8080
        HTTPReasoner racer = new HTTPReasoner(new URL("http://localhost:8080"));
        
        // Wrap it in a TBox reasoner
        TReasoner reasoner = new TReasoner(racer);
	    
        // Ask the reasoner to create a new knowledge base
        URI kbURI = reasoner.newKB();
        String kb = kbURI.toString();
        
        //Parse a DIG ontology into a TellsDocument xmlbean.
        File myDigOntology = new File("myDigOntology.xml");
        TellsDocument tells = TellsDocument.Factory.parse(myDigOntology);
        
        // Load the ontology into the knowledge base kb.
        tells.getTells().setUri(kb);
        ResponseDocument response = reasoner.tells(tells);
        
        // check the response is valid against DIG schema
        boolean isValid = response.validate();
        
        // check the response is ok
        boolean isOk = response.getResponse().isSetOk());
        
        // Create an instance of the ConceptId xmlbean to be used to ask a query.
        ConceptId top = ConceptId.Factory.newInstance();
        // add the top concept to it
        top.addNewTop();
        // set its id to qTop
        top.setId("qTop");
        // retrieve the descendants of top
        Set descendants = reasoner.descendantsNames(top, kbURI);
        
        // retrieve the concepts equivalent to some(r,b)
        ConceptId some = ConceptId.Factory.newInstance();
        some.setId("qSome");
        RoleConceptPair rcPair = some.addNewSome();
        rcPair.addNewRatom().setName("r");
        rcPair.addNewCatom().setName("b");
        Set equivalents = reasoner.equivalentsNames(some, kbURI);

        // retrieve the children of concept name "driver"
        ConceptId driver = ConceptId.Factory.newInstance();
        Named d = driver.addNewCatom();
        driver.setId("qDri");
        d.setName("driver");
        Set equivalents = reasoner.childrenNames(driver, kbURI);
	

See tests in cvs for more examples.

References

S. Bechhofer, The DIG Description Logic Interface: DIG/1.1, Proceedings of DL2003 Workshop, Rome, June 2003.

I. Dickinson, Implementation experience with the DIG 1.1 specification, Tech report HPL-2004-85, Hewlett-Packard, May 2004.


Daniele Turi