Round-tripping RDF export then import is not preserving the hierarchy. As taxonomy_xml_set_term_relations() loops through the terms array, if it found a match for a term via taxonomy_xml_get_term_by_guid() it overwrote the matched term in terms losing any predicates. So a term with children would find matches for the child terms and the child terms would be replaced, losing their predicates linking to the broader term. The attached patch doesn't overwrite if the term is already present in the terms array.

Comments

dman’s picture

Hm. Maybe that was an effect if run in one go (where the big list of terms accumulates) but didn't turn up when running in atomic batch mode (where each term is added as a unique action). Either that or an order-of-operations thing. The usual assumption is that parents are sequentially defined before the children, though it's not required.

Looks like the fix would make sense.

Do you have a small sample file that demonstrates the problem?

jonathan_hunt’s picture

StatusFileSize
new4.68 KB

Attached is a file containing the start of simple NZ placename hierarchy that should work. It's the one I was working with, though I've stripped a few terms to simplify the file. I've appended .txt to upload it to d.o

Before the patch, Auckland would load narrower terms, but that would strip the predicates from (say) Papakura.

tekken’s picture

subscribe

tekken’s picture

Issue summary: View changes

Clarify patch