// requires http://knistr.com/web/js/constants.js


var kurl;
var kcls;

//function classify(url, cls) {
function classify() {
    console.log('classify');
    post_to_url(constants.server + constants.apipath + '/kb/assertCls',
	{
	    s: kurl,
	    cls: Ext.util.JSON.encode(kcls)
	}); 
    setTimeout("alert('ok')", 200);
}

function assertKnistr(url, cls) {
    assert2("http://knistr.com/ontology/Publishing#hasRead", url);
    // these two POSTs work well with an alert in between, but not without ... fix that somehow
    kurl = url;
    kcls = cls;
    //	classify(url, cls);
    setTimeout("classify()", 200); // #TODO: ugly and not robust
}

/* e.g. assertKnistr( 'http://bibbase.org/knistr/2009_Fritz_McIlraith_Computing_Robust_Plans_In_Continuous_Domains', [
   { predicate: { value: 'http://knistr.com/ontology/Publishing#title'}, 
     object: { value: 'Computing Robust Plans in Continuous Domains', type: 'literal'}}, 
   { predicate: { value: 'http://knistr.com/ontology/Publishing#yearPublished'}, 
     object: { value: '2009', type: 'literal'}}, 
   { predicate: { value: 'http://knistr.com/ontology/Publishing#hasAuthor'}, 
     object: { value: 'Christian Fritz', type: 'literal'}},
   { predicate: { value: 'http://knistr.com/ontology/Publishing#hasAuthor'}, 
     object: { value: 'Sheila McIlraith', type: 'literal'}}] 
 );
*/
