#317 Integrating with OpenRDF


I have integrated the owlapi-rdfxml and owlapi-turtle modules with OpenRDF. The mapping was mostly simple except for the case where Blank Nodes and URIs were being aggregated in a single class when they were never defined this way and clash with the OpenRDF system that is designed to use instanceof to distinguish between BNode and URI, even though both are subsets of Resource as they can both be used in the subject position of a triple. Once I made those changes, it was simple to extend RDFTriple to implement org.openrdf.model.Statement . This then made it very simple to export data in TurtleRenderer, as each RDFTriple can be handled directly by a Rio TurtleWriter.

In addition, I also made IRI an instanceof org.openrdf.model.URI so that IRI objects can be natively traded between OpenRDF APIs and OWLAPI-APIs. This point is very important for me as I am developing an application that uses OWLAPI in memory, with Sesame being used to process inputs and store and retrieve data from databases.

The only backwards compatibility issue with the modifications is the fixed, correct, heirarchy of RDFResourceNode as an abstract class with two subclasses that need to be chosen at compile time. This means that precompiled code referencing the RDFResourceNode constructors will fail over at runtime, and any current code will be flagged and not compile until people specify whether they want to construct a URI or a BlankNode Resource. For what it is worth, it was very simple to convert RDFTranslator, so people should not have any issues migrating code.

See the changes at GitHub:



  • Peter Ansell

    Peter Ansell - 2012-03-29
    • status: open --> closed-later
  • Peter Ansell

    Peter Ansell - 2012-03-29

    Closing this as the approach I took was not viable without fixing the internal assumption that Blank Nodes are a subset of IRIs, and the use of "genid" hacks to make things work sometimes.

    To integrate with OpenRDF both anonymous nodes and IRIs need to be clearly distinguished.

  • Ignazio Palmisano

    • assigned_to: nobody --> ignazio1977

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

No, thanks