Opened 6 years ago
Last modified 5 years ago
#1772 reopened defect
RDF translator loses creators linked via a symbol [patch]
| Reported by: | fbennett | Owned by: | ajlyon |
|---|---|---|---|
| Priority: | major | Milestone: | |
| Component: | translators | Version: | 2.1 |
| Keywords: | Cc: | fbennett |
Description
The RDF creator attempts to resolve symbol links to creators in other rdf:Description blocks as containers. The identifier is slightly different than a container (there is no _ underscore following the identifier #), so the attempt fails; but the existing list of creator symbols is overwritten, resulting in an empty list.
The attached patch avoids overwriting the list when the link attempt fails. With the patch, more foaf creator data should become available to the translator (I've run across two sites so far that place creator info in an rdf:Description block separate from other metadata ... and I've only looked at two).
Attachments (3)
Change History (15)
comment:1 Changed 6 years ago by ajlyon
- Status changed from new to accepted
comment:2 Changed 6 years ago by fbennett
Sorry about that. New version up now.
comment:3 Changed 6 years ago by ajlyon
- if(typeof(creators[0]) != "string") { // see if creators are in a container
- try {
- var creators = Zotero.RDF.getContainerElements(creators[0]);
- } catch(e) {}
Do we not need the try-catch? Is there a risk of Zotero.RDF.getContainerElements(..) throwing an error here?
comment:4 Changed 6 years ago by fbennett
Not sure, perhaps it's safer to keep it. If it's kept, it should probably log a warning on failure though.
comment:5 Changed 6 years ago by ajlyon
New patch handles exceptions, logs a message. Look good?
comment:6 Changed 6 years ago by fbennett
There seems to be a repeated test layer for (typeof(creators[0]) != "string").
comment:7 Changed 6 years ago by ajlyon
So there is. Although that was in your patch too. :P New patch attached.
comment:8 Changed 6 years ago by fbennett
Oops. Looks great now.
comment:9 Changed 6 years ago by ajlyon
- Resolution set to fixed
- Status changed from accepted to closed
Fixed in r7913.
comment:10 Changed 6 years ago by simon
- Resolution fixed deleted
- Status changed from closed to reopened
I reverted this patch in r7947 because it seems to break import of multiple creators. I think the problem is that creators.length == 1, since it's a single reference to the Seq, but newCreators.length > 1. Additionally, I don't know if Zotero.RDF.getContainerElements() throws anymore since the Tabulator transition, but this patch would also throw if it did (since you would reference undefined.length at line 79).
comment:11 Changed 6 years ago by fbennett
- Cc fbennett added
comment:12 Changed 5 years ago by ajlyon
fbennett: Do you have sample RDF data that exercises this bit of the code? Before attempting to land this again, I'd like to get some test coverage.
This patch doesn't apply cleanly to trunk.