Banner

A corner case of converting a literal to a property.
Or converting a database table cell value to a database table name

The case

Source

We have the source record that describes an art object, e.g. a vase. It has three fields:

  • dc:title with value Vase,
  • dc:identifier with value 001, and
  • dc:creator with string P. Picasso, designer as a value, stating that Picasso was involved in the role of designer in this vase.

How problematic could it be to convert it to another data model, e.g. Europeana EDM?

Target: identifiers

In the target model we have two classes: a class for a record, and a separate class for a person. Accordingly, we create two instances:

  • one for the record with dc:identifier set to 0001 and dc:title set to Vase, and
  • one for the creator with... wait a minute, there is no identifier for Picasso in the original record, and its name is a kind of polluted.

Let us first fix the identifier. Let us set it to P._Picasso , as it is about him. What would happen if we meet another record about Picasso, maybe playing the role of a painter? We need to keep track of all identifiers that we assign, so that we can reuse the objects.

What would happen if another record would mention Pablo Picasso ? Ok, let us create a new identifier Pablo_Picasso and leave duplicate detection for later.

Just make a note that we need to generate identifiers in a non-trivial way, and store previously assigned identifiers.

Target: links

Ok, we create two objects and link the record to the person to show that this vase has something to do with Picasso.

But Picasso was not just involved, he was the designer. This link (or property) should be named accordingly.

We create the link 001-designer-P._Picasso to state that object 001 is linked to object P._Picasso

Problem

Look, what is happening here: a part of a string is converted to a property name.

In Java terms

"P. Picasso, designer" is a String value. It is converted to property "designer" that is a variable (or member) name. It is not a String, it is the name of a variable in Java source code.

A converter is not only translating String values, it is modifying your source code!

In data modeling terms

Constructs for classes record and person , properties creator and designer define the data definition language. In this rule we are not just converting data from one language to another, we are also modifying the target data definition language itself.

In logic terms

Reification.

Solutions

It can be solved, avoided, rephrased.

(c) 2011, Borys Omelayenko,