From: Tim L. <guy...@gm...> - 2012-12-19 11:04:17
|
On 17 Dec 2012, at 20:17, Enno Borgsteede wrote: >> <design 2> Depending on what exactly you want to get, it may be >> simpler >> instead to loop through all citations. From each citation, it is >> simple to >> get the associated source (of which there will be only one). As you >> go, >> build a python dictionary keyed by the source handle with the value >> being a >> list of the citations. > > I assume that the source citation tree view uses a mechanism like > that. Is that right? I tried to read through that part of the source > code, and was surprised that I didn't find any function call to > retrieve citations for a source, but now that you explained things, > it is more clear to me. Anyway, the report is like that view, > including the source and citation notes that are not visible in the > view itself. > > When we go further than a prototype, I can imagine that a report may > use the same sorts of filters that can be applied to the view, so I > think I need to spend some more time with that view anyway. I wouldn't use the views as a model for the code for a report. The code for the views is very complex, because it relies on so much other code, and the code is very specialised. I would look at other reports instead. If you want to look at filtering, then one possible example to look at would be the export code, for example the XML export. > >> You can then loop through the dictionary, outputting the required >> information about the source and then the citations. >> >> (The problem with this might be if you are concerned about >> performance, for >> example because you have a very very large number of citation - but >> with >> modern technology, this might not be very critical). > > When I think about the time it takes to initialize the view, I don't > think that this will be a big problem. Well yes, but the view is displaying every object. If you are only trying to report some objects, then the aim would surely be to have the performance related to the number of object you are actually reporting (if that is possible!) |