rdfapache-jenad2rq

Add type triple to rdf document using D2RQ


If I use the default d2rq mapping file (ttl) all my colums are mapped to rdf properties. E.g. the colum ID becomes the Property "hasID" (after renaming).

  <rdf:Description rdf:about="http://www.semanticweb.org/adoxx/ontologies/2016/5/untitled-ontology-24#hasId">
    <rdfs:label>hasId</rdfs:label>
    <rdf:type rdf:resource="http://www.w3.org/1999/02/22-rdf-syntax-ns#Property"/>
  </rdf:Description>

I want to replace the rdf property triple or add a further type triple so that my result is

      <rdf:Description rdf:about="http://www.semanticweb.org/adoxx/ontologies/2016/5/untitled-ontology-24#hasId">
        <rdfs:label>hasId</rdfs:label>
        <rdf:type rdf:resource="http://www.w3.org/1999/02/22-rdf-syntax-ns#Property"/>
        <rdf:type rdf:resource="http://www.w3.org/2002/07/owl#DatatypeProperty"/>
      </rdf:Description>

The documentation [1] states that types are generated automatically.

Do you have an idea how to get such a result? I need the distinction between DatatypeProperty and ObjectProperty so that they are correctly imported in the OWL-API [2].

[1]http://d2rq.org/d2rq-language [2]https://sourceforge.net/p/owlapi/mailman/message/35333117/


Solution

  • I found a solution for adding a second (OWL) type triple to the property (a solution for replacing the auto generated property seems not to be available without touching the code).

    You have to update your ttl file by adding an additional Property triple (owldatatypeproperty was not created by d2rq, it was introduced by me!):

    map:owldatatypeproperty a d2rq:AdditionalProperty;
        d2rq:propertyName rdf:type;
        d2rq:propertyValue <http://www.w3.org/2002/07/owl#DatatypeProperty>;
        .   
    

    Then you have to extend the property bridge definition by referencing to the additonal property:

    map:abc_ID a d2rq:PropertyBridge;
        .....
        d2rq:datatype xsd:integer;
        d2rq:additionalPropertyDefinitionProperty map:owldatatypeproperty;
        .
    

    Thats it.

    A short description is provided at [1]

    [1] http://d2rq.org/d2rq-language#additionalproperty