I am new to node.js.
I want to use rdfstore module for implementing semantic web in a node.js poroject.
I found this sample code on Github for rdfstore, can anyone explain it
var rdfstore = require('rdfstore');
new rdfstore.Store({persistent:true,
engine:'mongodb',
name:'myappstore', // quads in MongoDB will be stored in a DB named myappstore
overwrite:true, // delete all the data already present in the MongoDB server
mongoDomain:'localhost', // location of the MongoDB instance, localhost by default
mongoPort:27017 // port where the MongoDB server is running, 27017 by default
}, 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")));
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(peopleGraph.toArray()[0].subject.valueOf() === results[0].s.value);
console.log('Getting value...');
console.log(peopleGraph.toArray());
});
});
});
})