<commit_before>// Sparql stuffs
var SparqlClient = require('sparql-client');
var util = require('util');


// Mongodb connector
var mongoose = require('mongoose');
mongoose.connect('mongodb://localhost/maniak');

// load up the book model
var Book = require('./app/models/book');

// load up the user model
var User = require('./app/models/user');
var bcrypt   = require('bcrypt-nodejs');


// Query dbpedia for some books
var endpoint = 'http://dbpedia.org/sparql';

var query = "SELECT   ?title ?pages ?published ?genreName ?isbn ?resume  (SAMPLE(?authorName) AS ?authorName) WHERE {?book a dbpedia-owl:Book . ?book dbpedia-owl:abstract ?resume . ?book dbpedia-owl:isbn ?isbn . ?book dbpedia-owl:numberOfPages ?pages. ?book dbpprop:releaseDate ?published. ?book dbpedia-owl:literaryGenre ?genre . ?genre dbpprop:name ?genreName. ?book dbpprop:name ?title. ?book dbpedia-owl:author ?author. ?author dbpprop:name ?authorName filter(langMatches(lang(?resume),'en')) } group by ?title ?pages ?published ?genreName ?isbn ?resume ";

var client = new SparqlClient(endpoint);
	client.query(query)
	  .execute(function(error, results) {

	  	for (i in results.results.bindings)
		{

			 var newBook = new Book();
			 // console.log(results.results.bindings[i][i].title.value);
			 newBook.title = results.results.bindings[i].title.value;
		  	 newBook.isbn = results.results.bindings[i].isbn.value;
		  	 newBook.author = results.results.bindings[i].authorName.value;
		  	 newBook.published = results.results.bindings[i].published.value;
		  	 newBook.pages = results.results.bindings[i].pages.value;
		  	 newBook.nb_copy = Math.floor(Math.random() * 15) + 1;
		  	 newBook.resume = results.results.bindings[i].resume.value;
		  	 newBook.genre = results.results.bindings[i].genreName.value;


		  	 newBook.save(function(err) {
	                            if (err)
	                               // console.log(err);
	         });
		}




	  	});


// Create an admin account
var newUser = new User()

newUser.name  = "Infomaniak";
newUser.email = "<EMAIL>";
newUser.password = bcrypt.hashSync("<PASSWORD>", bcrypt.genSaltSync(8), null);


newUser.save(
		function  (err) {<commit_msg>password hash<commit_after>// Sparql stuffs
var SparqlClient = require('sparql-client');
var util = require('util');


// Mongodb connector
var mongoose = require('mongoose');
mongoose.connect('mongodb://localhost/maniak');

// load up the book model
var Book = require('./app/models/book');

// load up the user model
var User = require('./app/models/user');
var bcrypt   = require('bcrypt-nodejs');


// Query dbpedia for some books
var endpoint = 'http://dbpedia.org/sparql';

var query = "SELECT   ?title ?pages ?published ?genreName ?isbn ?resume  (SAMPLE(?authorName) AS ?authorName) WHERE {?book a dbpedia-owl:Book . ?book dbpedia-owl:abstract ?resume . ?book dbpedia-owl:isbn ?isbn . ?book dbpedia-owl:numberOfPages ?pages. ?book dbpprop:releaseDate ?published. ?book dbpedia-owl:literaryGenre ?genre . ?genre dbpprop:name ?genreName. ?book dbpprop:name ?title. ?book dbpedia-owl:author ?author. ?author dbpprop:name ?authorName filter(langMatches(lang(?resume),'en')) } group by ?title ?pages ?published ?genreName ?isbn ?resume ";

var client = new SparqlClient(endpoint);
	client.query(query)
	  .execute(function(error, results) {

	  	for (i in results.results.bindings)
		{

			 var newBook = new Book();
			 // console.log(results.results.bindings[i][i].title.value);
			 newBook.title = results.results.bindings[i].title.value;
		  	 newBook.isbn = results.results.bindings[i].isbn.value;
		  	 newBook.author = results.results.bindings[i].authorName.value;
		  	 newBook.published = results.results.bindings[i].published.value;
		  	 newBook.pages = results.results.bindings[i].pages.value;
		  	 newBook.nb_copy = Math.floor(Math.random() * 15) + 1;
		  	 newBook.resume = results.results.bindings[i].resume.value;
		  	 newBook.genre = results.results.bindings[i].genreName.value;


		  	 newBook.save(function(err) {
	                            // if (err)
	                               // console.log(err);
	         });
		}




	  	});


// Create an admin account
var newUser = new User()

newUser.name  = "Infomaniak";
newUser.email = "<EMAIL>";
newUser.password = <PASSWORD>("<PASSWORD>", bcrypt.genSaltSync(8), null);


newUser.save(
		function  (err) {
{'fraction_non_alphanumeric': 0.14864864864864866, 'fraction_numerical': 0.0018323408153916628, 'mean_word_length': 3.5775681341719077, 'pattern_counts': {'":': 0, '<': 8, '<?xml version=': 0, '>': 8, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2849873', 'n_tokens_mistral': 1556, 'n_tokens_neox': 1449, 'n_words': 303}