view js/plugintable.js @ 0:06f2747c8d19

Experiment towards dynamic Vamp plugin download list based on RDF descriptions
author Chris Cannam
date Mon, 09 Dec 2013 17:37:25 +0000
parents
children d7c33f47bca2
line wrap: on
line source

$(document).ready(function() {
    
    var parseRdf = function(data) {
	
	var parser = N3.Parser();
	parser.parse(data,
	             function (error, triple, prefixes) {
        		 if (triple) {
			     console.log(triple.subject, triple.predicate, triple.object, '.');
			 }
			 else {
			     console.log("# That's all, folks!", prefixes)
			 }
		     });
    };
    
    var parseIndex = function(data) {
	lines = data.split("\n");
	for (var i = 0; i < lines.length; i++) {
	    var base = lines[i].replace(new RegExp("^.*/"), "");
	    if (base === "" || base === lines[i]) {
	    } else {
		$.get("rdf/plugins/" + base + ".n3", parseRdf, "text");
	    }
	}
    };

    $.get("rdf/plugins/index.txt", parseIndex, "text");
});