Created
August 18, 2011 11:28
-
-
Save antoniogarrote/1153882 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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