how to use DOACC data in your own application / web site.

Using DOACC with Javascript

Modal presentation example

See the source for details. Jquery fetches the graph, rdflib parses it, picks out all the alts that use BLAKE for a PoW hashing algo, retrieves other facts about the coin, sets the lot in a table and presents via a modal popup.

Loading DOACC data.

How the lists of facts are generated using mashlib.js

The listing is rendered by the mashlib.js library in the browser, working on the AJAX-retrieved DOACC RDF graph. The approach is fairly standard and straightforward. The example below lists all the different protection schemes used.

var RDF = $rdf.Namespace("") var SKOS = $rdf.Namespace("") var DOACC = $rdf.Namespace("") var listout = function() { var op = '<div class="ui segment"><ul>'; var rel = DOACC('ProtectionScheme'); var res = g.each(null, RDF('type'), rel); var n = res.length; for (i = 0; i < n; i++) { ps = res[i]; pv = ps.value; // var rels = g.each(ps, null, null); op += '<li><a href="' + pv + '"> ' + pv.slice(pv.indexOf('#') + 1, pv.length) + '</a> - '; op += '<i>' + g.any(ps, SKOS('prefLabel')) + '</i>, ' + g.any(ps, RDFS('comment')) + '</li>'; }; op += '</ul></div>'; $("#results").html(op) }; var g = $rdf.graph(); var docURI = ""; var fetch = $rdf.fetcher(g); fetch.nowOrWhenFetched(docURI, undefined, function(ok, body, xhr) { // @@ check ok listout() });