I have a hierarchical vocabulary, and I'm trying to insert more terms into different levels of the hierarchy. Like, I have:

A
--B
--C
D
--F
----G
--H

And I'd like to insert terms I and J so that they fit in these places in the hierarchy:

A
--I
D
--F
----J

As in, I would be added in the level where B and C are, and J would be added to the level where G is. I hope this is clear. But there's one more catch: Some of the terms I'm inserting are identical to terms in other places in the hierarchy, like if for instance I wanted to insert another element B as a child of D. Can this be done? I can't get it to work correctly with the "allow duplicate terms setting". Either my duplicate terms are deleted, even though they are in different places in the hierarchy, or I get duplicate parent terms, instead of terms being assigned to already existing parents. I have this problem both in d6 and d5 versions...

Comments

dman’s picture

What format are you using?
'allow duplicate terms' hasn't been tested since the newer formats were added. Instead we fall back to string matching - which will cause your problem.

To get duplicate terms actually happening, we ALSO need to have some sort of unique ID so we can tell them apart.
It will never happen with the CSV format, which only ever does string matching.
It can happen with the drupal-xml version if your input file contains the term IDs (but not tested recently)
it can happen with the RDF format if the input contains unique URIs in the about="" field. Or at least should.

goron’s picture

I've been using the xml format. Is it currently possible to do this with xml using ID's? How is it done? Aren't the term ID's just relative to the other ID's in the xml file? I haven't tried RDF at all...

dman’s picture

Yeah, no.
The original Drupal XML format mirrors the internal structure directly. So the term IDs in the file reflect term IDs in the database.
This means it's only useful for exact site clones or sites that do not have any pre-existing terms.
This was a design drawback, and why it needed upgrading to a more portable format. It's OK for seting up new sites though.
Importing over top of an existing vocab while keeping old IDs will hurt.

dman’s picture

Status: Active » Postponed

Currently importing over pre-existing vocabs - using any of the formats - will do STRING-MATCHING to find parents and slot in with them.
Therefore it is NOT supported to have duplicate terms and import heirarchies meaningfully.

The only way this will be solved/worked around is in the RDF format which has the potential to support GUIDs. But for now, there are not enough use-cases in the wild to take this potential feature further.