2010-Feb-16 presentation notes

*project rebooted

*JS learning curve not as shallow as I thought

*haven’t been able to be as squared-away as I would prefer

*faceted search now only objective

*still drawing out new plan

-root_set.js: will hold the description of the current set. Will interact with GUI, will report various details of the set

-super_set.js: instances of these will mediate between root_set and the various base_set’s. Will form a binary tree with root_set at the root, base_set’s as leaves. Instances of super_set will be nodes with operators such as booleans (AND, OR, NOT, etc), or restrictions such as “All flares in Set A that are brighter than the median flare brightness in Set A”

-base_set: holds sets that can be represented by the HEK API


/*
* base_set.js
*This is to represent a base set for Diamond faceted search.
*It represents a set of solar events that can be described by a HEK API URL.
*coded by Ian Ruotsala
*/

/*should be able to:
* report various details about the set it reps,
* e.g. count of various events. BUT, what if
* base_set doesn't do much besides hold info,
* and the root set, or super set or whatever
* does most of the work??? Yeah, I think that's
* a better idea, will put that burden on super
* sets and root sets
*--ICR, Feb. 15, 2010
*/

/*well, damn, that means base_set is actually
* very nearly done, just need to check if >200
* events returned
* --ICR, Feb. 15, 2010
*/

//import external .js files for this file to use

function inc(filename)
{
var body = document.getElementsByTagName('body').item(0);
script = document.createElement('script');
script.src = filename;
script.type = 'text/javascript';
body.appendChild(script);
}

inc("json.js");

function base_set(url){
//should I also have an assemble_url???
//no, I'd save that for the root_set --ICR, Feb. 15, 2010
//what if url described over 200 events???

/*probably should just make super set by
* dividing set into two, then ANDing
* them into super set
* --ICR, Feb. 15, 2010
*/

this.url = url;
//I also need to store the JSON
var jsonDoc;
this.update_set = update_set;
this.set_url = set_url;
}

function update_set(){
//send present url to query, update the stored JSON
var httpQuery = new XMLHttpRequest();
httpQuery.open("GET",this.url,false);
httpQuery.send(null);
//this.jsonDoc = eval('(' + httpQuery.responceText + ')');
//eval is generall considered bad practice, security risk
//use parseJSON instead
var returnString = httpQuery.responseText;
//document.write(returnString);
this.jsonDoc = returnString.parseJSON;

//return true if >= 200 events returned
}

function set_url(url_string){
this.url = url_string;
}

function test(){
test_bs = new base_set("test_url");
document.write("foo\n");
document.write(test_bs.url);
document.write("bar");
test_bs.set_url("hek");
document.write(test_bs.url);
document.write("baz");
test_bs.update_set();
document.write("foo1");
//document.write(test_bs.jsonDoc);
//var test_comp = test_bs.jsonDoc.result[0].kb_archivid;
//test_comp
//document.write(test_bs.stringify(test_comp));
//document.write("bar1");

//test to see how many events are gotten
//i.e. how many items in jsonDoc.result?

document.write("bar1");
}

About ruoian27

Computer science student, taking Student Originated Software presently
This entry was posted in Uncategorized and tagged , , . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *