Skip to content

conversion:Only_if

Tim L edited this page Jul 30, 2013 · 8 revisions

conversion:Only_if is a conversion:Enhancement.

In a table where we keep track of how long each person's boat is, we can represent the implicit boat using a conversion:ImplicitBundle

name,length
Susy,0
Johny,10

We can avoid asserting a boat length of 0 with interpret null:

<Susy>
   foaf:name "Susy" ;
   e1:owns implicit_owns:boat_2 ;
   ov:csvRow "2"^^xsd:integer .
   
<Johny>
   foaf:name "Johny" ;
   e1:owns implicit_owns:boat_3 ;
   ov:csvRow "3"^^xsd:integer . 

implicit_owns:boat_2 a local_vocab:Boat .

implicit_owns:boat_3 a local_vocab:Boat ;
   e1:length "10"^^xsd:integer .

But, in some cases we may want to avoid asserting that there is a boat (implicit_owns:boat_2) at all. We can do this by typing the bundle as conversion:Only_if. When an ImplcitBundle is also typed to conversion:Only_if, then it is only asserted if some cell values lead to a triple describing the ImplicitBundle. If no cell values lead to triples describing the ImplicitBundle, then the instance is not asserted.

:a_bundle
   a conversion:ImplicitBundle, conversion:Only_if; ## Add a second type.
   conversion:property_name "Owns";
   conversion:type_name     "Boat";
.
<Susy>
   foaf:name "Susy" ;
   ## Ownership of implicit_owns:boat_2 no longer asserted because no cells described the boat.
   ov:csvRow "2"^^xsd:integer .
   
<Johny>
   foaf:name "Johny" ;
   e1:owns implicit_owns:boat_3 ;
   ov:csvRow "3"^^xsd:integer . 

### implicit_owns:boat_2 no longer asserted as a Boat.

implicit_owns:boat_3 a local_vocab:Boat ;
   e1:length "10"^^xsd:integer .
Clone this wiki locally