Commit bd34a012 authored by Themousaillon's avatar Themousaillon

preparing nice release

parent 69b4ba19
......@@ -25,7 +25,11 @@
"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"
}
]
],
"filterContent": {
"label": "Summary contains [%hints]",
"hints": ["keywords"]
}
},
"graph2d": {
"queries": {
......
......@@ -19,7 +19,12 @@
"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"
}
]
],
"filterContent": {
"label": "Title contains [%hints]",
"hints": ["keywords"]
}
},
"graph2d": {
......@@ -87,7 +92,7 @@
"names": "sources",
"nodeTypes": ["source"],
"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",
"queries": [
{
......@@ -102,8 +107,8 @@
"sourceQueries": {
"app": {
"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",
"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"
"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, 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 @@
"dateFields": ["startDate", "endDate"]
},
"filterConf": {
"date": {
"filterable": ["source"]
},
"keywords": {
"filterable": ["source"],
"field": "label"
}
},
"additionalFields": [
],
......@@ -230,7 +245,7 @@
"source": {
"name": "source",
"names": "sources",
"properties": ["title", "ext_link", "date", "code"],
"properties": ["title", "ext_link", "date", "code", "content"],
"link": "%ext_link%",
"options" : {
"date": {
......@@ -243,6 +258,14 @@
"show": true,
"link": false,
"unique": false
},
"content": {
"filter": true,
"label": "content",
"type": "text",
"show": false,
"link": false,
"unique": false
},
"title": {
"label": "title",
......
......@@ -37,7 +37,9 @@ class QueryEngine {
return [null, null]
const toDate = (isoNeoDate) => {
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 startDate = rawNode.properties[startDateField] ? toDate(rawNode.properties[startDateField]): null
......@@ -69,7 +71,6 @@ class QueryEngine {
}
this._dbConnector.settings.additionalFields.forEach(
([fieldNameNode, fieldNameDB]) => {
console.log(fieldNameNode, fieldNameDB, rawNode)
if (rawNode.properties[fieldNameDB])
nodeData[fieldNameNode] = rawNode.properties[fieldNameDB]
}
......@@ -133,7 +134,7 @@ class NodeFilters {
* @param endDate sould be a @Date object
*/
filterByDate = (startDate, endDate) => node => {
const filterable = this._settings.filterConf.date.filterable["date"]
const filterable = this._settings.filterConf.date.filterable
if (node.collapsed)
return false
if (filterable.includes(node.type) && node.data["startDate"] && node.data["endDate"])
......@@ -144,7 +145,7 @@ class NodeFilters {
filterByKeywords = keywords => node => {
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]
if (node.collapsed)
return false
......
......@@ -110,7 +110,6 @@ function start(settings, login, password) {
//$('#keyword').focus();
$('').prop('placeholder', settings.keywordSearch.placeholder);
settings.keywordSearch.selection.forEach((s, ind) => {
console.log("index: ")
let o = new Option(s.option, s.layer);
o.nodeTypes = settings.layerTypes.find(x => x.name === s.layer).nodeTypes
o.placeholder = settings.keywordSearch.selection[ind].placeholder
......@@ -262,9 +261,7 @@ function start(settings, login, password) {
$( "#keyword" ).on("input", () =>{
const searchString = $("#keyword")[0].value
const nodeTypes = $("#input-graph-type")[0].selectedOptions[0].nodeTypes
console.log(nodeTypes)
const results = entrySearch.searchLayer(searchString, nodeTypes)
console.log(results)
$("#suggestions").remove()
$("#keyword").append('<datalist id="suggestions">')
$("#keyword").attr("list", "suggestions")
......@@ -366,7 +363,6 @@ function start(settings, login, password) {
}
})
} else {
console.log(app.frame.getGraphsData())
app.generateGraphs(app.frame.getGraphsData(), () => app.frame.emptyCurrentNodes())
// app.generateGraph(name, graphType, idsList, total).then(() => {
// app.frame.emptyCurrentNodes();
......@@ -432,6 +428,12 @@ function start(settings, login, password) {
graph2D.filterGraph();
graph2D.applyFilterToGraph();
})
$("#filter-content").attr("placeholder",
settings.keywordSearch.filterContent.label.replace("%hints" ,settings.keywordSearch.filterContent.hints.join(", ")
))
$("#filter-content").width(300)
return app;
}
......
......@@ -30,14 +30,13 @@ module.exports = class Queries{
}
get(name, params) {
console.log("query name --> ", name)
switch (name) {
case 'keyword':
return this.keyword(params);
case 'graph':
return this.graph(params);
case 'graph2d':
console.log("initialising the 2d graph query ....")
//console.log("initialising the 2d graph query ....")
return this.graph2d(params)
case 'searchTools':
return this.searchTools(params)
......@@ -96,13 +95,13 @@ module.exports = class Queries{
let query = this.settings.graph2d.queries[queryName]
query = query.replace(/%IDS%/g, ids);
query = query.replace(/%CULLS%/g, culls);
console.log("2d graph query : ", query)
//console.log("2d graph query : ", query)
return query
}
searchTools({ queryName }) {
let query = this.settings.searchTools.queries[queryName]
console.log("searchTool : ", query)
//console.log("searchTool : ", query)
return query
}
......
......@@ -278,7 +278,7 @@ module.exports = function () {
if (elem) {
filter["keywords"] = {
type: "content",
keywords: elem.value.split(" ")
keywords: elem.value.split(" ").filter(s => s!== "")
}
}
}
......
......@@ -117,7 +117,9 @@ module.exports = (function () {
};
break;
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:
break;
}
......
......@@ -32,7 +32,6 @@ module.exports = class TimeEstimate {
let json = JSON.stringify(this.data);
let compress = LZString.compressToUTF16(json);
if (compress.length > this.maxSize) {
console.log(this.data, compress, this.maxSize);
this.reduce(1);
this.save();
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