Skip to content

conversion:keys

Tim L edited this page Aug 7, 2013 · 34 revisions

What is first

What we will cover

Let's get to it

This conversion:Enhancement is loosely analogous to owl:key.

Example 1 - input

bash-3.2$ cat manual/test.csv contains:

name,state,company
susy,CA,CA
paul,MA,MA

Example 1 - links-via graph

bash-3.2$ cat manual/links-via.ttl contains:

@prefix dcterms: <http://purl.org/dc/terms/> .

<http://dbpedia.org/resource/M._A._Hanna_Company> 
   a <http://dbpedia.org/ontology/Company>;
   dcterms:identifier "MA" .

<http://logd.tw.rpi.edu/id/us/state/Massachusetts> 
   a <http://dbpedia.org/class/yago/StatesOfTheUnitedStates>.

<http://dbpedia.org/resource/Computer_Associates> 
   a <http://dbpedia.org/ontology/Company>;
   dcterms:identifier "CA" .

<http://logd.tw.rpi.edu/id/us/state/California> 
   a <http://dbpedia.org/class/yago/StatesOfTheUnitedStates>.

without owl:keys qualification to conversion:links_via, we get undesirable sameAs (the state and the company are both sameAs the state and the company):

Example 1 - initial (undesired) output

value_of_state:CA
   dcterms:identifier "CA" ;
   rdfs:label "CA" ;
   owl:sameAs dbpedia:Computer_Associates, <http://logd.tw.rpi.edu/id/us/state/California> .

value_of_company:CA
   dcterms:identifier "CA" ;
   rdfs:label "CA" ;
   owl:sameAs dbpedia:Computer_Associates , <http://logd.tw.rpi.edu/id/us/state/California> .

Example 1 - qualifying conversion:links_via with conversion:keys

Update the eparams to specify additional restrictions that the target Resource must satisfy in order to link:

      conversion:enhance [
         ov:csvCol          2;
         ...
         conversion:links_via <links-via.ttl>;
         conversion:keys [
            # The resources that we try to link to MUST also be described with each predicate-object in this collection.
            dcterms:hasPart [
              conversion:predicate rdf:type;
              conversion:object <http://dbpedia.org/class/yago/StatesOfTheUnitedStates>;
            ], [
              conversion:predicate rdf:type; # More than one predicate-object pair could be specified, 
                                             # this example is being redundant.
              conversion:object <http://dbpedia.org/class/yago/StatesOfTheUnitedStates>;
            ];
         ];
      ];
      ...
      conversion:enhance [
         ov:csvCol          3;
         ...
         conversion:links_via <links-via.ttl>;
         conversion:keys [
            # The resources that we try to link to MUST also be described with each predicate-object in this collection.
            dcterms:hasPart [
              conversion:predicate rdf:type;
              conversion:object <http://dbpedia.org/ontology/Company>;
            ], [
              conversion:predicate rdf:type; # More than one predicate-object pair could be specified,
                                             # this example is being redundant.
              conversion:object <http://dbpedia.org/ontology/Company>;
            ];
         ];
      ];

What is next

Clone this wiki locally