Changeset 5305
- Timestamp:
- 2003-08-27T15:18:30+12:00 (21 years ago)
- Location:
- trunk/gli/src/org/greenstone/gatherer
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gli/src/org/greenstone/gatherer/msm/GDMDocument.java
r5164 r5305 77 77 /** Add this metadata to the named file. There is one tricky thing to consider. Whenever a metadata entry is added it is taken to be accumulating except if it is the first added, in which case it overwrites! */ 78 78 public void addMetadata(String filename, Metadata metadata) { 79 ///ystem.err.println("Add '" + metadata + "' to " + (filename != null ? filename : "directory."));79 Gatherer.println("Add '" + metadata + "' to " + (filename != null ? filename : "directory.")); 80 80 try { 81 81 // Retrieve the document element. … … 179 179 metadata_element.setAttribute(MODE_ATTRIBUTE, ACCUMULATE); 180 180 } 181 // As we can't possibly store all the metadata in memory, nor can we ensure that the indexes written to file remain the same until the new time we look at this file, and to avoid having to open a rewrite every collection document whenever any value tree changes, I'm adding a new attribute called hvalue which indicates the hierarchy value path as a '\' separated string.181 // As we can't possibly store all the metadata in memory, nor can we ensure that the indexes written to file remain the same until the new time we look at this file, and to avoid having to open a rewrite every collection document whenever any value tree changes, I'm adding a new attribute called hvalue which indicates the hierarchy value path as a '\\' separated string. 182 182 GValueModel model = Gatherer.c_man.getCollection().msm.getValueTree(metadata.getElement()); 183 183 if(model != null && model.isHierarchy()) { 184 metadata_element.setAttribute(HVALUE_ATTRIBUTE, metadata.getValueNode().getFullPath()); 185 } 186 metadata_element.appendChild(base_document.createTextNode(metadata.getAbsoluteValue())); 184 metadata_element.setAttribute(HVALUE_ATTRIBUTE, metadata.getValueNode().getFullPath(false)); 185 } 186 String node_value = metadata.getAbsoluteValue(); 187 metadata_element.appendChild(base_document.createTextNode(node_value)); 187 188 // Retrieve the first description element for this fileset (there should only be one, but I'll play it safe). 188 189 NodeList description_elements = fileset_element.getElementsByTagName("Description"); … … 298 299 metadata = new Metadata(element, value); 299 300 GDMManager.metadata_cache.put(raw_element, raw_value, metadata); 300 301 ///ystem.err.println("Added metadata to cache: " + raw_element + " -> " + raw_value + "\n"); 301 302 value = null; 302 303 element = null; -
trunk/gli/src/org/greenstone/gatherer/msm/Metadata.java
r5164 r5305 125 125 if(model != null && model.isHierarchy()) { 126 126 if(value != null) { 127 abs_value = value.getFullPath( );127 abs_value = value.getFullPath(false); 128 128 } 129 129 abs_value = model.getHIndex(abs_value); -
trunk/gli/src/org/greenstone/gatherer/msm/MetadataSetManager.java
r5213 r5305 342 342 || (mds.getNamespace().equals(Utility.EXTRACTED_METADATA_NAMESPACE) && mds.getNamespace().equals(HIDDEN) && all)) { 343 343 NodeList set_elements = mds.getElements(); 344 System.err.println("The set " + mds + " has " + set_elements.getLength() + " elements.");344 ///ystem.err.println("The set " + mds + " has " + set_elements.getLength() + " elements."); 345 345 for(int i = 0; i < set_elements.getLength(); i++) { 346 346 Element raw_element = (Element)set_elements.item(i); -
trunk/gli/src/org/greenstone/gatherer/util/HashMap3D.java
r4887 r5305 130 130 } 131 131 element_name = null; 132 133 String value_name = metadata.getValueNode().getFullPath( );132 // Locate the appropriate metadata 133 String value_name = metadata.getValueNode().getFullPath(false); 134 134 result = (Metadata) inner_mapping.get(value_name); 135 135 if(result == null) { -
trunk/gli/src/org/greenstone/gatherer/util/MetadataXML.java
r5174 r5305 157 157 GValueNode node = (GValueNode)all_values.get(i); 158 158 TreePath path = new TreePath(node.getPath()); 159 String value = node.getFullPath( ); // formatPath(null, path, true);159 String value = node.getFullPath(false); 160 160 String index = model.getHIndex(value); 161 161 String alias = node.getAlias(index); 162 if(value.indexOf( "\\") != -1) {163 value = value.substring(value.lastIndexOf( "\\") + 1);162 if(value.indexOf(GValueModel.PATH_SEP) != -1) { 163 value = value.substring(value.lastIndexOf(GValueModel.PATH_SEP) + GValueModel.PATH_SEP.length()); 164 164 } 165 165 write(bw, index + "\t\"" + alias + "\"\t\"" + Utility.stripNL(value) + "\"");
Note:
See TracChangeset
for help on using the changeset viewer.