Commit bd34a012 authored by Themousaillon's avatar Themousaillon

preparing nice release

parent 69b4ba19
...@@ -25,7 +25,11 @@ ...@@ -25,7 +25,11 @@
"option": "Lemma", "option": "Lemma",
"query": "MATCH (n) WHERE (n.lemma=~ '.*(?i)%KEYWORD%.*') AND NOT id(n) in %CULLS% WITH distinct n as n ORDER BY n.app DESC RETURN id(n) as id, \"lemma\" as type, n.lemma as title, n.app as app" "query": "MATCH (n) WHERE (n.lemma=~ '.*(?i)%KEYWORD%.*') AND NOT id(n) in %CULLS% WITH distinct n as n ORDER BY n.app DESC RETURN id(n) as id, \"lemma\" as type, n.lemma as title, n.app as app"
} }
] ],
"filterContent": {
"label": "Summary contains [%hints]",
"hints": ["keywords"]
}
}, },
"graph2d": { "graph2d": {
"queries": { "queries": {
......
...@@ -19,8 +19,13 @@ ...@@ -19,8 +19,13 @@
"option": "Entity", "option": "Entity",
"query": "MATCH (n:Entity) WHERE (n.name=~ '.*(?i)%KEYWORD%.*') AND NOT id(n) in %CULLS% WITH distinct n as n ORDER BY n.app DESC RETURN id(n) as id, CASE WHEN 'Dacia' in labels(n) THEN 'Dacia' WHEN 'MoesiaInf' in labels(n) THEN 'Moesia Inferior' WHEN 'MoesiaSup' in labels(n) THEN 'Moesia Superior' WHEN 'PannoniaSup' in labels(n) THEN 'Pannonia Superior' WHEN 'Dalmatia' in labels(n) THEN 'Dalmatia' END as type, n.name as title, n.app as app, n.praenomen+' '+n.nomen+' '+n.cognomen +(CASE WHEN n.gender='Male' THEN ', Male' ELSE ', Female' END) +(CASE WHEN n.citizen THEN ' / Citizen' ELSE '' END) +(CASE WHEN n.libertus THEN ' / Libertus' ELSE '' END) +(CASE WHEN n.veteranus THEN ' / Veteranus' ELSE '' END) +(CASE WHEN n.peregrine THEN ' / Peregrine' ELSE '' END) +(CASE WHEN n.slave THEN ' / Slave' ELSE '' END) +(CASE WHEN EXISTS (n.occupation) THEN ' / Occupation: '+n.occupation ELSE '' END) as tooltip" "query": "MATCH (n:Entity) WHERE (n.name=~ '.*(?i)%KEYWORD%.*') AND NOT id(n) in %CULLS% WITH distinct n as n ORDER BY n.app DESC RETURN id(n) as id, CASE WHEN 'Dacia' in labels(n) THEN 'Dacia' WHEN 'MoesiaInf' in labels(n) THEN 'Moesia Inferior' WHEN 'MoesiaSup' in labels(n) THEN 'Moesia Superior' WHEN 'PannoniaSup' in labels(n) THEN 'Pannonia Superior' WHEN 'Dalmatia' in labels(n) THEN 'Dalmatia' END as type, n.name as title, n.app as app, n.praenomen+' '+n.nomen+' '+n.cognomen +(CASE WHEN n.gender='Male' THEN ', Male' ELSE ', Female' END) +(CASE WHEN n.citizen THEN ' / Citizen' ELSE '' END) +(CASE WHEN n.libertus THEN ' / Libertus' ELSE '' END) +(CASE WHEN n.veteranus THEN ' / Veteranus' ELSE '' END) +(CASE WHEN n.peregrine THEN ' / Peregrine' ELSE '' END) +(CASE WHEN n.slave THEN ' / Slave' ELSE '' END) +(CASE WHEN EXISTS (n.occupation) THEN ' / Occupation: '+n.occupation ELSE '' END) as tooltip"
} }
] ],
},
"filterContent": {
"label": "Title contains [%hints]",
"hints": ["keywords"]
}
},
"graph2d": { "graph2d": {
"queries": { "queries": {
...@@ -87,7 +92,7 @@ ...@@ -87,7 +92,7 @@
"names": "sources", "names": "sources",
"nodeTypes": ["source"], "nodeTypes": ["source"],
"nodeSize": "app", "nodeSize": "app",
"graphQuery": "MATCH (r:Source) WHERE id(r) in %IDS% WITH { node:r, resources: collect ({ date: r.startDate, ext_link: r.ext_link }) } as nodeinfo WITH collect(nodeinfo) as nodeinfos UNWIND nodeinfos as ni1 UNWIND nodeinfos as ni2 WITH ni1, ni2, ni1.node as n1, ni2.node as n2 WHERE id(n1) = id(n2) WITH ni1, ni2, 'Source' as type1, 'Source' as type2 WITH { node1: [ { id: id(ni1.node), title: ni1.node.title, type: type1, resources: ni1.resources } ], node2: [ { id: id(ni2.node), title: ni2.node.title, type: type2, resources: ni2.resources } ], resources: collect ( ni1.resources )} as edge RETURN { edges: collect(edge) }", "graphQuery": "MATCH (r:Source) WHERE id(r) in %IDS% WITH { node:r, resources: collect ({ date: r.startDate, ext_link: r.ext_link, content: r.title}) } as nodeinfo WITH collect(nodeinfo) as nodeinfos UNWIND nodeinfos as ni1 UNWIND nodeinfos as ni2 WITH ni1, ni2, ni1.node as n1, ni2.node as n2 WHERE id(n1) = id(n2) WITH ni1, ni2, 'Source' as type1, 'Source' as type2 WITH { node1: [ { id: id(ni1.node), title: ni1.node.title, type: type1, resources: ni1.resources } ], node2: [ { id: id(ni2.node), title: ni2.node.title, type: type2, resources: ni2.resources } ], resources: collect ( ni1.resources )} as edge RETURN { edges: collect(edge) }",
"tableQuery": "MATCH (r:Source) WHERE id(r) in %IDS% WITH distinct r as r ORDER BY r.title DESC RETURN id(r) as id, 'Source' as type, r.title as title, r.app as app", "tableQuery": "MATCH (r:Source) WHERE id(r) in %IDS% WITH distinct r as r ORDER BY r.title DESC RETURN id(r) as id, 'Source' as type, r.title as title, r.app as app",
"queries": [ "queries": [
{ {
...@@ -102,8 +107,8 @@ ...@@ -102,8 +107,8 @@
"sourceQueries": { "sourceQueries": {
"app": { "app": {
"name": "Appearance", "name": "Appearance",
"union": "UNWIND %IDS% as egoid MATCH (r:Source) WHERE id(r) = egoid WITH distinct r as r RETURN r.title as title, r.startDate as date, r.ext_link as ext_link, r.code as code, 'Code: '+r.code+(CASE WHEN EXISTS (r.province) THEN ' / Province: '+r.province ELSE '' END)+(CASE WHEN EXISTS (r.disc_place) THEN ' / DiscPlace: '+r.disc_place ELSE '' END)+(CASE WHEN EXISTS (r.prov_place) THEN ' / ProvPlace: '+r.prov_place ELSE '' END)+(CASE WHEN EXISTS (r.ancient_name) THEN ' / AncientName: '+r.ancient_name ELSE '' END) as tooltip ORDER BY date", "union": "UNWIND %IDS% as egoid MATCH (r:Source) WHERE id(r) = egoid WITH distinct r as r RETURN r.title as title, r.title as content, r.startDate as date, r.ext_link as ext_link, r.code as code, 'Code: '+r.code+(CASE WHEN EXISTS (r.province) THEN ' / Province: '+r.province ELSE '' END)+(CASE WHEN EXISTS (r.disc_place) THEN ' / DiscPlace: '+r.disc_place ELSE '' END)+(CASE WHEN EXISTS (r.prov_place) THEN ' / ProvPlace: '+r.prov_place ELSE '' END)+(CASE WHEN EXISTS (r.ancient_name) THEN ' / AncientName: '+r.ancient_name ELSE '' END) as tooltip ORDER BY date",
"intersection": "UNWIND %PARENTSIDS% as x WITH x, count(x) as c WITH collect(distinct x) as resources MATCH (n)-[:appears_in]->(r) WHERE id(r) in resources AND NOT id(n) in %CULLS% WITH distinct n as n, count(n) as c WHERE c=size(%PARENTSIDS%) ORDER BY n.app DESC RETURN id(n) as id, CASE WHEN 'Dacia' in labels(n) THEN 'Dacia' WHEN 'MoesiaInf' in labels(n) THEN 'Moesia Inferior' WHEN 'MoesiaSup' in labels(n) THEN 'Moesia Superior' WHEN 'PannoniaSup' in labels(n) THEN 'Pannonia Superior' WHEN 'Dalmatia' in labels(n) THEN 'Dalmatia' END as type, n.name as title, n.app as app, n.praenomen+' '+n.nomen+' '+n.cognomen as tooltip ORDER BY n.app DESC" "intersection": "UNWIND %PARENTSIDS% as x WITH x, count(x) as c WITH collect(distinct x) as resources MATCH (n)-[:appears_in]->(r) WHERE id(r) in resources AND NOT id(n) in %CULLS% WITH distinct n as n, count(n) as c WHERE c=size(%PARENTSIDS%) ORDER BY n.app DESC RETURN id(n) as id, n.title as content, CASE WHEN 'Dacia' in labels(n) THEN 'Dacia' WHEN 'MoesiaInf' in labels(n) THEN 'Moesia Inferior' WHEN 'MoesiaSup' in labels(n) THEN 'Moesia Superior' WHEN 'PannoniaSup' in labels(n) THEN 'Pannonia Superior' WHEN 'Dalmatia' in labels(n) THEN 'Dalmatia' END as type, n.name as title, n.app as app, n.praenomen+' '+n.nomen+' '+n.cognomen as tooltip ORDER BY n.app DESC"
} }
} }
} }
...@@ -151,6 +156,16 @@ ...@@ -151,6 +156,16 @@
"dateFields": ["startDate", "endDate"] "dateFields": ["startDate", "endDate"]
}, },
"filterConf": {
"date": {
"filterable": ["source"]
},
"keywords": {
"filterable": ["source"],
"field": "label"
}
},
"additionalFields": [ "additionalFields": [
], ],
...@@ -230,7 +245,7 @@ ...@@ -230,7 +245,7 @@
"source": { "source": {
"name": "source", "name": "source",
"names": "sources", "names": "sources",
"properties": ["title", "ext_link", "date", "code"], "properties": ["title", "ext_link", "date", "code", "content"],
"link": "%ext_link%", "link": "%ext_link%",
"options" : { "options" : {
"date": { "date": {
...@@ -244,6 +259,14 @@ ...@@ -244,6 +259,14 @@
"link": false, "link": false,
"unique": false "unique": false
}, },
"content": {
"filter": true,
"label": "content",
"type": "text",
"show": false,
"link": false,
"unique": false
},
"title": { "title": {
"label": "title", "label": "title",
"type": "text", "type": "text",
......
...@@ -37,7 +37,9 @@ class QueryEngine { ...@@ -37,7 +37,9 @@ class QueryEngine {
return [null, null] return [null, null]
const toDate = (isoNeoDate) => { const toDate = (isoNeoDate) => {
const [year, month, day] = [isoNeoDate.year.low, isoNeoDate.month.low, isoNeoDate.day.low] const [year, month, day] = [isoNeoDate.year.low, isoNeoDate.month.low, isoNeoDate.day.low]
return new Date(year, month, day) let date = new Date(year, month, day)
date.setFullYear(year)
return date
} }
const [startDateField, endDateField] = this._dbConnector.settings.fieldNames.dateFields const [startDateField, endDateField] = this._dbConnector.settings.fieldNames.dateFields
const startDate = rawNode.properties[startDateField] ? toDate(rawNode.properties[startDateField]): null const startDate = rawNode.properties[startDateField] ? toDate(rawNode.properties[startDateField]): null
...@@ -69,7 +71,6 @@ class QueryEngine { ...@@ -69,7 +71,6 @@ class QueryEngine {
} }
this._dbConnector.settings.additionalFields.forEach( this._dbConnector.settings.additionalFields.forEach(
([fieldNameNode, fieldNameDB]) => { ([fieldNameNode, fieldNameDB]) => {
console.log(fieldNameNode, fieldNameDB, rawNode)
if (rawNode.properties[fieldNameDB]) if (rawNode.properties[fieldNameDB])
nodeData[fieldNameNode] = rawNode.properties[fieldNameDB] nodeData[fieldNameNode] = rawNode.properties[fieldNameDB]
} }
...@@ -133,7 +134,7 @@ class NodeFilters { ...@@ -133,7 +134,7 @@ class NodeFilters {
* @param endDate sould be a @Date object * @param endDate sould be a @Date object
*/ */
filterByDate = (startDate, endDate) => node => { filterByDate = (startDate, endDate) => node => {
const filterable = this._settings.filterConf.date.filterable["date"] const filterable = this._settings.filterConf.date.filterable
if (node.collapsed) if (node.collapsed)
return false return false
if (filterable.includes(node.type) && node.data["startDate"] && node.data["endDate"]) if (filterable.includes(node.type) && node.data["startDate"] && node.data["endDate"])
...@@ -144,7 +145,7 @@ class NodeFilters { ...@@ -144,7 +145,7 @@ class NodeFilters {
filterByKeywords = keywords => node => { filterByKeywords = keywords => node => {
const filterable = this._settings.filterConf.keywords.filterable const filterable = this._settings.filterConf.keywords.filterable
const filterField = this._settings.filter.keywords.field const filterField = this._settings.filterConf.keywords.field
const content = filterField === "label" ? node.label: node.data[filterField] const content = filterField === "label" ? node.label: node.data[filterField]
if (node.collapsed) if (node.collapsed)
return false return false
......
...@@ -110,7 +110,6 @@ function start(settings, login, password) { ...@@ -110,7 +110,6 @@ function start(settings, login, password) {
//$('#keyword').focus(); //$('#keyword').focus();
$('').prop('placeholder', settings.keywordSearch.placeholder); $('').prop('placeholder', settings.keywordSearch.placeholder);
settings.keywordSearch.selection.forEach((s, ind) => { settings.keywordSearch.selection.forEach((s, ind) => {
console.log("index: ")
let o = new Option(s.option, s.layer); let o = new Option(s.option, s.layer);
o.nodeTypes = settings.layerTypes.find(x => x.name === s.layer).nodeTypes o.nodeTypes = settings.layerTypes.find(x => x.name === s.layer).nodeTypes
o.placeholder = settings.keywordSearch.selection[ind].placeholder o.placeholder = settings.keywordSearch.selection[ind].placeholder
...@@ -262,9 +261,7 @@ function start(settings, login, password) { ...@@ -262,9 +261,7 @@ function start(settings, login, password) {
$( "#keyword" ).on("input", () =>{ $( "#keyword" ).on("input", () =>{
const searchString = $("#keyword")[0].value const searchString = $("#keyword")[0].value
const nodeTypes = $("#input-graph-type")[0].selectedOptions[0].nodeTypes const nodeTypes = $("#input-graph-type")[0].selectedOptions[0].nodeTypes
console.log(nodeTypes)
const results = entrySearch.searchLayer(searchString, nodeTypes) const results = entrySearch.searchLayer(searchString, nodeTypes)
console.log(results)
$("#suggestions").remove() $("#suggestions").remove()
$("#keyword").append('<datalist id="suggestions">') $("#keyword").append('<datalist id="suggestions">')
$("#keyword").attr("list", "suggestions") $("#keyword").attr("list", "suggestions")
...@@ -366,7 +363,6 @@ function start(settings, login, password) { ...@@ -366,7 +363,6 @@ function start(settings, login, password) {
} }
}) })
} else { } else {
console.log(app.frame.getGraphsData())
app.generateGraphs(app.frame.getGraphsData(), () => app.frame.emptyCurrentNodes()) app.generateGraphs(app.frame.getGraphsData(), () => app.frame.emptyCurrentNodes())
// app.generateGraph(name, graphType, idsList, total).then(() => { // app.generateGraph(name, graphType, idsList, total).then(() => {
// app.frame.emptyCurrentNodes(); // app.frame.emptyCurrentNodes();
...@@ -432,6 +428,12 @@ function start(settings, login, password) { ...@@ -432,6 +428,12 @@ function start(settings, login, password) {
graph2D.filterGraph(); graph2D.filterGraph();
graph2D.applyFilterToGraph(); graph2D.applyFilterToGraph();
}) })
$("#filter-content").attr("placeholder",
settings.keywordSearch.filterContent.label.replace("%hints" ,settings.keywordSearch.filterContent.hints.join(", ")
))
$("#filter-content").width(300)
return app; return app;
} }
......
...@@ -30,14 +30,13 @@ module.exports = class Queries{ ...@@ -30,14 +30,13 @@ module.exports = class Queries{
} }
get(name, params) { get(name, params) {
console.log("query name --> ", name)
switch (name) { switch (name) {
case 'keyword': case 'keyword':
return this.keyword(params); return this.keyword(params);
case 'graph': case 'graph':
return this.graph(params); return this.graph(params);
case 'graph2d': case 'graph2d':
console.log("initialising the 2d graph query ....") //console.log("initialising the 2d graph query ....")
return this.graph2d(params) return this.graph2d(params)
case 'searchTools': case 'searchTools':
return this.searchTools(params) return this.searchTools(params)
...@@ -96,13 +95,13 @@ module.exports = class Queries{ ...@@ -96,13 +95,13 @@ module.exports = class Queries{
let query = this.settings.graph2d.queries[queryName] let query = this.settings.graph2d.queries[queryName]
query = query.replace(/%IDS%/g, ids); query = query.replace(/%IDS%/g, ids);
query = query.replace(/%CULLS%/g, culls); query = query.replace(/%CULLS%/g, culls);
console.log("2d graph query : ", query) //console.log("2d graph query : ", query)
return query return query
} }
searchTools({ queryName }) { searchTools({ queryName }) {
let query = this.settings.searchTools.queries[queryName] let query = this.settings.searchTools.queries[queryName]
console.log("searchTool : ", query) //console.log("searchTool : ", query)
return query return query
} }
......
...@@ -278,7 +278,7 @@ module.exports = function () { ...@@ -278,7 +278,7 @@ module.exports = function () {
if (elem) { if (elem) {
filter["keywords"] = { filter["keywords"] = {
type: "content", type: "content",
keywords: elem.value.split(" ") keywords: elem.value.split(" ").filter(s => s!== "")
} }
} }
} }
......
...@@ -117,7 +117,9 @@ module.exports = (function () { ...@@ -117,7 +117,9 @@ module.exports = (function () {
}; };
break; break;
case 'content': case 'content':
return f.keywords === "" ? true : f.keywords.every(keyword => resource.content.toLowerCase().includes(keyword.toLowerCase())) if (!resource.content)
return true
return f.keywords.length === 0 ? true : f.keywords.every(keyword => resource.content.toLowerCase().includes(keyword.toLowerCase()))
default: default:
break; break;
} }
......
...@@ -32,7 +32,6 @@ module.exports = class TimeEstimate { ...@@ -32,7 +32,6 @@ module.exports = class TimeEstimate {
let json = JSON.stringify(this.data); let json = JSON.stringify(this.data);
let compress = LZString.compressToUTF16(json); let compress = LZString.compressToUTF16(json);
if (compress.length > this.maxSize) { if (compress.length > this.maxSize) {
console.log(this.data, compress, this.maxSize);
this.reduce(1); this.reduce(1);
this.save(); this.save();
return; return;
......
Markdown is supported
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