Opened 11 years ago

Closed 11 years ago

Last modified 10 years ago

#6991 closed enhancement (fixed)

[patch][cla] New dojox.data.WikipediaStore (plus near-trivial SMD)

Reported by: guest Owned by: Kris Zyp
Priority: high Milestone: 1.2
Component: DojoX Data Version: 1.1.1
Keywords: Cc: revin@…, kris@…, alex
Blocked By: Blocking:

Description

This patch provides two interfaces to Wikipedia:

  • via SMD, for use with dojox.rpc.Service
  • dojox.data.WikipediaStore, for higher level access

The SMD is dead simple; it just lets us talk to the API provided by the MediaWiki software, and does little other parameter checking. It gives us a fairly "raw" interface to the API.

The dojo data store provides two basic operations: 1) retrieve titles of articles containing a given text string, and 2) retrieve details for a page by title. It's basically just a customized dojox.data.ServiceStore, with some extra processing to make it easier to deal with the data returned.

The patch also contains supporting documentation and tests:

  • DOH test suite for the RPC/SMD version
  • A simple page grabber demo for the RPC version
  • DOH test suite for the data store
  • A simple page grabber demo for the data store
  • Patch written & submitted under CLA by Revin Guillen

Attachments (1)

wikipedia-store-and-tests.patch (24.5 KB) - added by guest 11 years ago.
Wikipedia data store & SMD

Download all attachments as: .zip

Change History (13)

comment:1 Changed 11 years ago by kriszyp

I think this looks really cool, a few though though: First, I would think you could use the ServiceStore? paradigm of lazy loading item as instances of dojo.Deferred. If you did this, then I don't think you would need to override isItemLoaded, loadItem, and getValue, ServiceStore? would handle all of those correctly for you. In order to create a Deferred version of the lazy loaded item (that only loads once), I do something like:

for each of the stub/title only items results[i] = dojo.mixin(new dojo.Deferred(),results[i]); create a Deferred object (function(item){

var connectId = dojo.connect(item,"addCallbacks",function(){

dojo.disconnect(connectId); var spec = {

query : item; onItem : dojo.hitch(item,item.callback) };

this.fetch(spec);

});

})(results[i]);

Although seeing the awkwardness of this, perhaps it would be helpful if I provided a "createLazyItem" function in the ServiceStore?, something you could create lazy items with like this:

results[i] = this.createLazyItem(results[i],function(item){

return item; return the query for the fetch

});

Also, your code seems to be begging the ServiceStore? for a labelAttribute property for getLabel and getLabelAttributes :). I can certainly add that.

Last, I wonder if _fixupStarElements is worth it's weight. Is it that bad to write item*? instead of item.data? You can keep it if you want, just doesn't seem worth it to me.

Anyway, I think this looks really great, and thanks for using my ServiceStore?!

comment:2 Changed 11 years ago by kriszyp

Cc: kris@… added

comment:3 Changed 11 years ago by alex

jaredj:

review?

comment:4 Changed 11 years ago by alex

Cc: alex added

comment:5 Changed 11 years ago by guest

Actually, please hold off on the review until I get a second version in; I've been in communication with kriszyp about changing up the ServiceStore? to make this implmentation simpler, so I have a replacement path in development. I'll try to submit it today.

  • Revin

comment:6 Changed 11 years ago by kriszyp

I can take ownership of this since I did the first review with Revin, is that all right?

comment:7 Changed 11 years ago by guest

OK, with Kris' recent changes to the ServiceStore in trunk, we've got a much leaner WikipediaStore in the (newly replaced) attached patch. Have at it.

comment:8 Changed 11 years ago by kriszyp

I have reviewed it and it looks good to me. I can commit it in unless someone else wants to review it as well. Kris

comment:9 Changed 11 years ago by alex

Kris: have at. Please ensure that unit tests have full coverage before committing.

Revin, Kris: nice work = )

comment:10 Changed 11 years ago by alex

Owner: changed from Jared Jurkiewicz to kriszyp

Changed 11 years ago by guest

Wikipedia data store & SMD

comment:11 Changed 11 years ago by Kris Zyp

Resolution: fixed
Status: newclosed

(In [14133]) Wikipedia Store, fixes #6991

comment:12 Changed 10 years ago by bill

Owner: changed from kriszyp to Kris Zyp
Note: See TracTickets for help on using tickets.