Skip to content

Commit

Permalink
Removed file initalization and inserted into OSLC Service
Browse files Browse the repository at this point in the history
  • Loading branch information
Neil-IBM committed Nov 28, 2016
1 parent 36fad66 commit 6dd0e57
Showing 1 changed file with 1 addition and 47 deletions.
48 changes: 1 addition & 47 deletions service.js
Original file line number Diff line number Diff line change
Expand Up @@ -798,54 +798,8 @@ module.exports = function(env) {
console.error("Can't initialize MongoDB.");
return;
}
// create root container if it doesn't exist
db.get(env.ldpBase, function(err, document) {
if (err) {
console.log(err.stack);
return;
}

if (!document || document.deleted) {
createRootContainer(function(err) {
if (err) {
console.log(err.stack);
}
});
}
});

});
return ldpRoutes(db, env);

// creates a root container on first run
function createRootContainer(callback) {
var triples = [{
subject: env.ldpBase,
predicate: rdf.type,
object: ldp.Resource
}, {
subject: env.ldpBase,
predicate: rdf.type,
object: ldp.RDFSource
}, {
subject: env.ldpBase,
predicate: rdf.type,
object: ldp.Container
}, {
subject: env.ldpBase,
predicate: rdf.type,
object: ldp.BasicContainer
}, {
subject: env.ldpBase,
predicate: 'http://purl.org/dc/terms/title',
object: '"LDP.js root container"'
}];

db.put({
name: env.ldpBase,
interactionModel: ldp.BasicContainer,
triples: triples,
deleted: false
}, callback);
}

}

0 comments on commit 6dd0e57

Please sign in to comment.