Replacement of DC subjects through hierarchical subjects

Skip to first unread message


Feb 22, 2010, 1:57:52 PM2/22/10
to JPhotoTagger Developers
DC (Dublin Core) subjects (keywords) are not hierarchical. The *right*
tree view of the hierarchical subjects is currently for organizing
keywords and supports editing through adding automatically parent
keywords. The *left* "selection" tree view does not display images in
a hierarchy, it shows only images containing that keyword and all it's
parent keywords.

In this article I'm starting a discussion, what has to be done, that
JPhotoTagger supports ("really") hierarchical keywords.

1. Database structure

1.1 Dropping table "xmp_dc_subjects"
1.2 Adding table "hierarchical_subject_xmp"
That table resolves the n:m relation of a hierarchical keyword
(HK) to
XMP metadata: 1 HK can be in multiple XMP, 1 XMP can have multiple
It has two foreign key columns: "id_xmp" and

2. Migrating old DC subjects

1. If JPhotoTagger starts and the table xmp_dc_subject does exist:
1.1 Copy all distinct DC subjects as root hierarchical keywords (if
they does not already exist)
1.2 Relate them to their XMP ("xmp_dc_subjects.id_xmp") in table
1.3 If successfully, drop table "xmp_dc_subjects"
1.4 The names of saved searches having "xmp_dc_subjects" in their
string will be prefixed with an exclamation mark to give a hint,
that they will produce invalid queries

3. Creating XMP namespace

The Dublin Core XMP namespace can't be used for hierarchical subjects.
The Adobe Photoshop Lightroom's XMP namespace can't be used, because
it does not distinguish between real and helper keywords. So
JPhotoTagger has to create and register it's own namespace.

Hierarchical keywords are delimited (as Lightroom does) by the pipe
character "|". The input verifyers are ensuring, that a keyword does
not contain that delimiter. Every Keyword has the prefix "R:" or "H:"
with the meaning "Real" or "Helper" which will be removed for
displaying and storage into the database.

4. Reading XMP

1. If the XMP has a JPhotoTagger namespace, only that keywords will be
2. If the XMP has no JPhotoTagger namespace, but Adobe Photoshop
keywords, they will be used
3. If neither JPhotoTagger nor Lightroom keywords do exist, DC
subjects will
be used

5. Writing XMP

1. Write hierarchical keywords into JPhotoTagger's namespace with
"R:" and "H:" prefixes
2. Write hierarchical keywords into Adobe Photoshop Lightrooms
without "R:" and "H:" prefixes
3. Write distinct keywords as flat DC subjects

6. Editing

When adding a hierarcical keyword to an image, in the database only
one ID pair has to be stored whithin the table

The edit panel list of subjects does display the hierarchy e.g.
"Keyword1 > Keyword2" as item 1 and "Keyword3 > Keyword4 > Keyword5"
as item 2 and so on. It's items are Keyword objects containing all
it's parents for writing XMP.

The editor ensures that the same HK can't be added more than one

How to handle the input text field?

* Do not longer use it
* Use ist with a helper dialog displaying all possible hierarchies of
a typed
keyword for selecting
* Use it only for adding not existing keywords as new root keywords

6. Queries

If a keyword is selected in the tree, all images containing that
hierarchy will be displayed. Thus means, all paths with that keyword
as parent has to be resolved. To do that: What is the best strategy in
a relational database (a hierarchical database would be a better
solution for such queries).

How to handle saved searches? E.g. using ">" as "is parent keyword

7. Other questions

Removing the "flat" list would save work.


Mar 16, 2010, 4:19:36 AM3/16/10
to JPhotoTagger Developers
Currently we don't implement keywords hierarchies:

* Tree remains an input help
* Probably, with exception of Lightroom, no other application will
support hierarchical keywords in future as an "open" standard,
so that Application A writes keywords hierarchies into XMP and
other applications reads the written keywords as the same
hierarchy with the same meaning
* Complex on changes
* Time consuming for users to keep hierarchies

Reply all
Reply to author
0 new messages