Skip to content

conversion:domain_name

timrdf edited this page Sep 16, 2012 · 36 revisions

What is first

What we will cover

This page discusses how to add a type to the row of a table during conversion (and thus the subject of the triples created) using the conversion:domain_name enhancement.

Let's get to it

The following table talks about people and states, and it is good practice to type each instance. In the naive RDF conversion below the table, it is rather difficult to automatically recognize that people and states are being mentioned. The conversion:domain_name and the analogous conversion:range_name can help make this clearer.

First,Last,State
Anne,Armstrong,PA
Ben,Bailey,NY
eg:thing_2
   raw:first "Anne" ;
   raw:last "Armstrong" ;
   raw:state "PA" ;
   ov:csvRow "2"^^xsd:integer .

If we look at the initial enhancement parameters created the first time we pulled the conversion trigger, we see that each property is only being interpreted as a string literal.

      conversion:enhance [
         ov:csvCol          1;
         ov:csvHeader       "First";
         #conversion:label   "First";
         conversion:comment "";
         conversion:range   todo:Literal;
      ];
      conversion:enhance [
         ov:csvCol          2;
         ov:csvHeader       "Last";
         #conversion:label   "Last";
         conversion:comment "";
         conversion:range   todo:Literal;
      ];
      conversion:enhance [
         ov:csvCol          3;
         ov:csvHeader       "State";
         #conversion:label   "State";
         conversion:comment "";
         conversion:range   todo:Literal;
      ];

Older discussions

csv2rdf4lod-automation is licensed under the [Apache License, Version 2.0](https://github.com/timrdf/csv2rdf4lod-automation/wiki/License)

(apologies for the bad escaping - a bug in github?)

"What does each row represent?" is one of the first questions about an unfamiliar table of data. The conversion:domain_name enhancement answers this common question. For example, in our [quick and easy conversion](A quick and easy conversion), each row is an oil well; In the White House visitor records, each row is a person's visit to the White House.

Because many data curators commonly need to specify the conversion:domain_name, it is included in the default enhancement parameters.

      #conversion:enhance [
      #   conversion:domain_template "thing_[r]";
      #   conversion:domain_name     "Thing";
      #];
      #conversion:enhance [
      #   conversion:class_name "Thing";
      #   conversion:subclass_of <http://purl.org/...>;
      #];
  conversion:enhance [
     ov:csvCol          1;
     ov:csvHeader       "First";
     #conversion:label   "First";
     conversion:comment "";
     conversion:range   todo:Literal;
  ];
  conversion:enhance [
     ov:csvCol          2;
     ov:csvHeader       "Last";
     #conversion:label   "Last";
     conversion:comment "";
     conversion:range   todo:Literal;
  ];
  conversion:enhance [
     ov:csvCol          3;
     ov:csvHeader       "State";
     #conversion:label   "State";
     conversion:comment "";
     conversion:range   todo:Literal;
  ];

Example - Oil Wells

If conversion:domain_name is not set, you'll end up with something like:

:thing_2
   raw:quadrant_no "106" ;
   raw:tvdss_driller "0" ;
   raw:well_registration_no "106/20- 1" ;
   raw:completion_date "1990-11-01" ;

but after setting the enhancement parameters to:

      conversion:enhance [
         conversion:domain_name     "Oil Well";
      ];

you will get:

:oil_Well_2
   a local_vocab:Oil_Well ;
   e1:quadrant_no "106" ;
   e1:tvdss_driller "0" ;
   e1:well_registration_no "106/20- 1" ;
   e1:completion_date "1990-11-01" ;
.

local_vocab:Oil_Well 
   a rdfs:Class , owl:Class ;
   rdfs:label "Oil Well" .

:thing_2 con:preferredURI :oil_Well_2 .

Effects

  • Types the subject row (e.g. local_vocab:Oil_Well).
  • changes the local name of the subject (e.g. oil_Well_2 instead of thing_2). For more control of the local name or the full URI of the subject, see conversion:domain_template.
  • asserts a con:preferredURI from the thing_2 row instance to (e.g.) oil_Well_2. This will lead anybody that was familiar with :thing_2 to the preferred URI that includes a bit more human-friendly meaning.

Datasets that use this enhancement

(results):

PREFIX conversion: <http://purl.org/twc/vocab/conversion/>
SELECT distinct ?dataset ?template
WHERE {
  GRAPH <http://logd.tw.rpi.edu/vocab/Dataset>  {
    ?dataset conversion:conversion_process [
       conversion:enhance [
          conversion:domain_name ?template
       ]
    ]
  }
}

Clone this wiki locally