Hi,
trying to export a vocabulary with "Hierarchical tree structure with term ids and names".
But when I see the output of this export, I only see the parent term id and the child term id. No names, no description.

Thanks a lot in advance for going into this. I use latest .dev version of the module.
Would love to be able to export a complete vocabulary, because on one site it is corrupt, and I am not able to get it exported another way.

Greetings, Martijn

Comments

Daniel_KM’s picture

Hi,

Thanks for all your reports. Unfortunately, I'm very busy until the end of the month. I hope you can wait a little.

Sincerely,

Daniel Berthereau
Infodoc & Knowledge management

Summit’s picture

Hi,
Thanks for your reply, and yes I have some time, it would be great if exporting/importing vocabulary with hierarchy will be possible.
Because of working in countries with very slow internet changing hierarchical vocabulary offline is needed. So exporting, changing offline, importing again is my usecase. Great you are willing to help me with this.

Could luck with your busy projects and hope hearing from you soon at the end of the month.

Greetings, Martijn

ndf’s picture

Hi summit,

I tried with version 7.x-5.x-dev from 2012-Jun-15 and confirm this bug.

Export option 'Hierarchical tree structure with term ids and names' creates a flat list without a reference to parent terms.

'Hierarchical tree structure' (only term names) and 'Hierarchical tree structure and Fields' do give you the hierarchy. The latter is a more difficult to import.

If both don't suite your case, you could use 'views data export' to get your taxonomies out of your corrupt website. It gives you a lot of control, but it's quite some work to configure it. (Nb: make a view of 'taxonomy terms', add the relation 'parent term', then just render your fields [tid, parent-tid, name, description, img, etc]).

Summit’s picture

Hi Niels,

Thanks for your reply.
Your comment 'Hierarchical tree structure' (only term names) and 'Hierarchical tree structure and Fields' do give you the hierarchy. The latter is a more difficult to import.

I do not think this is correct.
1) The Hierarchical tree structure gives you the term names yes, but how to import these then as vocabulary. The relation with the underlying TIDS are gone. So this is not a correct export -> import scenario
2) Hierarchical tree structure and Fields do not give the correct hierarchy also. See: http://drupal.org/node/1777742#comment-6483156 No TIDS are shown correctly so no correct export -> import scenario is possible also.

My use case is exporting a correct working but not hierarchical enough vocabulary. Then changing this offline by setting the correct hierarchy. Changing parent terms etc... Than importing this vocabulary with altered hierarchical term relations. So TIDS, term names, fields all need to be exported and imported!

Thanks a lot again for your reply.

greetings,
Martijn

ndf’s picture

Hi Summit,

Going to summarize howto import a hierarchical taxonomy with its fields. It's a bit obscure and you need configuration on import. I cannot solve importing a hierarchy and descriptions in one step. But I can import a hierarchy or terms with fields. So you can do it in 2 steps! Follow me.

First I created a vocabulary 'hierarchy' with 3 terms and descriptions:
- Fauna: Animal life
- Flora: Plant life
-- Flower: Bloom or blossom plant

Step 1: export and import the hierarchy

Export hierarchy

Goto '/admin/structure/taxonomy/csv_export'
Choose 'Hierarchical tree structure', Export

Result:
"Fauna"
"Flora"
"Flora","Flower"

The hierarchy is exported by using this notation: " 'root-term', 'child-term', etc... ". So no parent-tid, but term-path.

Import hierarchy

Goto '/admin/structure/taxonomy/csv_import'

  • tab 1: Type of import: Structure, Type of structure: Simple tree
  • tab 2: copy-paste exported result
  • tab 3: delimiter=«,» enclosure=«"»

Import

This should create the vocabulary 'Auto created vocabulary'.

Step 2: export and import descriptions and other fields

Export fields

Goto '/admin/structure/taxonomy/csv_export'
Choose 'Fields', Export

Result:
"Fauna","hierarchy","Animal life","plain_text","1",""
"Flora","hierarchy","Plant life","plain_text","2",""
"Flower","hierarchy","Bloom or blossom plant","plain_text","0",""

Import fields

Goto '/admin/structure/taxonomy/csv_import'
For 'Fields' use this configuration:

  • tab 1: Type of import: "Fields", Set order of items on a csv line*: "name, original_vocabulary, description"
  • tab 2: copy-paste exported result
  • tab 3: delimiter=«,» enclosure=«"»
  • tab 4: choose vocabulary we just created: 'Auto created vocabulary'.

* use the machinename of the field, see admin/structure/taxonomy//fields
Import

There is one problem. For each term our import created the field 'original_vocabulary' with value 'hierarchy' for us. We can solve this 2 ways: first way is manualy delete the column "hierarchy" from the export file before importing. Then as import structure you choose "name, description". Second way is after import go to "/admin/structure/taxonomy//fields" and delete the created field.

With this import-type I succesfully imported terms-relations and a lot of other fields.

Endresult

We now succesfully imported a taxonomy with its hierarchy and 2 fields: 'term-name', 'description'.

Summit’s picture

Hi Niels,

Thanks for this thorough example. But the problem is in my usecase that all sort of nodes already have a relationship with TID's, so only termnames is not enough.

Is it possible to export termnames and hierarchy within this, and term ids' and hierarchy in this also together. Than change the exported vocabulary so I set that some termnames (and tids) have say a parent relation extra. And than importing the changed vocabulary with the same TID's but better hierarchy placements?

greetings, Martijn

ndf’s picture

Category: bug » feature
Status: Active » Needs work

Hi Summit,
As far as I know it is not possible to import hierarchy, fields and tids together.

Summit’s picture

Hi Daniel,

Can you elaborate on this please. Is it true isn't it possible with Taxonomy CSV to export/import Hierarchy with fields, termnames and TID's?
If not, this will be a feature request than please.
Off course in your time. I do not want to disturb you in this bussy period for you.

Greetings, Martijn

Summit’s picture

Hi @Daniel_KM any change you will have an update any time soon please?
Thanks a lot in advance for your reply!
Greetings, Martijn

Summit’s picture

Hi, I see latest update for this module is june 2012.
I would very much like to be able to have my hierarchical taxonomy with terms and TIDS exported, offline changed and imported again. But is this module the right option with so less going on?
Is there may be an alternative, or are you willing to take the effort to bring this module up to speed?

I do not know what to do now, and am stuck with trying to export some database tables and trying this way to move forward. Sorry to report but it seems this module is not maintained anymore?

If I am wrong I apologize, but no commits after june 2012 looks to me as a unsupported module.

greetings, Martijn

Daniel_KM’s picture

Hi,

Thanks for your patience. The module is not unmaintened, but I'm very busy for another work. A co-maintainer will be welcomed. I will answer any remarks and upgrade the module as soon as I can.

Sincerely,

Daniel Berthereau
Infodoc & Knowledge management

Summit’s picture

Hi Daniel, Thanks for your quick reply!
When do you think really you have time to get this working? I can then plan my activities afterwards.
Greetings, Martijn

tonicboy’s picture

Hi,

I would like to chime in as having a similar problem. I have tried to use the 2-step process as outlined by nielsdefeyter. Unfortunately, because I have duplicated term names, then one of two things will happen:

  1. If choose the "Update it and merge fields" option, then only the first term of the same name will have the fields data updated, or...
  2. If I choose the "Ignore it and create a new term" option, then all fields will be duplicated.

From the documentation, it seems as though a Fields import with TID's instead of term names as the key would solve this issue. However, as discussed, there doesn't seem to be a working option to export fields with TIDs.

Jim Bacon’s picture

Hi
I encountered the same situation as tonicboy. My workaround, using version 7.x-5.10, was to uncomment line 144 in modules/taxonomy_csv/export/taxonomy_csv.export.api.inc
$vocabulary->fields['tid'] = array('cardinality' => 1);

When I subsequently export fields, the tid is the first column.