Project

General

Profile

Actions

Bug #2999

closed

only one attribute per element returned with pathquery results

Added by ben leinfelder over 16 years ago. Updated almost 16 years ago.

Status:
Resolved
Priority:
Normal
Category:
metacat
Target version:
Start date:
11/07/2007
Due date:
% Done:

0%

Estimated time:
Bugzilla-Id:
2999

Description

when a path query requests that multiple attributes for the same element are returned, only one is actually present in the results.

example:
<returnfield>assessment/@assessmentTitle</returnfield> <returnfield>assessment/@assessmentId</returnfield>

only @assessmentId is given in results.

Actions #1

Updated by ben leinfelder over 16 years ago

Jing,
In regards to the bug where only one attribute per element is returned
in a metacat pathquery, I found a fix that I want to run by you. I'm
not sure if there was a reason that this limitation was coded, but it
seems like an unreasonable thing to enforce.
In the method putInArray(...) I've commented out the for loop that
checks if there is already an entry with the same parentId. This allows
multiple ReturnFieldValues with the same parent to be included in the
results. The method is only called on line 1178 of
edu.ucsb.nceas.metacat.DBQuery in metacat. I've included it below (with
my change).

Do you think this is an appropriate solution? I'll wait to check it
into cvs until I hear back.

Thanks,
-ben

Method starting on line 1404:

/*
 * A method to put key and value in Vector
*/
private void putInArray(Vector parentidList, String key,
ReturnFieldValue value) {
Vector tempVector = null;

// for (int count = 0; count < parentidList.size(); count++) {
// tempVector = (Vector) parentidList.get(count);
//
//
// if (key.compareTo((String) tempVector.get(0)) == 0) {
// tempVector.remove(1);
// tempVector.add(1, value);
// return;
// }
// }

tempVector = new Vector();
tempVector.add(0, key);
tempVector.add(1, value);
parentidList.add(tempVector);
return;
}
Actions #2

Updated by ben leinfelder over 16 years ago

when looking at this fix, it's important to remember to clear out the xml_queryresult table since old results will be cached there.

i've been going one step further and clearing it all out with:

TRUNCATE table xml_returnfield cascade;

the cascade flows into xml_queryresult. it's squeaky clean after that!

Actions #3

Updated by Jing Tao over 16 years ago

<jing> hi, ben
<jing> I took a look and refreshed my memory.
<jing> The reason we did this is before our xml_nodes table only can handle 4000 characters for text data.
<jing> if a text node is more than 4000 characters, we split it into different row in xml_node table.
<jing> So that method will merge the splited node into one.
<jing> Since some old docs in knb production server are still stored in this way, we should keep the method as before.

Actions #4

Updated by Jing Tao over 16 years ago

Talked with ben and he suggested to move to 1.9 release.

Actions #5

Updated by ben leinfelder over 16 years ago

added change to handle ATTRIBUTE nodes differently than TEXT nodes so that all attributes of an element are returned in the resultset document.
also added code to concatenate large text elements that may have been split into separate nodes when stored in the xml_nodes table.
changed files:
metacat/src/edu/ucsb/nceas/metacat/DBQuery.java (rev 1.157)
metacat/src/edu/ucsb/nceas/metacat/QuerySpecification.java (rev 1.90)

Actions #6

Updated by ben leinfelder over 16 years ago

have tested on two local installs of metacat and am happy with what i see.
releasing it into the wild.

Actions #7

Updated by Redmine Admin about 11 years ago

Original Bugzilla ID was 2999

Actions

Also available in: Atom PDF