Commit dd88de65 authored by Tobias Steiner's avatar Tobias Steiner
Browse files

Add better logs

parent 1aa02c30
......@@ -54,7 +54,7 @@ kafka.init().then(() => {
linker.connect(rawData.parsed).then(() => {
next();
}, (error) => {
core.getLogger().error(JSON.stringify(error));
core.getLogger().error('Could not save data to neo4j ' + JSON.stringify(error));
next();
});
});
......
......@@ -25,7 +25,7 @@ export class Linker {
* @param node
* @returns {Result}
*/
newNode(node) {
public newNode(node) {
// todo: from topic!
const provider = 'geonames';
const uri = this.uriBuilder.geoname(node.id);
......@@ -38,7 +38,7 @@ export class Linker {
* Write connection int the db. Create nodes if they do not exists
* @param connection
*/
connect(connection) {
public connect(connection) {
return new Promise( (resolve, reject) => {
let query = `MERGE (o:Place {uri:'${connection.from}'}) `;
connection.to.forEach((current, i) => {
......@@ -46,6 +46,7 @@ export class Linker {
query += ` MERGE (o)-[:${connection.relation.type} {author:'${connection.relation.author}'}]->(t${i}) `;
});
// get a new session
this.logger.info('Try to get a session');
const session = this.driver.session();
this.logger.info('Try to build network');
session.run(query).then(() => {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment