Search code examples
rdfjenaowlprotege

create RDF using defined OWL ontology


I'm generating RDF for a database table(s). I generated OWL ontology for the table(s) using Protégé. I want to use this OWL ontology and create the RDF in RDF/XML format for table data using Jena. I know how to read and write RDF and OWL files into memory to generate Models, and I know how to use Resource, Property, ModelFactory, etc., classes to generate RDF. What I'm unable to do is use the ontology (OWL file) I generated and create the RDF instances for those OWL class(s). For example:

sample OWL:

<owl:Class rdf:about="Person"/>
<owl:Class rdf:about="Animal"/>

<owl:DatatypeProperty rdf:about="salary">
    <rdfs:domain rdf:resource="Person"/>
    <rdfs:range rdf:resource="&xsd;real"/>
</owl:DatatypeProperty>

desired RDF:

<Person rdf:about="Jack">
  <salary>1234</salary> 
</Person>

I'm able to generate RDF like this:

<rdf:Description rdf:about="Jack">
  <ns:salary>2004</ns:salary>
</rdf:Description>

Solution

  • What you want is a so called RDB2RDF mapper. Try D2RQ, a Java-based RDB2RDF mapper, for example.

    Disclaimer: I'm co-chair of the W3C RDB2RDF Working Group and my group is heavily contributing to the development of D2RQ - there are a number of other implementations in various languages available as well.