Skip to content

Instantly share code, notes, and snippets.

@antoniogarrote
Created August 18, 2011 11:28
Show Gist options
  • Save antoniogarrote/1153882 to your computer and use it in GitHub Desktop.
Save antoniogarrote/1153882 to your computer and use it in GitHub Desktop.
var rdfstore = require('./dist/nodejs/index.js');
rdfstore.create(function(store){
store.execute('LOAD <http://dbpedia.org/resource/Tim_Berners-Lee> INTO GRAPH <http://example.org/people>', function() {
store.setPrefix('dbp', 'http://dbpedia.org/resource/');
store.node(store.rdf.resolve('dbp:Tim_Berners-Lee'), "http://example.org/people", function(success, graph) {
var peopleGraph = graph.filter(store.rdf.filters.type(store.rdf.resolve("foaf:Person")));
console.log(peopleGraph);
store.execute('PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>\
PREFIX foaf: <http://xmlns.com/foaf/0.1/>\
PREFIX : <http://example.org/>\
SELECT ?s FROM NAMED :people { GRAPH ?g { ?s rdf:type foaf:Person } }',
function(success, results) {
console.log(results);
console.log(peopleGraph.toArray()[0].subject.valueOf() === results[0].s.value);
});
});
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment