Commit abf2b592 authored by delanoe's avatar delanoe

Merge branch 'romain-reintegration-graphExplorer' into anoe-graph

parents 6578f6d4 e04e0b51
94eb7bdf57557b72dcd1b93a42af044b pubmed.zip
......@@ -21,9 +21,8 @@ import gargantext.views.pages.urls
from annotations import urls as annotations_urls
from annotations.views import main as annotations_main_view
# Module "Graph Explorer"
#from graphExplorer import urls as graphExplorer_urls
import graphExplorer.urls
# Module for graph service
import graph.urls
# Module Scrapers
import moissonneurs.urls
......@@ -35,8 +34,8 @@ urlpatterns = [ url(r'^admin/' , admin.site.urls )
, url(r'^favicon.ico$', Redirect.as_view( url=static.url('favicon.ico')
, permanent=False), name="favicon")
# Module "Graph Explorer"
, url(r'^' , include( graphExplorer.urls ) )
# Module Graph
, url(r'^' , include( graph.urls ) )
# Module Annotation
# tempo: unchanged doc-annotations routes --
......
......@@ -127,12 +127,15 @@ def normalize_terms(term_str, do_lowercase=DEFAULT_ALL_LOWERCASE_FLAG):
(benefits from normalize_chars upstream so there's less cases to consider)
"""
term_str = sub(r'^[-",;/%(){}\\\[\]\.\']+', '', term_str)
term_str = sub(r'[-",;/%(){}\\\[\]\.\']+$', '', term_str)
# print('normalize_terms IN: "%s"' % term_str)
term_str = sub(r'^[-",;/%(){}\\\[\]\.\' ]+', '', term_str)
term_str = sub(r'[-",;/%(){}\\\[\]\.\' ]+$', '', term_str)
if do_lowercase:
term_str = term_str.lower()
# print('normalize_terms OUT: "%s"' % term_str)
return term_str
......
......@@ -8,7 +8,7 @@ from re import sub
def parse(corpus):
try:
documents_count = 0
corpus.status('Docs', progress=0)
# will gather info about languages
......@@ -86,6 +86,7 @@ def normalize_chars(my_str):
ou passer en lowercase, seront à placer plutôt *après* le tagger,
cf. toolchain.ngrams_extraction.normalize_terms)
"""
# print('normalize_chars IN: "%s"' % my_str)
# --------------
# E S P A C E S
# --------------
......@@ -121,12 +122,12 @@ def normalize_chars(my_str):
# Guillemets
# ----------
# la plupart des quotes simples --> ' APOSTROPHE
my_str = sub(r"‘’‚`‛", "'", my_str) # U+2018 U+2019 U+201a U+201b
my_str = sub(r"[‘’‚`‛]", "'", my_str) # U+2018 U+2019 U+201a U+201b
my_str = sub(r'‹ ?',"'", my_str) # U+2039 plus espace éventuel après
my_str = sub(r' ?›',"'", my_str) # U+203A plus espace éventuel avant
# la plupart des quotes doubles --> " QUOTATION MARK
my_str = sub(r'“”„‟', '"', my_str) # U+201C U+201D U+201E U+201F
my_str = sub(r'[“”„‟]', '"', my_str) # U+201C U+201D U+201E U+201F
my_str = sub(r'« ?', '"', my_str) # U+20AB plus espace éventuel après
my_str = sub(r' ?»', '"', my_str) # U+20AB plus espace éventuel avant
......@@ -178,4 +179,6 @@ def normalize_chars(my_str):
my_str = sub(r'Ꜩ', 'Tz', my_str)
my_str = sub(r'ꜩ', 'tz', my_str)
# print('normalize_chars OUT: "%s"' % my_str)
return my_str
......@@ -4,7 +4,7 @@ from . import nodes
from . import metrics
from . import ngramlists
from . import analytics
from graphExplorer.rest import Graph
from graph.rest import Graph
urlpatterns = [ url(r'^nodes$' , nodes.NodeListResource.as_view() )
, url(r'^nodes/(\d+)$' , nodes.NodeResource.as_view() )
......@@ -59,11 +59,11 @@ urlpatterns = [ url(r'^nodes$' , nodes.NodeListResource.as_view()
, url(r'^ngramlists/maplist$' , ngramlists.MapListGlance.as_view() )
# fast access to maplist, similarly formatted for termtable
, url(r'^projects/(\d+)/corpora/(\d+)/explorer$' , Graph.as_view())
# data for graph explorer (json)
# GET /api/projects/43198/corpora/111107/explorer?
# Corresponding view is : /projects/43198/corpora/111107/explorer?
# Parameters (example):
# Parameters (example):
# explorer?field1=ngrams&field2=ngrams&distance=conditional&bridgeness=5&start=1996-6-1&end=2002-10-5
]
......@@ -13,13 +13,12 @@ def filterByBridgeness(G,partition,ids,weight,bridgeness,type,field1,field2):
nodesB_dict = {}
for node_id in G.nodes():
#node,type(labels[node])
G.node[node_id]['pk'] = ids[node_id][1]
nodesB_dict [ ids[node_id][1] ] = True
# TODO the query below is not optimized (do it do_distance).
the_label = session.query(Ngram.terms).filter(Ngram.id==node_id).first()
the_label = ", ".join(the_label)
G.node[node_id]['label'] = the_label
G.node[node_id]['size'] = weight[node_id]
G.node[node_id]['type'] = ids[node_id][0].replace("ngrams","terms")
G.node[node_id]['attributes'] = { "clust_default": partition[node_id]} # new format
......@@ -31,7 +30,7 @@ def filterByBridgeness(G,partition,ids,weight,bridgeness,type,field1,field2):
if bridgeness > 0:
com_link = defaultdict(lambda: defaultdict(list))
com_ids = defaultdict(list)
for k, v in partition.items():
com_ids[v].append(k)
......@@ -39,14 +38,14 @@ def filterByBridgeness(G,partition,ids,weight,bridgeness,type,field1,field2):
s = e[0]
t = e[1]
weight = G[ids[s][1]][ids[t][1]]["weight"]
if bridgeness < 0:
info = { "s": ids[s][1]
, "t": ids[t][1]
, "w": weight
}
links.append(info)
else:
if partition[s] == partition[t]:
......@@ -55,11 +54,11 @@ def filterByBridgeness(G,partition,ids,weight,bridgeness,type,field1,field2):
, "w": weight
}
links.append(info)
if bridgeness > 0:
if partition[s] < partition[t]:
com_link[partition[s]][partition[t]].append((s,t,weight))
if bridgeness > 0:
for c1 in com_link.keys():
for c2 in com_link[c1].keys():
......
......@@ -2,7 +2,7 @@ from gargantext.models import Node, NodeNgram, NodeNgramNgram, \
NodeHyperdata
from gargantext.util.db import session, aliased
from graphExplorer.louvain import best_partition
from graph.louvain import best_partition
from copy import copy
from collections import defaultdict
......
......@@ -5,22 +5,9 @@ from gargantext.util.http import JsonHttpResponse
from gargantext.models import Node, Ngram, NodeNgram, NodeNgramNgram
#from gargantext.util.toolchain.ngram_coocs import compute_coocs
from graphExplorer.cooccurrences import countCooccurrences, filterMatrix
from graphExplorer.distances import clusterByDistances
from graphExplorer.bridgeness import filterByBridgeness
# Prelude lib
from copy import copy, deepcopy
from collections import defaultdict
from sqlalchemy.orm import aliased
# Math/Graph lib
import math
import pandas as pd
import numpy as np
import networkx as nx
from graph.cooccurrences import countCooccurrences, filterMatrix
from graph.distances import clusterByDistances
from graph.bridgeness import filterByBridgeness
def get_graph( request=None , corpus=None
, test= False
......@@ -90,17 +77,25 @@ def get_graph( request=None , corpus=None
after_cooc = datetime.now()
print("... Cooccurrences took %f s." % (after_cooc - before_cooc).total_seconds())
G, partition, ids, weight = clusterByDistances ( cooc_matrix
, field1="ngrams", field2="ngrams"
, distance=distance
)
after_cluster = datetime.now()
print("... Clustering took %f s." % (after_cluster - after_cooc).total_seconds())
# case when 0 coocs are observed (usually b/c not enough ngrams in maplist)
if len(cooc_matrix.items) == 0:
print("GET_GRAPH: 0 coocs in matrix")
data = {'nodes':[], 'links':[]} # empty data
# normal case
else:
G, partition, ids, weight = clusterByDistances ( cooc_matrix
, field1="ngrams", field2="ngrams"
, distance=distance
)
after_cluster = datetime.now()
print("... Clustering took %f s." % (after_cluster - after_cooc).total_seconds())
data = filterByBridgeness(G,partition,ids,weight,bridgeness,type,field1,field2)
data = filterByBridgeness(G,partition,ids,weight,bridgeness,type,field1,field2)
after_filter = datetime.now()
print("... Filtering took %f s." % (after_filter - after_cluster).total_seconds())
after_filter = datetime.now()
print("... Filtering took %f s." % (after_filter - after_cluster).total_seconds())
return data
......@@ -2,10 +2,51 @@
from gargantext.util.db import session
from gargantext.models.nodes import Node
from graphExplorer.graph import get_graph
from graph.graph import get_graph
from gargantext.util.http import APIView, APIException\
, JsonHttpResponse, requires_auth
from traceback import format_tb
def compress_graph(graphdata):
"""
graph data is usually a dict with 2 slots:
"nodes": [{"id":4103, "type":"terms", "attributes":{"clust_default": 0}, "size":29, "label":"regard"},...]
"links": [{"t": 998,"s": 768,"w": 0.0425531914893617},...]
To send this data over the net, this function can reduce a lot of its size:
- keep less decimals for float value of each link's weight
- use shorter names for node properties (eg: s/clust_default/cl/)
result format:
"nodes": [{"id":4103, "at":{"cl": 0}, "s":29, "lb":"regard"},...]
"links": [{"t": 998,"s": 768,"w": 0.042},...]
"""
for link in graphdata['links']:
link['w'] = format(link['w'], '.3f') # keep only 3 decimals
for node in graphdata['nodes']:
node['lb'] = node['label']
del node['label']
node['at'] = node['attributes']
del node['attributes']
node['at']['cl'] = node['at']['clust_default']
del node['at']['clust_default']
node['s'] = node['size']
del node['size']
if node['type'] == "terms":
# its the default type for our format: so we don't need it
del node['type']
else:
node['t'] = node['type']
del node['type']
return graphdata
# TODO check authentication
class Graph(APIView):
......@@ -19,28 +60,28 @@ class Graph(APIView):
graph?field1=ngrams&field2=ngrams&
graph?field1=ngrams&field2=ngrams&start=''&end=''
'''
# Get the node we are working with
corpus = session.query(Node).filter(Node.id==corpus_id).first()
# Get all the parameters in the URL
cooc_id = request.GET.get ('cooc_id' , None )
field1 = str(request.GET.get ('field1' , 'ngrams' ))
field2 = str(request.GET.get ('field2' , 'ngrams' ))
start = request.GET.get ('start' , None )
end = request.GET.get ('end' , None )
mapList_id = int(request.GET.get ('mapList' , 0 ))
groupList_id = int(request.GET.get ('groupList' , 0 ))
threshold = int(request.GET.get ('threshold' , 1 ))
bridgeness = int(request.GET.get ('bridgeness', -1 ))
format_ = str(request.GET.get ('format' , 'json' ))
type_ = str(request.GET.get ('type' , 'node_link' ))
distance = str(request.GET.get ('distance' , 'conditional'))
# Get default value if no map list
if mapList_id == 0 :
......@@ -50,10 +91,11 @@ class Graph(APIView):
)
.first()
)
mapList_id = mapList_id[0]
if mapList_id == None :
# todo add as an error msg ?
raise ValueError("MAPLIST node needed for cooccurrences")
......@@ -65,23 +107,23 @@ class Graph(APIView):
)
.first()
)
groupList_id = groupList_id[0]
if groupList_id == None :
# todo add as an error msg ?
raise ValueError("GROUPLIST node needed for cooccurrences")
# Chec the options
# Check the options
accepted_field1 = ['ngrams', 'journal', 'source', 'authors']
accepted_field2 = ['ngrams', ]
options = ['start', 'end', 'threshold', 'distance', 'cooc_id' ]
# Test function
if field1 in accepted_field1 :
if field2 in accepted_field2 :
try:
# Test params
if (field1 in accepted_field1) and (field2 in accepted_field2):
if start is not None and end is not None :
data = get_graph( corpus=corpus, cooc_id = cooc_id
#, field1=field1 , field2=field2
......@@ -97,12 +139,34 @@ class Graph(APIView):
, distance = distance
, bridgeness = bridgeness
)
if format_ == 'json':
return JsonHttpResponse(data)
else:
# Test data length
if len(data['nodes']) > 0 and len(data['links']) > 0:
# normal case --------------------------------
if format_ == 'json':
return JsonHttpResponse(
compress_graph(data),
status=200
)
# --------------------------------------------
else:
# empty data case
return JsonHttpResponse({
'msg': '''Empty graph warning
No cooccurences found in this corpus for the words of this maplist
(maybe add more terms to the maplist?)''',
}, status=400)
else:
# parameters error case
return JsonHttpResponse({
'msg': '''Usage warning
Please choose only one field from each range:
- "field1": %s
- "field2": %s
- "options": %s''' % (accepted_field1, accepted_field2, options)
}, status=400)
# for any other errors that we forgot to test
except Exception as e:
return JsonHttpResponse({
'Warning USAGE' : 'One field for each range:'
, 'field1' : accepted_field1
, 'field2' : accepted_field2
, 'options': options
})
'msg' : 'Unknown error (showing the trace):\n%s' % "\n".join(format_tb(e.__traceback__))
}, status=400)
from django.conf.urls import patterns, url
# Module "Graph Explorer"
from graphExplorer.rest import Graph
from graphExplorer.views import explorer, myGraphs
from graphExplorer.intersection import intersection
from graph.rest import Graph
from graph.views import explorer, myGraphs
from graph.intersection import intersection
# TODO : factor urls
......
......@@ -44,13 +44,12 @@ RUN apt-get update && apt-get install -y \
postgresql-server-dev-9.5 libpq-dev libxml2 \
libxml2-dev xml-core libgfortran-5-dev \
virtualenv python3-virtualenv \
python3.4 python3.4-dev \
python3.5 python3.5-dev \
python3.5 python3-dev \
python3-six python3-numpy python3-setuptools \
# ^for numpy, pandas
python3-numexpr \
# ^ for numpy performance
libxml2-dev libxslt-dev
libxml2-dev libxslt-dev
# ^ for lxml
#libxslt1-dev zlib1g-dev
......@@ -75,3 +74,7 @@ RUN python3-pip install -r /srv/gargantex/install/python/requirements.txt
#in docker database
#RUN sed -iP 's%^data_directory.*%data_directory = '\/srv\/gargantext_data'%' /etc/postgresql/9.5/main/postgresql.conf
######################################################################
#INSTALLATION AND CONFIG python and postgresql module
COPY . /install
CMD [./install/python/configure, ./install/postgres/configure]
###########################################################
# ____ ____ _____ __ ___ #
# / ___| __ _ _ __ / ___| __ _ _ _|_ _|__\ \/ / |_ #
# | | _ / _` | '__| | _ / _` | '_ \| |/ _ \\ /| __| #
# | |_| | (_| | | | |_| | (_| | | | | | __// \| |_ #
# \____|\__,_|_| \____|\__,_|_| |_|_|\___/_/\_\\__| #
# #
###########################################################
# https://docs.docker.com/compose/django/
######################################################################
FROM debian:stretch
#FROM gargantext
MAINTAINER ISCPIF <alexandre.delanoe@iscpif.fr>
######################################################################
USER root
RUN apt-get update && \
apt-get install -y \
apt-utils ca-certificates locales man dialog\
sudo aptitude gcc g++ wget git postgresql-9.5 vim
### Configure timezone and locale
RUN echo "Europe/Paris" > /etc/timezone && \
dpkg-reconfigure -f noninteractive tzdata && \
sed -i -e 's/# en_GB.UTF-8 UTF-8/en_GB.UTF-8 UTF-8/' /etc/locale.gen && \
sed -i -e 's/# fr_FR.UTF-8 UTF-8/fr_FR.UTF-8 UTF-8/' /etc/locale.gen && \
echo 'LANG="fr_FR.UTF-8"' > /etc/default/locale && \
dpkg-reconfigure --frontend=noninteractive locales && \
update-locale LANG=fr_FR.UTF-8
### Install Database, main dependencies and Python
### (installing some Debian version before pip to get dependencies)
RUN apt-get update && apt-get install -y \
postgresql-server-dev-9.5 libpq-dev libxml2 \
libxml2-dev xml-core libgfortran-5-dev \
virtualenv python3-virtualenv \
python3.4 python3.4-dev \
python3.5 python3.5-dev \
python3-six python3-numpy python3-setuptools \
# ^for numpy, pandas
python3-numexpr \
# ^ for numpy performance
libxml2-dev libxslt-dev \
# ^ for lxml
bzip2
# ^ for the Gargantext librairies
### PROD VERSION OF GARGANTEXT ONLY
#RUN apt-get install -y uwsgi nginx uwsgi-plugin-python rabbitmq-server
#
## ## CREATE USER and adding it to sudo
## ## TODO ask user for password
RUN adduser --disabled-password --gecos "" gargantua
RUN apt-get install -y sudo && adduser gargantua sudo \
&& echo '%sudo ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers
#####################################################################
# CONFIGURE POSTGRESQL
#####################################################################
RUN sed -iP "s%^data_directory.*%data_directory = \'\/srv\/gargantext_data\'%" /etc/postgresql/9.5/main/postgresql.conf
#####################################################################
COPY . /install
CMD [./install/python/configure, ./install/posgres/configure, sudo pip install virtualenvwrapper]
#!/bin/bash
#######################################################################
# ____ _
# | _ \ ___ ___| | _____ _ __
# | | | |/ _ \ / __| |/ / _ \ '__|
# | |_| | (_) | (__| < __/ |
# |____/ \___/ \___|_|\_\___|_|
#
######################################################################
sudo docker build -t gargantext .
# OR
# cd /tmp
# wget http://dl.gargantext.org/gargantext_docker_image.tar \
# && sudo docker import - gargantext:latest < gargantext_docker_image.tar
/srv/gargantext_lib/js/libs
\ No newline at end of file
......@@ -1357,7 +1357,7 @@ function SelectPage(boxType, boxElem) {
// console.log("data became:" + newColumnSelection)
$("tbody tr").each(function (i, row) {
$("table#my-ajax-table tbody tr").each(function (i, row) {
var ngramId = $(row).attr("ngram-id") ;
// a cache to restore previous states if unchecked
......@@ -1374,6 +1374,7 @@ function SelectPage(boxType, boxElem) {
AjaxRecords[ngramId]["state"] = AjaxRecords[ngramId]["state_buff"] ;
AjaxRecords[ngramId]["state_buff"] = null ;
}
});
// OK update this table page
......
Remarques sur l'intégration de tina
===================================
### Pour info: procédure suivie
Je copie ici les 2 commandes utilisées pour rendre visible comment a été faite la fusion du git de tina dans celui de garg.
Grace à cette méthode, quand on clonera le dépot gargantext, on obtiendra aussi les contenus du dépôt tina dans notre sous-dossier **`static/lib/graphExplorer`**.
**NB**
Il n'est pas nécessaire de refaire cette procédure, dorénavant les fichiers restent là dans le sous-dossier.
1. on a ajouté le dépôt extérieur de graphExplorer comme si c'était une remote normale
```
git remote add dependancy_graphExplorer_garg https://gogs.iscpif.fr/humanities/graphExplorer_garg
```
2. on a lancé la commande `subtree` avec cette remote, pour récupérer le dépôt tina et le placer dans garg dans le dossier indiqué par l'option `prefix`
```
git subtree add --prefix=static/lib/graphExplorer dependancy_graphExplorer_garg master
```
Résultat:
```
# git fetch dependancy_graphExplorer_garg master
# (...)
# Receiving objects: 100% (544/544), 1.72 MiB | 0 bytes/s, done.
# Resolving deltas: 100% (307/307), done.
# From https://gogs.iscpif.fr/humanities/graphExplorer_garg
# * branch master -> FETCH_HEAD
# * [new branch] master -> dependancy_graphExplorer_garg/master
# Added dir 'static/lib/graphExplorer'
```
3. au passage la même commande a aussi créé le commit suivant dans ma branche gargantext
```
# commit b8d7f061f8c236bad390eb968d153fd6729b7434
# Merge: 3bfb707 d256049
# Author: rloth <romain.loth@iscpif.fr>
# Date: Thu Jul 7 16:01:46 2016 +0200
#
# Add 'static/lib/graphExplorer/' from commit 'd256049'
```
(ici le commit *d256049* indique le point où en était le dépôt tina quand il a été copié)
### Utilisation en développement quotidien
Il n'y a plus rien de particulier à faire. Le dossier contient les éléments de tina qui nous sont nécessaires. On peut ignorer l'existence du subtree et travailler normalement, dans ce dossier et ailleurs.
**=> nos opérations de commit / pull quotidiennes ne sont pas affectées**
Il n'est pas non plus nécessaire de prendre en compte la présence ou l'absence de la "remote" (lien extérieur) dans son travail.
### Utilisation avancée: pour propager les résultats entre dépôts
A présent le dépôt tina peut être vu comme une sorte de dépôt upstream circonscrit à un seul sous-dossier **`static/lib/graphExplorer`** !
Mais si des changements interviennent dans le dépôt tina, ils ne seront pas automatiquement intégrés dans sa copie intégrée à garg. Pour opérer des A/R entre les dépôts le plus simple est une 1ère fois d'ajouter le même pointeur extérieur :
```
git remote add dependancy_graphExplorer_garg https://gogs.iscpif.fr/humanities/graphExplorer_garg
```
A partir de là, il devient très simple de faire des opérations push/pull entre dépôts si besoin est..
1. Récupération de mises à jour tina => garg.
Pour intégrer des changements upstream de tina vers garg, il suffit de lancer la commande suivante:
```
git subtree pull --prefix=static/lib/graphExplorer dependancy_graphExplorer_garg master --squash
```
2. Inversement, les changements effectués dans le dossier **`static/lib/graphExplorer`** par les développeurs garg peuvent aussi être poussés du dépôt garg vers le dépôt tina par un subtree push
```
git subtree push --prefix=static/lib/graphExplorer dependancy_graphExplorer_garg master
```
<?php
header('Content-Type: application/json');
include("DirectoryScanner.php");
$projectFolderPat = dirname(dirname(getcwd())) . "/";
$instance = new scanTree($projectFolderPat);
$instance->getDirectoryTree("data");
//pr(var_dump($instance->folders));
$output = array();
$output["folders"] = $instance->folders;
$output["gexf_idfolder"] = $instance->gexf_folder;
echo json_encode($output);
// ** Debug Functions: **
function br() {
echo "----------<br>";
}
function pr($msg) {
echo $msg . "<br>";
}
?>
<?php
class scanTree {
public $root;
public $folders = array();
public $gexf_folder = array();
public function __construct($rootpath = "") {
$this->root = $rootpath;
}
public function getDirectoryTree($dir) {
$folder = array();
$dbs = array();
$gexfs = array();
$dataFolder = $this->root . $dir;
$files = scandir($dataFolder);
foreach ($files as $f) {
if ($f != "." and $f != ".." and $f[strlen($f) - 1] != "~") {
if (is_dir($dataFolder . "/" . $f)) {
//pr("Dir: ".$f);
$subfolder = $f;
$this->getDirectoryTree($dir . "/" . $subfolder);
} else {
//pr("File: ".$f);
if ((strpos($f, '.gexf')))
array_push($gexfs, $f);
if ((strpos($f, '.db')) or (strpos($f, '.sqlite')) or (strpos($f, '.sqlite3')))
array_push($dbs, $f);
if (!$folder[$dir]["gexf"] or !$folder[$dir]["dbs"])
$folder[$dir] = array();
$folder[$dir]["gexf"] = $gexfs;
$folder[$dir]["dbs"] = $dbs;
if ((strpos($f, '.gexf'))) {
$this->gexf_folder[$dir . "/" . $f] = "";
}
}
}
}
if ($folder[$dir]["gexf"]) {
foreach ($folder[$dir]["gexf"] as $g) {
$this->gexf_folder[$dir . "/" . $g] = count($this->folders);
}
}
array_push($this->folders, $folder);
}
}
?>
<?php
echo 'toto';
?>
\ No newline at end of file
<?php
// default informations
$thedb = $graphdb;
$gexf=$_GET["gexf"];
$max_item_displayed=6;
$type = $_GET["type"];
$TITLE="ISITITLE";
$query = str_replace( '__and__', '&', $_GET["query"] );
$elems = json_decode($query);
$table = "";
$column = "";
$id="";
$twjs="API_CNRS/"; // submod path of TinaWebJS
if($type=="social"){
$table = "ISIAUTHOR";
$column = "data";
$id = "id";
$restriction='';
$factor=10;// factor for normalisation of stars
}
if($type=="semantic"){
$table = $_GET["index"];//"ISItermsfirstindexing";
$column = "data";
$id = "id";
$restriction='';
$factor=10;
}
$restriction='';
$factor=10;
$sql="";
//////////
if (count($elems)==1){// un seul mot est sélectionné, on compte les mots multiples
$sql = 'SELECT count(*),'.$id.'
FROM '.$table.' where (';
foreach($elems as $elem){
$sql.=' '.$column.'="'.$elem.'" OR ';
}
#$querynotparsed=$sql;#####
$sql = substr($sql, 0, -3);
$sql = str_replace( ' & ', '" OR '.$column.'="', $sql );
$sql.=')'.$restriction.'
GROUP BY '.$id.'
ORDER BY count('.$id.') DESC
LIMIT 1000';
}else{// on compte une seule fois un mot dans un article
$factor=ceil(count($elems)/5); //les scores sont moins haut
$sql='';
foreach($elems as $elem){
$sql.=' '.$column.'="'.$elem.'" OR ';
}
$sql=substr($sql, 0, -3);
$sql='SELECT count(*),id,data FROM (SELECT *
FROM '.$table.' where ('.$sql.')'.$restriction.'
group by id,data) GROUP BY '.$id.'
ORDER BY count('.$id.') DESC
LIMIT 1000';
}
$wos_ids = array();
$sum=0;
// echo "<br>";
// echo "$sql";
//The final query!
// array of all relevant documents with score
foreach ($base->query($sql) as $row) {
// on pondère le score par le nombre de termes mentionnés par l'article
//$num_rows = $result->numRows();
$wos_ids[$row[$id]] = $row["count(*)"];
$sum = $row["count(*)"] +$sum;
}
// /// nombre de document associés $related
$total_count=0;
$count_max=500;
$number_doc=count($wos_ids);
$count=0;
$all_terms_from_selected_projects=array();// list of terms for the top 6 project selected
// to filter under some conditions
$to_display=true;
$count=0;
foreach ($wos_ids as $id => $score) {
if ($total_count<$count_max) {
// retrieve publication year
if ($to_display){
$total_count+=1;
if ($count<=$max_item_displayed){
$count+=1;
$sql = 'SELECT data FROM ISITITLE WHERE id='.$id.' group by data';
foreach ($base->query($sql) as $row) {
$external_link="<a href=http://google.com/webhp?#q=".urlencode('"'.$row['data'].'"')." target=blank>".' <img width=15px src="'.$twjs.'img/google.png"></a>';
$output.="<li title='".$score."'>";
$output.=$external_link.imagestar($score,$factor,$twjs).' ';
$output.='<a href="JavaScript:newPopup(\''.$twjs.'default_doc_details.php?gexf='.urlencode($gexf).'&index='.$table.'&query='.urlencode($query).'&type='.urlencode($_GET["type"]).'&id='.$id.' \')">'.$row['data']." </a> ";
// echo '<a href="JavaScript:newPopup(\''.$twjs.'default_doc_details.php?gexf='.urlencode($gexf).'&index='.$table.'&query='.urlencode($query).'&type='.urlencode($_GET["type"]).'&id='.$id.' \')">'.$row['data']." </a> ";
}
// get the authors
$sql = 'SELECT data FROM ISIAUTHOR WHERE id='.$id;
foreach ($base->query($sql) as $row) {
$output.=($row['data']).', ';
}
$output = rtrim($output, ", ");
$output.="</li><br>";
}
}
} else{
continue;
}
}
if ($total_count<$count_max){
$related .= $total_count;
}else{
$related .= ">".$count_max;
}
$output .= "</ul>"; #####
// // if (($project_folder=='nci')&&(count($elems)<$max_selection_size)){
// // // for NCI we compare the impact and novelty score making the difference if there are more than 4 terms selected
// // $news='';//new terms
// // $terms_from_selected_projects=array_unique($all_terms_from_selected_projects);
// // if(count($terms_from_selected_projects)>3){
// // $diff=array();
// // foreach ($terms_from_selected_projects as $key => $term) {
// // $sql= "select count(*),ISIterms.id, ISIterms.data from ISIterms join ISIpubdate on (ISIterms.id=ISIpubdate.id AND ISIpubdate.data=2011 AND ISIterms.data='".$term."') group by ISIterms.data";
// // $nov=0;
// // foreach ($corporadb->query($sql) as $row) {
// // $nov=$row['count(*)'];
// // }
// // $sql= "select count(*),ISIterms.id, ISIterms.data from ISIterms join ISIpubdate on (ISIterms.id=ISIpubdate.id AND ISIpubdate.data=2012 AND ISIterms.data='".$term."') group by ISIterms.data";
// // $imp=0;
// // foreach ($corporadb->query($sql) as $row) {
// // $imp=$row['count(*)'];
// // }
// // $diff[$term]=info($nov,$imp); //positive si c'est un term novelty, negatif si c'est un terme impact.
// // //echo $term.'-nov: '.$nov.'- imp:'.$imp.'<br/>';//'-info'.$diff[$term].
// // }
// // if (true){
// // arsort($diff);
// // $res=array_keys($diff);
// // //echo implode(', ', $res);
// // $nov_string='';
// // for ($i=0;$i<$top_displayed;$i++){
// // // on récupère les titres du document qui a le plus for impact
// // $sql="SELECT ISIterms.id,ISIC1_1.data,count(*) from ISIterms,ISIpubdate,ISIC1_1 where ISIterms.data='".$res[$i]."' AND ISIterms.id=ISIpubdate.id AND ISIterms.id=ISIC1_1.id AND ISIpubdate.data='2011' group by ISIterms.id ORDER BY RANDOM() limit 1";
// // //on récupère les id associés.
// // foreach ($corporadb->query($sql) as $row){
// // $sql2='SELECT ISIpubdate.id,ISIC1_1.data from ISIpubdate,ISIC1_1 where ISIC1_1.data="'.$row['data'].'" AND ISIpubdate.id=ISIC1_1.id AND ISIpubdate.data="2013" limit 1';
// // //echo $sql2;
// // foreach ($corporadb->query($sql2) as $row2){
// // $nov_string.='<a href="JavaScript:newPopup(\''.$twjs.'php/default_doc_details.php?db='.urlencode($graphdb).'&gexf='.urlencode($gexf).'&query='.urlencode('["'.$res[$i].'"]').'&type='.urlencode($_GET["type"]).'&id='.$row2['id'].' \')">'.$res[$i]."</a>, ";
// // }
// // }
// // }
// // $news.='<br/><b><font color="#FF0066">Top '.$top_displayed.' Novelty related terms </font></b>'.$nov_string.'<br/>';
// // asort($diff);
// // $res=array_keys($diff);
// // $res_string='';
// // for ($i=0;$i<$top_displayed;$i++){
// // // on récupère les titres du document qui a le plus for impact
// // $sql="SELECT ISIterms.id,ISIC1_1.data,count(*) from ISIterms,ISIpubdate,ISIC1_1 where ISIterms.data='".$res[$i]."' AND ISIterms.id=ISIpubdate.id AND ISIterms.id=ISIC1_1.id AND ISIpubdate.data='2012' group by ISIterms.id ORDER BY RANDOM()limit 1";
// // //on récupère les id associés.
// // foreach ($corporadb->query($sql) as $row){
// // $sql2='SELECT ISIpubdate.id,ISIC1_1.data from ISIpubdate,ISIC1_1 where ISIC1_1.data="'.$row['data'].'" AND ISIpubdate.id=ISIC1_1.id AND ISIpubdate.data="2013" limit 1';
// // //echo $sql2;
// // foreach ($corporadb->query($sql2) as $row2){
// // $res_string.='<a href="JavaScript:newPopup(\''.$twjs.'php/default_doc_details.php?db='.urlencode($graphdb).'&gexf='.urlencode($gexf).'&query='.urlencode('["'.$res[$i].'"]').'&type='.urlencode($_GET["type"]).'&id='.$row2['id'].' \')">'.$res[$i]."</a>, ";
// // }
// // }
// // }
// // $news.='<br/><b><font color="#CF5300">Top '.$top_displayed.' Impact related terms: </font></b>'.$res_string.'<br/>';
// // }
// // }
// // }
// // display the most occuring terms when only one is selected.
// //elseif (count($elems)==1) {// on affiche les voisins
// // $terms_array=array();
// // $id_sql='SELECT ISIterms.id FROM ISIterms where ISIterms.data="'.$elems[0].'" group by id';
// // foreach ($base->query($id_sql) as $row_id) {
// // $sql2='SELECT ISIterms.data FROM ISIterms where ISIterms.id='.$row_id['id'];
// // foreach ($base->query($sql2) as $row_terms) {
// // if ($terms_array[$row_terms['data']]>0){
// // $terms_array[$row_terms['data']]=$terms_array[$row_terms['data']]+1;
// // }else{
// // $terms_array[$row_terms['data']]=1;
// // }
// // }
// // }
// // natsort($terms_array);
// // $terms_list=array_keys(array_slice($terms_array,-11,-1));
// // foreach ($terms_list as $first_term) {
// // $related_terms.=$first_term.', ';
// // }
// // $news.='<br/><b><font color="#CF5300">Related terms: </font></b>'.$related_terms.'<br/>';
// //}
// calculate binomial coefficient
function binomial_coeff($n, $k) {
$j = $res = 1;
if($k < 0 || $k > $n)
return 0;
if(($n - $k) < $k)
$k = $n - $k;
while($j <= $k) {
$res *= $n--;
$res /= $j++;
}
return $res;
}
function imagestar($score,$factor,$twjs) {
// produit le html des images de score
$star_image = '';
if ($score > .5) {
$star_image = '';
for ($s = 0; $s < min(5,$score/$factor); $s++) {
$star_image.='<img src="'.$twjs.'img/star.gif" border="0" >';
}
} else {
$star_image.='<img src="'.$twjs.'img/stargrey.gif" border="0">';
}
return $star_image;
}
if($max_item_displayed>$related) $max_item_displayed=$related;
echo $news.'<br/><h4><font color="#0000FF"> Full text of top '.$max_item_displayed.'/'.$related.' related publications:</font></h4>'.$output;
//pt - 301 ; 15.30
?>
<?php
include('parameters_details.php');
$db = $gexf_db[$gexf];
$base = new PDO("sqlite:../" .$db);
$query = str_replace( '__and__', '&', $_GET["query"] );
$terms_of_query = json_decode($query);
// echo "mainpath: ".$mainpath."<br>";
// echo "thedb: ".$db."<br>";
// echo "thequery: ".var_dump($terms_of_query);
echo '
<html>
<head>
<meta charset="utf-8" />
<title>Document details</title>
<link rel="stylesheet" href="js/jquery-ui.css" />
<script src="js/jquery-1.9.1.js"></script>
<script src="js/jquery-ui.js"></script>
<script>
$(function() {
$( "#tabs" ).tabs({
collapsible: true
});
});
</script>
</head>
<body>
<div id="tabs">
<ul>
<li><a href="#tabs-1">Selected Document</a></li>
<li><a href="full_doc_list.php?'.'gexf='.urlencode($gexf).'&query='.urlencode($_GET["query"]).'&type='.urlencode($_GET["type"]).'">Full list</a></li>';
echo '</ul>';
echo '<div id="tabs-1">';
$id=$_GET["id"];
// //$elems = json_decode($query);
// $sql = 'SELECT data FROM ISIkeyword WHERE id='.$id;
// foreach ($base->query($sql) as $row) {
// $country=$CC[strtoupper($row['data'])];
// }
$sql = 'SELECT data FROM ISITITLE WHERE id='.$id.' group by data';
foreach ($base->query($sql) as $row) {
$output.='<h2>'.$row['data'].'</h2>';
$find.="<br/><a href=http://google.com/webhp?q=".urlencode('"'.$row['data'].'"')." target='blank'>[ Search on the web ] </a>";
}
// get the authors
$sql = 'SELECT data FROM ISIAUTHOR WHERE id='.$id;
foreach ($base->query($sql) as $row) {
$output.='<i>'.($row['data']).'</i>, ';
}
$output = rtrim($output, ", ");
// // // get the company
// // $sql = 'SELECT data FROM ISIC1_1 WHERE id='.$id;
// // foreach ($base->query($sql) as $row) {
// //$output.=' - '.substr($row['data'],3,strlen( $row['data'])).' ';
// //}
// get the date
$sql = 'SELECT data FROM ISIpubdate WHERE id='.$id;
foreach ($base->query($sql) as $row) {
$output.=' ('.$row['data'].') ';
}
// // get the country
// $sql = 'SELECT data FROM ISIkeyword WHERE id='.$id;
// foreach ($base->query($sql) as $row) {
// $country=$CC[strtoupper($row['data'])];
// $output.=strtoupper($country).'<br/> ';
// }
// // get the date
if(strpos($_GET["index"],'terms') ) $sql = 'SELECT data FROM '.$_GET["index"].' WHERE id='.$id;
else $sql = 'SELECT data FROM ISItermsListV1 WHERE id='.$id;
$output.='<br/><b>Keywords: </b>';
$terms=array();
foreach ($base->query($sql) as $row) {
$terms[]=$row['data'];
}
natsort($terms);
$terms=array_unique($terms); // liste des termes de l'article
$keywords='';
foreach ($terms as $key => $value) {
$keywords.=$value.', ';
}
foreach ($terms_of_query as $key => $value) {
$keywords=str_replace($value,'<font color="green"><b> '.$value.'</b></font>',$keywords);
}
foreach (array_diff($terms,$terms_of_query) as $key => $value) {
$keywords=str_ireplace($value,'<font color="#800000"> '.$value.'</font>',$keywords);
}
$output.='<p align="justify">'.$keywords.'</p>';
// // get the website
$sql = 'SELECT data FROM ISISO WHERE id='.$id;
foreach ($base->query($sql) as $row) {
$output.='<b>Journal: </b>'.$row['data'].'<br/> ';
}
$sql = 'SELECT data FROM ISIABSTRACT WHERE id='.$id;
// echo $output."<br>";
$abs="";
foreach ($base->query($sql) as $row) {
$abs.=". ".$row['data'];
}
$abs=str_replace('ISSUES:' ,'<br/><br/><b>Issues:</b>',$abs);
$abs=str_replace('INTENDED IMPACT:' ,'<br/><br/><b>Intended impact:</b>',$abs);
$abs=str_replace('IMPACT:' ,'<br/><br/><b>Impact:</b>',$abs);
$abs=str_replace('NOVELTY:' ,'<br/><br/><b>Novelty:</b>',$abs);
$abs=str_replace('BOLD INNOVATION:' ,'<br/><br/><b>Bold innovation:</b>',$abs);
$abs=str_replace('SOCIAL PROBLEM:' ,'<br/><br/><b>Social problem:</b>',$abs);
// solving encoding pb
$abs=str_replace('―', ' ', $abs);
$abs=str_replace('‟‟', ' ', $abs);
$abs=str_replace('„‟', ' ', $abs);
$abs=str_replace('_x000D_', ' ', $abs);
$abs=str_replace('•', ' ', $abs);
$abs=str_replace('’', '\'', $abs);
foreach ($terms_of_query as $key => $value) {
$abs=str_ireplace($value,'<font color="green"><b> '.$value.'</b></font>',$abs);
}
foreach (array_diff($terms,$terms_of_query) as $key => $value) {
$abs=str_ireplace($value,'<font color="#800000"> '.$value.'</font>',$abs);
}
$output.='<br/><p align="justify"><b>Abstract : </b><i>'.$abs.' </i></p>';
$output.="<br>";
echo $output.$find;
echo '</div>';
//echo '<div id="tabs-2">
// <p><strong>Click this tab again to close the content pane.</strong></p>
// <p>Morbi tincidunt, dui sit amet facilisis feugiat, odio metus gravida ante, ut pharetra massa metus id nunc. Duis scelerisque molestie turpis. Sed fringilla, massa eget luctus malesuada, metus eros molestie lectus, ut tempus eros massa ut dolor. Aenean aliquet fringilla sem. Suspendisse sed ligula in ligula suscipit aliquam. Praesent in eros vestibulum mi adipiscing adipiscing. Morbi facilisis. Curabitur ornare consequat nunc. Aenean vel metus. Ut posuere viverra nulla. Aliquam erat volutpat. Pellentesque convallis. Maecenas feugiat, tellus pellentesque pretium posuere, felis lorem euismod felis, eu ornare leo nisi vel felis. Mauris consectetur tortor et purus.</p>
// </div>';
echo '</div>';
function pt($string){
// juste pour afficher avec retour à la ligne
echo $string."<br/>";
}
function pta($array){
print_r($array);
echo '<br/>';
}
?>
<?php
include('parameters_details.php');
$db = $gexf_db[$gexf];
$base = new PDO("sqlite:../" ."data/terrorism/data.db");
$query = str_replace( '__and__', '&', $_GET["query"] );
$terms_of_query = json_decode($query);
// echo "mainpath: ".$mainpath."<br>";
// echo "thedb: ".$db."<br>";
// echo "thequery: ".var_dump($terms_of_query);
echo '
<html>
<head>
<meta charset="utf-8" />
<title>Document details</title>
<link rel="stylesheet" href="js/jquery-ui.css" />
<script src="js/jquery-1.9.1.js"></script>
<script src="js/jquery-ui.js"></script>
<script>
$(function() {
$( "#tabs" ).tabs({
collapsible: true
});
});
</script>
</head>
<body>
<div id="tabs">
<ul>
<li><a href="#tabs-1">Selected Document</a></li>
<li><a href="full_doc_list2.php?'.'gexf='.urlencode($gexf).'&query='.urlencode($_GET["query"]).'&type='.urlencode($_GET["type"]).'">Full list</a></li>';
echo '</ul>';
echo '<div id="tabs-1">';
$id=$_GET["id"];
// //$elems = json_decode($query);
// $sql = 'SELECT data FROM ISIkeyword WHERE id='.$id;
// foreach ($base->query($sql) as $row) {
// $country=$CC[strtoupper($row['data'])];
// }
$sql = 'SELECT data FROM ID WHERE id='.$id.' group by data';
foreach ($base->query($sql) as $row) {
$output.='<h2>Project Identification: '.$row['data'].'</h2>';
}
$sql = 'SELECT data FROM TI WHERE id='.$id.' group by data';
foreach ($base->query($sql) as $row) {
$output.='<h2>'.$row['data'].'</h2>';
$find.="<br/><a href=http://google.com/webhp?q=".urlencode('"'.$row['data'].'"')." target='blank'>[ Search on the web ] </a>";
}
// get the authors
$sql = 'SELECT data FROM PI WHERE id='.$id;
foreach ($base->query($sql) as $row) {
$output.='<i>'.($row['data']).'</i>, ';
}
$output = rtrim($output, ", ");
// // // get the company
// // $sql = 'SELECT data FROM ISIC1_1 WHERE id='.$id;
// // foreach ($base->query($sql) as $row) {
// //$output.=' - '.substr($row['data'],3,strlen( $row['data'])).' ';
// //}
$output.=' (2014) ';
// // get the country
// $sql = 'SELECT data FROM ISIkeyword WHERE id='.$id;
// foreach ($base->query($sql) as $row) {
// $country=$CC[strtoupper($row['data'])];
// $output.=strtoupper($country).'<br/> ';
// }
// // get the date
// $sql = 'SELECT data FROM '."ISItermsBigWL".' WHERE id='.$id;
$sql = 'SELECT data FROM ISItermsfirstindexing WHERE id='.$id;
$output.='<br/><b>Keywords: </b>';
$terms=array();
foreach ($base->query($sql) as $row) {
$terms[]=$row['data'];
}
natsort($terms);
$terms=array_unique($terms); // liste des termes de l'article
$keywords='';
foreach ($terms as $key => $value) {
$keywords.=$value.', ';
}
foreach ($terms_of_query as $key => $value) {
$keywords=str_replace($value,'<font color="green"><b> '.$value.'</b></font>',$keywords);
}
foreach (array_diff($terms,$terms_of_query) as $key => $value) {
$keywords=str_ireplace($value,'<font color="#800000"> '.$value.'</font>',$keywords);
}
$output.='<p align="justify">'.$keywords.'</p>';
// // get the website
$sql = 'SELECT data FROM AG1 WHERE id='.$id;
foreach ($base->query($sql) as $row) {
$output.='<b>Agency: </b>'.$row['data'].'<br/> ';
}
$sql = 'SELECT data FROM ABS WHERE id='.$id;
// echo $output."<br>";
$abs="";
foreach ($base->query($sql) as $row) {
$abs.=". ".$row['data'];
}
$abs=str_replace('ISSUES:' ,'<br/><br/><b>Issues:</b>',$abs);
$abs=str_replace('INTENDED IMPACT:' ,'<br/><br/><b>Intended impact:</b>',$abs);
$abs=str_replace('IMPACT:' ,'<br/><br/><b>Impact:</b>',$abs);
$abs=str_replace('NOVELTY:' ,'<br/><br/><b>Novelty:</b>',$abs);
$abs=str_replace('BOLD INNOVATION:' ,'<br/><br/><b>Bold innovation:</b>',$abs);
$abs=str_replace('SOCIAL PROBLEM:' ,'<br/><br/><b>Social problem:</b>',$abs);
// solving encoding pb
$abs=str_replace('―', ' ', $abs);
$abs=str_replace('‟‟', ' ', $abs);
$abs=str_replace('„‟', ' ', $abs);
$abs=str_replace('_x000D_', ' ', $abs);
$abs=str_replace('•', ' ', $abs);
$abs=str_replace('’', '\'', $abs);
foreach ($terms_of_query as $key => $value) {
$abs=str_ireplace($value,'<font color="green"><b> '.$value.'</b></font>',$abs);
}
foreach (array_diff($terms,$terms_of_query) as $key => $value) {
$abs=str_ireplace($value,'<font color="#800000"> '.$value.'</font>',$abs);
}
$output.='<br/><p align="justify"><b>Abstract : </b><i>'.$abs.' </i></p>';
$output.="<br>";
echo $output.$find;
echo '</div>';
//echo '<div id="tabs-2">
// <p><strong>Click this tab again to close the content pane.</strong></p>
// <p>Morbi tincidunt, dui sit amet facilisis feugiat, odio metus gravida ante, ut pharetra massa metus id nunc. Duis scelerisque molestie turpis. Sed fringilla, massa eget luctus malesuada, metus eros molestie lectus, ut tempus eros massa ut dolor. Aenean aliquet fringilla sem. Suspendisse sed ligula in ligula suscipit aliquam. Praesent in eros vestibulum mi adipiscing adipiscing. Morbi facilisis. Curabitur ornare consequat nunc. Aenean vel metus. Ut posuere viverra nulla. Aliquam erat volutpat. Pellentesque convallis. Maecenas feugiat, tellus pellentesque pretium posuere, felis lorem euismod felis, eu ornare leo nisi vel felis. Mauris consectetur tortor et purus.</p>
// </div>';
echo '</div>';
function pt($string){
// juste pour afficher avec retour à la ligne
echo $string."<br/>";
}
function pta($array){
print_r($array);
echo '<br/>';
}
?>
<?php
$db= $_GET["db"];//I receive the specific database as string!
$terms_of_query=json_decode($_GET["query"]);
include('parameters_details.php');
$base = new PDO("sqlite:" .$mainpath.$db);
$query=$_GET["query"];
$gexf=$_GET["gexf"];
$max_tag_could_size=15;
$output = "<ul>"; // string sent to the javascript for display
$type = $_GET["type"];
$sql='SELECT id from favorites';
$wos_ids=array(); // favorite list
$num_favorite=0;
$count=0;
foreach ($base->query($sql) as $row){
$wos_ids[$row['id']] = 1;
$num_favorite+=1;
}
$favorite_keywords=array();
foreach ($wos_ids as $id => $score) {
if ($count<1000){
// retrieve publication year
$sql = 'SELECT data FROM ISIpubdate WHERE id='.$id;
foreach ($base->query($sql) as $row) {
$pubdate=$row['data'];
}
$count+=1;
$output.="<li >";
$sql = 'SELECT data FROM ISItermsListV1 WHERE id='.$id;
foreach ($base->query($sql) as $row) {
if (array_key_exists($row['data'], $favorite_keywords)){
$favorite_keywords[$row['data']]=$favorite_keywords[$row['data']]+1;
}else{
$favorite_keywords[$row['data']]=1;
}
}
$sql = 'SELECT data FROM ISITITLE WHERE id='.$id;
foreach ($base->query($sql) as $row) {
$output.='<a href="default_doc_details.php?db='.urlencode($db).'&type='.urlencode($_GET["type"]).'&query='.urlencode($query).'&id='.$id.'">'.$row['data']." </a> ";
//this should be the command:
//$output.='<a href="JavaScript:newPopup(\''.$twjs.'php/default_doc_details.php?db='.urlencode($datadb).'&id='.$id.' \')">'.$row['data']." </a> ";
//the old one:
//$output.='<a href="JavaScript:newPopup(\''.$twjs.'php/default_doc_details.php?id='.$id.' \')">'.$row['data']." </a> ";
$external_link="<a href=http://scholar.google.com/scholar?q=".urlencode('"'.$row['data'].'"')." target=blank>".' <img width=20px src="img/gs.png"></a>';
//$output.='<a href="JavaScript:newPopup(''php/doc_details.php?id='.$id.''')"> Link</a>';
}
// get the authors
$sql = 'SELECT data FROM ISIAUTHOR WHERE id='.$id;
foreach ($base->query($sql) as $row) {
$output.=strtoupper($row['data']).', ';
}
if($project_folder!='nci'){
$output.='('.$pubdate.') ';
}else {
$output.='(2013) ';
}
// get the country
$sql = 'SELECT data FROM ISIkeyword WHERE id='.$id;
foreach ($base->query($sql) as $row) {
$country=$CC[strtoupper($row['data'])];
$output.=strtoupper($country).' ';
}
//<a href="JavaScript:newPopup('http://www.quackit.com/html/html_help.cfm');">Open a popup window</a>'
$output.=$external_link."</li><br>";
}else{
continue;
}
}
arsort($favorite_keywords);
$tag_coud_size=0;
$tag_could='';
foreach ($favorite_keywords as $key => $value) {
if ($tag_coud_size<$max_tag_could_size){
$tag_coud_size+=1;
$tag_could.='<font size="'.(3+log($value)).'">'.$key.', </font>';
}else{
continue;
} # code...
}
$output= '<h3>'.$num_favorite.' favorite items </h3>'.$tag_could.'<br/>'.$output;
echo $output;
function imagestar($score,$factor,$twjs) {
// produit le html des images de score
$star_image = '';
if ($score > .5) {
$star_image = '';
for ($s = 0; $s < min(5,$score/$factor); $s++) {
$star_image.='<img src="img/star.gif" border="0" >';
}
} else {
$star_image.='<img src="img/stargrey.gif" border="0">';
}
return $star_image;
}
?>
<?php
include('parameters_details.php');
$db = $gexf_db[$gexf];
$base = new PDO("sqlite:../" .$db);
$output = "<ul>"; // string sent to the javascript for display
#http://localhost/branch_ademe/php/test.php?type=social&query=[%22marwah,%20m%22]
$type = $_GET["type"];
$query = str_replace( '__and__', '&', $_GET["query"] );
$terms_of_query=json_decode($_GET["query"]);
$elems = json_decode($query);
// nombre d'item dans les tables
$sql='SELECT COUNT(*) FROM ISIABSTRACT';
foreach ($base->query($sql) as $row) {
$table_size=$row['COUNT(*)'];
}
$table = "";
$column = "";
$id="";
$twjs="API_CNRS/"; // submod path of TinaWebJS
if($type=="social"){
$table = "ISIAUTHOR";
$column = "data";
$id = "id";
$restriction='';
$factor=10;// factor for normalisation of stars
}
if($type=="semantic"){
$table = "ISItermsListV1";
$column = "data";
$id = "id";
$restriction='';
$factor=10;
}
$sql = 'SELECT count(*),'.$id.'
FROM '.$table.' where (';
foreach($elems as $elem){
$sql.=' '.$column.'="'.$elem.'" OR ';
}
#$querynotparsed=$sql;#####
$sql = substr($sql, 0, -3);
$sql = str_replace( ' & ', '" OR '.$column.'="', $sql );
$sql.=')'.$restriction.'
GROUP BY '.$id.'
ORDER BY count('.$id.') DESC
LIMIT 1000';
#$queryparsed=$sql;#####
$wos_ids = array();
$sum=0;
//The final query!
// array of all relevant documents with score
foreach ($base->query($sql) as $row) {
// on pondère le score par le nombre de termes mentionnés par l'article
//$num_rows = $result->numRows();
$wos_ids[$row[$id]] = $row["count(*)"];
$sum = $row["count(*)"] +$sum;
}
//arsort($wos_ids);
$number_doc=ceil(count($wos_ids)/3);
$count=0;
foreach ($wos_ids as $id => $score) {
if ($count<1000){
// retrieve publication year
$sql = 'SELECT data FROM ISIpubdate WHERE id='.$id;
foreach ($base->query($sql) as $row) {
$pubdate=$row['data'];
}
// to filter under some conditions
$to_display=true;
if ($to_display){
$count+=1;
$output.="<li title='".$score."'>";
$output.=imagestar($score,$factor,$twjs).' ';
$sql = 'SELECT data FROM ISITITLE WHERE id='.$id." group by data";
foreach ($base->query($sql) as $row) {
$output.='<a href="default_doc_details.php?gexf='.urlencode($gexf).'&type='.urlencode($_GET["type"]).'&query='.urlencode($query).'&id='.$id.'">'.$row['data']." </a> ";
//this should be the command:
//$output.='<a href="JavaScript:newPopup(\''.$twjs.'php/default_doc_details.php?db='.urlencode($datadb).'&id='.$id.' \')">'.$row['data']." </a> ";
//the old one:
//$output.='<a href="JavaScript:newPopup(\''.$twjs.'php/default_doc_details.php?id='.$id.' \')">'.$row['data']." </a> ";
$external_link="<a href=http://scholar.google.com/scholar?q=".urlencode('"'.$row['data'].'"')." target=blank>".' <img width=20px src="img/gs.png"></a>';
//$output.='<a href="JavaScript:newPopup(''php/doc_details.php?id='.$id.''')"> Link</a>';
}
// get the authors
$sql = 'SELECT data FROM ISIAUTHOR WHERE id='.$id;
foreach ($base->query($sql) as $row) {
$output.=strtoupper($row['data']).', ';
}
//<a href="JavaScript:newPopup('http://www.quackit.com/html/html_help.cfm');">Open a popup window</a>'
$output.=$external_link."</li><br>";
}
}else{
continue;
}
}
$output= '<h3>'.$count.' items related to: '.implode(' OR ', $elems).'</h3>'.$output;
echo $output;
function imagestar($score,$factor,$twjs) {
// produit le html des images de score
$star_image = '';
if ($score > .5) {
$star_image = '';
for ($s = 0; $s < min(5,$score/$factor); $s++) {
$star_image.='<img src="img/star.gif" border="0" >';
}
} else {
$star_image.='<img src="img/stargrey.gif" border="0">';
}
return $star_image;
}
?>
<?php
include('parameters_details.php');
$db = $gexf_db[$gexf];
$base = new PDO("sqlite:../" ."data/terrorism/data.db");
echo "sqlite:../" ."data/terrorism/data.db";
$output = "<ul>"; // string sent to the javascript for display
#http://localhost/branch_ademe/php/test.php?type=social&query=[%22marwah,%20m%22]
$type = $_GET["type"];
$query = str_replace( '__and__', '&', $_GET["query"] );
$terms_of_query=json_decode($_GET["query"]);
$elems = json_decode($query);
// nombre d'item dans les tables
$sql='SELECT COUNT(*) FROM ISIABSTRACT';
foreach ($base->query($sql) as $row) {
$table_size=$row['COUNT(*)'];
}
$table = "";
$column = "";
$id="";
$twjs="pasteurapi/"; // submod path of TinaWebJS
if($type=="social"){
$table = "ISIAUTHOR";
$column = "data";
$id = "id";
$restriction='';
$factor=10;// factor for normalisation of stars
}
if($type=="semantic"){
$table = "ISItermsListV1";
$column = "data";
$id = "id";
$restriction='';
$factor=10;
}
$sql = 'SELECT count(*),'.$id.'
FROM '.$table.' where (';
foreach($elems as $elem){
$sql.=' '.$column.'="'.$elem.'" OR ';
}
#$querynotparsed=$sql;#####
$sql = substr($sql, 0, -3);
$sql = str_replace( ' & ', '" OR '.$column.'="', $sql );
$sql.=')'.$restriction.'
GROUP BY '.$id.'
ORDER BY count('.$id.') DESC
LIMIT 1000';
#$queryparsed=$sql;#####
$wos_ids = array();
$sum=0;
//The final query!
// array of all relevant documents with score
foreach ($base->query($sql) as $row) {
// on pondère le score par le nombre de termes mentionnés par l'article
//$num_rows = $result->numRows();
$wos_ids[$row[$id]] = $row["count(*)"];
$sum = $row["count(*)"] +$sum;
}
//arsort($wos_ids);
$number_doc=ceil(count($wos_ids)/3);
$count=0;
foreach ($wos_ids as $id => $score) {
if ($count<1000){
// retrieve publication year
$sql = 'SELECT data FROM ISIpubdate WHERE id='.$id;
foreach ($base->query($sql) as $row) {
$pubdate="2014";
}
// to filter under some conditions
$to_display=true;
if ($to_display){
$count+=1;
$output.="<li title='".$score."'>";
$output.=imagestar($score,$factor,$twjs).' ';
$sql = 'SELECT data FROM ISITITLE WHERE id='.$id." group by data";
foreach ($base->query($sql) as $row) {
$output.='<a href="default_doc_details2.php?gexf='.urlencode($gexf).'&type='.urlencode($_GET["type"]).'&query='.urlencode($query).'&id='.$id.'">'.$row['data']." </a> ";
//this should be the command:
//$output.='<a href="JavaScript:newPopup(\''.$twjs.'php/default_doc_details.php?db='.urlencode($datadb).'&id='.$id.' \')">'.$row['data']." </a> ";
//the old one:
//$output.='<a href="JavaScript:newPopup(\''.$twjs.'php/default_doc_details.php?id='.$id.' \')">'.$row['data']." </a> ";
$external_link="<a href=http://scholar.google.com/scholar?q=".urlencode('"'.$row['data'].'"')." target=blank>".' <img width=20px src="img/gs.png"></a>';
//$output.='<a href="JavaScript:newPopup(''php/doc_details.php?id='.$id.''')"> Link</a>';
}
// get the authors
$sql = 'SELECT data FROM ISIAUTHOR WHERE id='.$id;
foreach ($base->query($sql) as $row) {
$output.=strtoupper($row['data']).', ';
}
//<a href="JavaScript:newPopup('http://www.quackit.com/html/html_help.cfm');">Open a popup window</a>'
$output.=$external_link."</li><br>";
}
}else{
continue;
}
}
$output= '<h3>'.$count.' items related to: '.implode(' OR ', $elems).'</h3>'.$output;
echo $output;
function imagestar($score,$factor,$twjs) {
// produit le html des images de score
$star_image = '';
if ($score > .5) {
$star_image = '';
for ($s = 0; $s < min(5,$score/$factor); $s++) {
$star_image.='<img src="img/star.gif" border="0" >';
}
} else {
$star_image.='<img src="img/stargrey.gif" border="0">';
}
return $star_image;
}
?>
<?php
include('parameters_details.php');
$db= $_GET["db"];//I receive the specific database as string!
$query=$_GET["query"];
$gexf=$_GET["gexf"];
$base = new PDO("sqlite:" .$mainpath.$db);
$temp=explode('/',$db);
$project_folder=$temp[1];
$corpora=$temp[count($temp)-2];
$corporadb = new PDO("sqlite:" .$mainpath.'data/'.$corpora.'/'.$corpora.'.sqlite'); //data base with complementary data
$output = "<ul>"; // string sent to the javascript for display
#http://localhost/branch_ademe/php/test.php?type=social&query=[%22marwah,%20m%22]
$type = $_GET["type"];
$query = str_replace( '__and__', '&', $_GET["query"] );
$elems = json_decode($query);
// nombre d'item dans les tables
$sql='SELECT COUNT(*) FROM ISIABSTRACT';
foreach ($base->query($sql) as $row) {
$table_size=$row['COUNT(*)'];
}
///// Specific to rock //////////
// Other restrictions
// extracting the project folder and the year
if (strpos($gexf,'2013')>0){
$year='2013';
$year_filter=true;
}elseif (strpos($gexf,'2012')>0){
$year='2012';
$year_filter=true;
}else{
$year_filter=false;
}
// identification d'une année pour echoing
if($project_folder=='nci'){
$year_filter=true;
}
$table = "";
$column = "";
$id="";
$twjs="tinawebJS/"; // submod path of TinaWebJS
if($type=="social"){
$table = "ISIAUTHOR";
$column = "data";
$id = "id";
$restriction='';
$factor=10;// factor for normalisation of stars
}
if($type=="semantic"){
$table = "ISItermsListV1";
$column = "data";
$id = "id";
$restriction='';
$factor=10;
}
// identification d'une année pour echoing
if($project_folder=='nci'){
$restriction.=" AND ISIpubdate='2013'";
}
$sql = 'SELECT sum(tfidf),id
FROM tfidf where (';
foreach($elems as $elem){
$sql.=' term="'.$elem.'" OR ';
}
#$querynotparsed=$sql;#####
$sql = substr($sql, 0, -3);
$sql = str_replace( ' & ', '" OR term="', $sql );
$sql.=')'.//$restriction.
'GROUP BY '.$id.'
ORDER BY sum(tfidf) DESC
LIMIT 1000';
//echo $sql;
#$queryparsed=$sql;#####
$wos_ids = array();
$sum=0;
//echo $sql;//The final query!
// array of all relevant documents with score
$count=0;
foreach ($corporadb ->query($sql) as $row) {
//if ($count<4*$max_item_displayed){
$wos_ids[$row[$id]] = $row['sum(tfidf)'];//$row["count(*)"];
$sum = $row["count(*)"] +$sum;
//}else{
// continue;
//}
}
//arsort($wos_ids);
$number_doc=ceil(count($wos_ids)/3);
$count=0;
foreach ($wos_ids as $id => $score) {
if ($count<1000){
// retrieve publication year
$sql = 'SELECT data FROM ISIpubdate WHERE id='.$id;
foreach ($base->query($sql) as $row) {
$pubdate=$row['data'];
}
// to filter under some conditions
$to_display=true;
if ($project_folder=='echoing'){
if ($year_filter){
if ($pubdate!=$year){
$to_display=false;
}
}
}elseif($project_folder=='nci'){
if ($year_filter){
if ($pubdate!='2013'){
$to_display=false;
}
}
}
if ($to_display){
$count+=1;
$output.="<li title='".$score."'>";
$output.=imagestar($score,$factor,$twjs).' ';
$sql = 'SELECT data FROM ISITITLE WHERE id='.$id;
foreach ($base->query($sql) as $row) {
$output.='<a href="default_doc_details.php?db='.urlencode($db).'&type='.urlencode($_GET["type"]).'&query='.urlencode($query).'&id='.$id.'">'.$row['data']." </a> ";
//this should be the command:
//$output.='<a href="JavaScript:newPopup(\''.$twjs.'php/default_doc_details.php?db='.urlencode($datadb).'&id='.$id.' \')">'.$row['data']." </a> ";
//the old one:
//$output.='<a href="JavaScript:newPopup(\''.$twjs.'php/default_doc_details.php?id='.$id.' \')">'.$row['data']." </a> ";
$external_link="<a href=http://scholar.google.com/scholar?q=".urlencode('"'.$row['data'].'"')." target=blank>".' <img width=20px src="img/gs.png"></a>';
//$output.='<a href="JavaScript:newPopup(''php/doc_details.php?id='.$id.''')"> Link</a>';
}
// get the authors
$sql = 'SELECT data FROM ISIAUTHOR WHERE id='.$id;
foreach ($base->query($sql) as $row) {
$output.=strtoupper($row['data']).', ';
}
if($project_folder!='nci'){
$output.='('.$pubdate.') ';
}else {
$output.='(2013) ';
}
//<a href="JavaScript:newPopup('http://www.quackit.com/html/html_help.cfm');">Open a popup window</a>'
$output.=$external_link."</li><br>";
}
}else{
continue;
}
}
$output= '<h3>'.$count.' items related to: '.implode(' OR ', $elems).'</h3>'.$output;
echo $output;
function imagestar($score,$factor,$twjs) {
// produit le html des images de score
$star_image = '';
if ($score > .5) {
$star_image = '';
for ($s = 0; $s < min(5,$score/$factor); $s++) {
$star_image.='<img src="img/star.gif" border="0" >';
}
} else {
$star_image.='<img src="img/stargrey.gif" border="0">';
}
return $star_image;
}
?>
<?php
// manage the dynamical additional information in the left panel.
// ini_set('display_errors',1);
// ini_set('display_startup_errors',1);
// error_reporting(-1);
include('parameters_details.php');
$max_item_displayed=6;
$base = new PDO("sqlite:../" .$graphdb);
include('default_div.php');
/*
* This function gets the first db name in the data folder
* IT'S NOT SCALABLE! (If you want to use several db's)
*/
function getDB ($directory) {
//$results = array();
$result = "";
$handler = opendir($directory);
while ($file = readdir($handler)) {
if ($file != "." && $file != ".."
&&
((strpos($file,'.db~'))==false && (strpos($file,'.db'))==true )
||
((strpos($file,'.sqlite~'))==false && (strpos($file,'.sqlite'))==true)
) {
//$results[] = $file;
$result = $file;
break;
}
}
closedir($handler);
//return $results;
return $result;
}
?>
<?php
// manage the dynamical additional information in the left panel.
// include('parameters_details.php');
$gexf= str_replace('"','',$_GET["gexf"]);
$max_item_displayed=6;
$type = $_GET["type"];
$TITLE="ISITITLE";
$query = str_replace( '__and__', '&', $_GET["query"] );
$elems = json_decode($query);
$table = "";
$column = "";
$id="";
$twjs="API_CNRS/"; // submod path of TinaWebJS
if($type=="semantic"){
$table = "ISItermsListV1";
$column = "data";
$id = "id";
$restriction='';
$factor=10;
}
$restriction='';
$factor=10;
$sql="";
if (count($elems)==1){// un seul mot est sélectionné, on compte les mots multiples
$sql = 'SELECT count(*),'.$id.'
FROM '.$table.' where (';
foreach($elems as $elem){
$sql.=' '.$column.'="'.$elem.'" OR ';
}
#$querynotparsed=$sql;#####
$sql = substr($sql, 0, -3);
$sql = str_replace( ' & ', '" OR '.$column.'="', $sql );
$sql.=')'.$restriction.'
GROUP BY '.$id.'
ORDER BY count('.$id.') DESC
LIMIT 1000';
}else{// on compte une seule fois un mot dans un article
$factor=ceil(count($elems)/5); //les scores sont moins haut
$sql='';
foreach($elems as $elem){
$sql.=' '.$column.'="'.$elem.'" OR ';
}
$sql=substr($sql, 0, -3);
$sql='SELECT count(*),id,data FROM (SELECT *
FROM '.$table.' where ('.$sql.')'.$restriction.'
group by id,data) GROUP BY '.$id.'
ORDER BY count('.$id.') DESC
LIMIT 1000 COLLATE NOCASE';
}
// echo $sql."<br>";
$base = new PDO("sqlite:../data/terrorism/data.db");
$wos_ids = array();
$sum=0;
//The final query!
// array of all relevant documents with score
foreach ($base->query($sql) as $row) {
// on pondère le score par le nombre de termes mentionnés par l'article
//$num_rows = $result->numRows();
$wos_ids[$row[$id]] = $row["count(*)"];
$sum = $row["count(*)"] +$sum;
}
// /// nombre de document associés $related
$total_count=0;
$count_max=500;
$number_doc=count($wos_ids);
$count=0;
$all_terms_from_selected_projects=array();// list of terms for the top 6 project selected
// to filter under some conditions
$to_display=true;
$count=0;
foreach ($wos_ids as $id => $score) {
if ($total_count<$count_max) {
// retrieve publication year
if ($to_display){
$total_count+=1;
if ($count<=$max_item_displayed){
$count+=1;
$sql = 'SELECT data FROM ISITITLE WHERE id='.$id.' group by data';
foreach ($base->query($sql) as $row) {
$external_link="<a href=http://google.com/webhp?#q=".urlencode('"'.utf8_decode($row['data']).'"')." target=blank>".' <img width=15px src="'.$twjs.'img/google.png"></a>';
$output.="<li title='".$score."'>";
$output.=$external_link.imagestar($score,$factor,$twjs).' ';
$output.='<a href="JavaScript:newPopup(\''.$twjs.'default_doc_details2.php?gexf='.urlencode($gexf).'&query='.urlencode($query).'&type='.urlencode($_GET["type"]).'&id='.$id.' \')">'.htmlentities($row['data'], ENT_QUOTES, "UTF-8")." </a> ";
// $output.='<a>'.htmlentities($row['data'], ENT_QUOTES, "UTF-8")." </a> ";
}
$sql = 'SELECT data FROM ISIDOI WHERE id='.$id.' group by data';
foreach ($base->query($sql) as $row) {
$output.=$external_link.imagestar($score,$factor,$twjs).' ';
$output.='<a href="JavaScript:newPopup(\''.$twjs.'default_doc_details2.php?gexf='.urlencode($gexf).'&query='.urlencode($query).'&type='.urlencode($_GET["type"]).'&id='.$id.' \')">'.htmlentities($row['data'], ENT_QUOTES, "UTF-8")." </a> ";
} // get the authors
$sql2 = 'SELECT data FROM ISIAUTHOR WHERE id='.$id. ' group by data';
foreach ($base->query($sql2) as $row2) {
$output.=(str_replace("\r", "", $row2['data'])).', ';
}
$output = rtrim($output, ", ");
$output.="</li><br>";
}
}
} else{
continue;
}
}
if ($total_count<$count_max){
$related .= $total_count;
}else{
$related .= ">".$count_max;
}
$output .= "</ul>"; #####
// echo $output."<br>";
if($max_item_displayed>$related) $max_item_displayed=$related;
echo $news.'<br/><h4><font color="#0000FF"> Full text of top '.$max_item_displayed.'/'.$related.' related grant proposals:</font></h4>'.$output;
//pt - 301 ; 15.30
/*
* This function gets the first db name in the data folder
* IT'S NOT SCALABLE! (If you want to use several db's)
*/
function getDB ($directory) {
//$results = array();
$result = "";
$handler = opendir($directory);
while ($file = readdir($handler)) {
if ($file != "." && $file != ".."
&&
((strpos($file,'.db~'))==false && (strpos($file,'.db'))==true )
||
((strpos($file,'.sqlite~'))==false && (strpos($file,'.sqlite'))==true)
) {
//$results[] = $file;
$result = $file;
break;
}
}
closedir($handler);
//return $results;
return $result;
}
function imagestar($score,$factor,$twjs) {
// produit le html des images de score
$star_image = '';
if ($score > .5) {
$star_image = '';
for ($s = 0; $s < min(5,$score/$factor); $s++) {
$star_image.='<img src="'.$twjs.'img/star.gif" border="0" >';
}
} else {
$star_image.='<img src="'.$twjs.'img/stargrey.gif" border="0">';
}
return $star_image;
}
?>
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
<?php
header ("Content-Type:application/json");
//$string = getcwd();
//$string = str_replace("/php","",$string);
$string=dirname(dirname(getcwd())); // ProjectExplorer folder name: /var/www/ademe
//$files = getDirectoryList($string."/data");
include("DirectoryScanner.php");
$projectFolderPat = dirname(dirname(getcwd())) . "/";
$instance = new scanTree($projectFolderPat);
$instance->getDirectoryTree("data");
$gexfs=$instance->gexf_folder;
$files=array();
foreach($gexfs as $key => $value){
array_push($files,$key);
}
$filesSorted=array();
foreach($files as $file){
array_push($filesSorted,$file);
}
sort($filesSorted);
echo json_encode($filesSorted);
function getDirectoryList ($directory) {
$results = array();
$handler = opendir($directory);
while ($file = readdir($handler)) {
if ($file != "." && $file != ".." &&
(strpos($file,'.gexf~'))==false &&
(strpos($file,'.gexf'))==true) {
$results[] = $file;
}
}
closedir($handler);
return $results;
}
?>
<?php
$gexf_db = array();
$gexf_db["data/medq1/20141208_MED_01_bi.gexf"] = "data/medq1/01_medline-query1.db";
$gexf_db["data/medq2/20141128_MED_02_bi.gexf"] = "data/medq2/02_medline-query2.db";
$gexf_db["data/medq2/20141128_MED_03_bi.gexf"] = "data/medq2/02_medline-query2.db";
$gexf_db["data/medq2/20141208_MED_Author_name-ISItermsjulien_index.gexf"] = "data/medq2/02_medline-query2.db";
$gexf_db["data/20141128_GPs_03_bi.gexf"] = "data/00_grantproposals.db";
$gexf_db["data/20141215_GPs_04.gexf"] = "data/00_grantproposals.db";
# new stuff
$gexf_db["data/terrorism/terrorism_mono.gexf"] = "data/terrorism/data.db";
$gexf_db["data/terrorism/terrorism_bi.gexf"] = "data/terrorism/data.db";
# new stuff2
$gexf_db["data/ClimateChange/hnetwork-2014_2015hhn-wosclimatechange2014_2015top509-ISItermsListV3bis-ISItermsListV3bis-distributionalcooc-99999-oT0.36-20-louTrue.gexf"] = "data/ClimateChange/wosclimatechange-61715-1-wosclimatechange-db(2).db";
$gexf_db["data/ClimateChange/ClimateChangeV1.gexf"] = "data/ClimateChange/wosclimatechange-61715-1-wosclimatechange-db(2).db";
$gexf_db["data/ClimateChange/hnetwork-2014_2015hn-wosclimatechange2014_2015top509-ISItermsListV3bis-ISItermsListV3bis-distributionalcooc-99999-oT0.36-20-louTrue.gexf"] = "data/ClimateChange/wosclimatechange-61715-1-wosclimatechange-db(2).db";
$gexf= str_replace('"','',$_GET["gexf"]);
$mainpath=dirname(getcwd())."/";
$graphdb = $gexf_db[$gexf];
?>
<?php
echo '<meta http-equiv="Content-type" content="text/html; charset=UTF-8"/>';
// compute the tfidf score for each terms for each document for cortext like databases and store them in a specific table
//include('parameters_details.php');
$db = new PDO("sqlite:graph.db");
$database_name='echoing.sqlite';
$project_base = new PDO("sqlite:" .$database_name);
// Table creation
// efface la base existante
$project_base->exec("DROP TABLE IF EXIST tfidf");
pt("creation of tfidf table");
//on crée un table pour les infos de clusters
$project_base->exec("CREATE TABLE tfidf (id NUMERIC,term TEXT,tfidf NUMERIC)");
//generating number of mention of terms in the corpora
$terms_freq=array();
pt('processing terms frequency');
$sql='SELECT count(*),data FROM ISItermsListV1 group by data';
foreach ($db->query($sql) as $term) {
$terms_freq[$term['data']]=$term['count(*)'];
}
pt('processing number of doc');
// nombre d'iterator_apply(iterator, function)em dans les tables
$sql='SELECT COUNT(*) FROM ISIABSTRACT';
foreach ($db->query($sql) as $row) {
$table_size=$row['COUNT(*)'];
}
pt($table_size.' documents in database');
// select all the doc
$sql='SELECT * FROM ISIABSTRACT';
foreach ($db->query($sql) as $doc) {
$id=$doc['id'];
pt($id);
//select all the terms of that document with their occurrences
$sql2="SELECT count(*),data FROM ISItermsListV1 where id='".$id."' group by data";
// for each term we compute the tfidf
foreach ($db->query($sql2) as $term_data) {
$term=$term_data['data'];
$term_occ_in_doc=$term_data['count(*)'];
$terms_tfidf=log(1+$term_occ_in_doc)*log($table_size/$terms_freq[$term]);
$query='INSERT INTO tfidf (id,term,tfidf) VALUES ('.$id.',"'.$term.'",'.$terms_tfidf.')';
$project_base->query($query);
}
}
function pt ($string) {
echo $string.'<br/>';
}
?>
{
"data/ClimateChange": {
"dbname":"wosclimatechange-61490-1-wosclimatechange-db.db",
"title":"ISITITLE",
"date":"ISIpubdate",
"abstract":"ISIABSTRACT",
"gexfs": {
"hnetwork-2014_2015hn-wosclimatechange2014_2015top509-ISItermsListV3bis-ISItermsListV3bis-distributionalcooc-99999-oT0.36-20-louTrue.gexf": {
"social": { "table":"ISIAUTHOR" , "textCol":"data","forkeyCol":"id"},
"semantic": { "table":"ISItermsListV3bis" , "textCol":"data","forkeyCol":"id"}
},
"ClimateChangeV1.gexf": {
"social": { "table":"ISIAUTHOR" , "textCol":"data","forkeyCol":"id"},
"semantic": { "table":"ISItermsListV3bis" , "textCol":"data","forkeyCol":"id"}
}
}
},"data/terrorism": {
"dbname":"data.db",
"title":"ISITITLE",
"date":"ISIpubdate",
"abstract":"ISIABSTRACT",
"gexfs": {
"terrorism_bi.gexf": {
"social": { "table":"ISIAUTHOR" , "textCol":"data","forkeyCol":"id"},
"semantic": { "table":"ISItermsListV1" , "textCol":"data","forkeyCol":"id"}
},
"terrorism_mono.gexf":{
"semantic": { "table":"ISItermsListV1" , "textCol":"data","forkeyCol":"id"}
}
}
},
"data/medq2/": {
"dbname":"02_medline-query2.db",
"title":"ArticleTitle",
"date":"ISIpubdate",
"abstract":"Abstract",
"gexfs": {
"20141208_MED_Author_name-ISItermsjulien_index.gexf": {
"social": { "table":"Author_name" , "textCol":"data","forkeyCol":"id"},
"semantic": { "table":"ISItermsBigWL" , "textCol":"data","forkeyCol":"id"}
}
}
}
}
// dot call_graph.dot -Tpng -o tina_call_graph.png
digraph tina_call_graph {
graph [ordering="out"];
rankdir=LR ;
edge [fontsize=10] ;
label=<<B><U>tinawebJS</U></B><BR/>(initialization callgraph)>;
labelloc="t" ;
// settings
"settings var" -> "settings:SystemStates";
"settings var" -> "settings:sigmaJsDrawingProperties";
"settings var" -> "etc.";
// getUrlParam
"t.globalUtils:getUrlParam" -> "var mainfile (url)" ;
// main 1: get graph
"t.main" -> "var mainfile (url)" ;
"var mainfile (url)" -> "ajax garg" ;
"ajax garg" -> "t.main:MainFunction" ;
// main 2: parse graph
"t.main:MainFunction" -> "t.sigma.parseCustom:ParseCustom" ;
"t.main:MainFunction" -> "t.sigma.parseCustom:scanFile" ;
"t.sigma.parseCustom:scanFile" -> "t.sigma.parseCustom:getJSONCategories" ;
"t.sigma.parseCustom:getJSONCategories" -> "t.sigma.parseCustom:scanJSON" ;
"t.main:MainFunction" -> "t.sigma.parseCustom:makeSystemStates" ;
"t.main:MainFunction" -> "t.sigma.parseCustom:buildInitialState" ;
"t.main:MainFunction" -> "t.sigma.parseCustom:makeDicts" ;
"t.sigma.parseCustom:makeDicts" -> "t.sigma.parseCustom:dictfyJSON" [label="cats={'terms':0}"] ;
// main 3: new TinaWebJS()
"t.main:MainFunction" -> "var twjs_" ;
"var twjs_" -> "t.TinawebJS:TinaWebJS:new" ;
// main 4: adjust canvas routine
"t.main:MainFunction" -> "t.TinawebJS:AdjustSigmaCanvas" ; // twjs_.AdjustSigmaCanvas()
"t.TinawebJS:AdjustSigmaCanvas" -> "t.TinawebJS:sigmaLimits" ;
"t.TinawebJS:sigmaLimits" -> "t.TinawebJS:visibleHeight" ;
"t.TinawebJS:sigmaLimits" -> "new canvas!" ;
// main 5: partialGraph and new SigmaUtils()
"t.main:MainFunction" -> "var partialGraph" ;
"var partialGraph" -> "sigma:init";
"t.main:MainFunction" -> "t.SigmaUtils:SigmaUtils:new" ;
"t.main:MainFunction" -> "t.SigmaUtils:SigmaUtils:FillGraph" ; // [ Poblating the Sigma-Graph ]
"t.SigmaUtils:SigmaUtils:FillGraph" -> "SigmaPublic.addNode" [label="x N"];
"t.SigmaUtils:SigmaUtils:FillGraph" -> "SigmaPublic.addEdge" [label="x N"];
"SigmaPublic.addEdge" -> "t.globalUtils:hex2rga" [label="x M"];
"t.SigmaUtils:SigmaUtils:FillGraph" -> "t.enviroment:updateSearchLabels" [label="N x push labels"];
// main 6: state and settings for partialGraph
// "settings:sigmaJsDrawingProperties" -> "var partialGraph" ;
// "settings:SystemStates" -> "var partialGraph" ;
"var partialGraph" -> "t.main:partialGraph:setState";
// main 7: twjs_.initListeners( categories , partialGraph)
"t.main:MainFunction" -> "t.TinawebJS:initListeners" ;
"t.TinawebJS:initListeners" -> "t.TinawebJS:SelectionEngine:new" [label="initListeners:SelInst"] ;
"t.TinawebJS:initListeners" -> "onclick:#changetype" ;
"t.TinawebJS:initListeners" -> "onclick:#changelevel" ;
"t.TinawebJS:initListeners" -> "onclick:#aUnfold" ;
"t.TinawebJS:initListeners" -> "t.minimap:startMiniMap" [label = "if minimap"] ;
"t.TinawebJS:initListeners" -> "t.methods:pushSWClick" [label = "var swclickActual"] ;
"t.TinawebJS:initListeners" -> "t.methods:cancelSelection" ;
"t.methods:cancelSelection" -> "t.methods:highlightSelectedNodes" [label = "false"] ;
"t.methods:highlightSelectedNodes" -> "t.globalUtils:is_empty" ;
"t.methods:cancelSelection" -> "erase:#names" ;
"t.methods:cancelSelection" -> "erase:#ngrams_actions" ;
"t.methods:cancelSelection" -> "erase:#topPapers" ;
"t.methods:cancelSelection" -> "erase:#opossiteNodes" ;
"t.methods:cancelSelection" -> "erase:#searchinput" ;
"t.methods:cancelSelection" -> "t.methods:LevelButtonDisable" ;
"t.TinawebJS:initListeners" -> "t.sigmaUtils:showMeSomeLabels" ;
"t.sigmaUtils:showMeSomeLabels" -> "t.sigmaUtils:getVisibleNodes" ;
"t.TinawebJS:initListeners" -> "t.TinawebJS:SearchListeners" ;
"t.TinawebJS:SearchListeners" -> "autocomplete:#searchinput" ;
"autocomplete:#searchinput" -> "t.TinawebJS:SelectionEngine:new" [label="SearchListeners:SelInst"] ;
/*t.methods:highlightSelectedNodes*/
}
partialGraph.zoomTo(partialGraph._core.width / 2, partialGraph._core.height / 2, 0.2).draw();
SystemStates
// {
// "level": true,
// "type": [
// true
// ],
// "selections": [],
// "opposites": [],
// "categories": [
// "terms"
// ],
// "categoriesDict": {
// "terms": "0"
// },
// "LouvainFait": false
// }
This diff is collapsed.
......@@ -3,11 +3,13 @@
*/
function newPopup(url) {
console.log('FUN extras_explorerjs:newPopup')
popupWindow = window.open(url,'popUpWindow','height=700,width=800,left=10,top=10,resizable=yes,scrollbars=yes,toolbar=no,menubar=no,location=no,directories=no,status=no')
}
function getIDFromURL( item ) {
console.log('FUN extras_explorerjs:getIDFromURL')
var pageurl = window.location.href.split("/")
var cid;
for(var i in pageurl) {
......@@ -20,6 +22,7 @@ function getIDFromURL( item ) {
}
function modify_ngrams( classname ) {
console.log('FUN extras_explorerjs:modify_ngrams')
console.clear()
var corpus_id = getIDFromURL( "corpora" ) // not used
......@@ -92,6 +95,7 @@ function CRUD( list_id , ngram_ids , http_method , callback) {
// then, add the button in the html with the sigmaUtils.clustersBy(x) listener.
//TODO: move to ClustersPlugin.js or smntng
function ChangeGraphAppearanceByAtt( manualflag ) {
console.log('FUN extras_explorerjs:ChangeGraphAppearanceByAtt')
if ( !isUndef(manualflag) && !colorByAtt ) colorByAtt = manualflag;
if(!colorByAtt) return;
......@@ -198,7 +202,8 @@ function CRUD( list_id , ngram_ids , http_method , callback) {
return b-a
});
console.clear()
// console.clear()
console.log( AttsDict_sorted )
for (var i in AttsDict_sorted) {
var att_s = AttsDict_sorted[i].key;
......@@ -230,6 +235,7 @@ function CRUD( list_id , ngram_ids , http_method , callback) {
// then, it runs external library jLouvain()
//TODO: move to ClustersPlugin.js or smntng
function RunLouvain() {
console.log('FUN extras_explorerjs:RunLouvain')
var node_realdata = []
var nodesV = getVisibleNodes()
......@@ -256,6 +262,7 @@ function CRUD( list_id , ngram_ids , http_method , callback) {
// Highlight nodes belonging to cluster_i when you click in thecluster_i of the legend
//TODO: move to ClustersPlugin.js or smntng
function HoverCluster( ClusterCode ) {
console.log('FUN extras_explorerjs:HoverCluster')
console.log( ClusterCode )
var raw = ClusterCode.split("||")
......@@ -343,6 +350,7 @@ function CRUD( list_id , ngram_ids , http_method , callback) {
// daclass = "clust_default" | "clust_louvain" | "clust_x" ...
//TODO: move to ClustersPlugin.js or smntng
function set_ClustersLegend ( daclass ) {
console.log('FUN extras_explorerjs:set_ClustersLegend')
//partialGraph.states.slice(-1)[0].LouvainFait = true
if( daclass=="clust_default" && Clusters.length==0)
......@@ -404,6 +412,7 @@ function CRUD( list_id , ngram_ids , http_method , callback) {
// PHP-mode when you've a cortext db.
function getTopPapers_OriginalVersion(type){
console.log('FUN extras_explorerjs:getTopPapers_OriginalVersion')
if(getAdditionalInfo){
jsonparams=JSON.stringify(getSelections());
bi=(Object.keys(categories).length==2)?1:0;
......@@ -435,7 +444,7 @@ function getTopPapers_OriginalVersion(type){
// PHP-mode when you've a cortext db.
function getTopProposals(type , jsonparams , thisgexf) {
console.log('FUN extras_explorerjs:getTopProposals')
type = "semantic";
if(swclickActual=="social") {
nodesA = []
......@@ -491,6 +500,7 @@ function getTopProposals(type , jsonparams , thisgexf) {
// Just for Garg
function genericGetTopPapers(theids , corpus_id , thediv) {
console.log('FUN extras_explorerjs:genericGetTopPapers')
if(getAdditionalInfo) {
$("#"+thediv).show();
$.ajax({
......@@ -551,6 +561,7 @@ function genericGetTopPapers(theids , corpus_id , thediv) {
// Just for Garg: woops, override
function getTopPapers(type){
console.log('FUN extras_explorerjs:getTopPapers')
if(getAdditionalInfo){
$("#topPapers").show();
......@@ -624,7 +635,7 @@ function getTopPapers(type){
jsstuff += "wnws_buffer = window.open('"+getpubAPI+"', 'popUpWindow' , '"+jsparams+"')";
output += "<li><a onclick=\""+jsstuff+"\" target=_blank>"+pub["title"]+"</a>. "+ifauthors+". "+ifjournal+". "+ifkeywords+". "+ifdate+"\n";
output += '<a href="'+gquery+'" target=_blank><img title="Query to Google" src="'+window.location.origin+'/static/img/searx.png"></img></a>'
output += '<a href="'+gquery+'" target=_blank><img title="Query to Google" src="'+window.location.origin+'/static/img/google.png"></img></a>'
output +="</li>\n";
// for(var j in pub) {
// if(j!="abstract")
......@@ -654,6 +665,7 @@ function getTopPapers(type){
}
function getCookie(name) {
console.log('FUN extras_explorerjs:getCookie')
var cookieValue = null;
if (document.cookie && document.cookie != '') {
var cookies = document.cookie.split(';');
......@@ -670,6 +682,7 @@ function getCookie(name) {
}
// Just for Garg
function printCorpuses() {
console.log('FUN extras_explorerjs:printCorpuses')
console.clear()
console.log( "!!!!!!!! Corpus chosen, going to make the diff !!!!!!!! " )
pr(corpusesList)
......@@ -768,7 +781,7 @@ function printCorpuses() {
// var pageurl = window.location.href.split("/")
// var cid;
// for(var i in pageurl) {
// if(pageurl[i]=="corpus") {
// if(pageurl[i]=="corpora") {
// cid=parseInt(i);
// break;
// }
......@@ -791,6 +804,7 @@ function printCorpuses() {
// Just for Garg
function GetUserPortfolio() {
console.log('FUN extras_explorerjs:GetUserPortfolio')
//http://localhost:8000/api/corpusintersection/1a50317a50145
var pageurl = window.location.href.split("/")
var pid;
......@@ -804,7 +818,7 @@ function GetUserPortfolio() {
var cid;
for(var i in pageurl) {
if(pageurl[i]=="corpus") {
if(pageurl[i]=="corpora") {
cid=parseInt(i);
break;
}
......@@ -908,6 +922,7 @@ function GetUserPortfolio() {
}
function camaraButton(){
console.log('FUN extras_explorerjs:camaraButton')
$("#PhotoGraph").click(function (){
//canvas=partialGraph._core.domElements.nodes;
......@@ -960,6 +975,7 @@ function camaraButton(){
}
function getTips(){
console.log('FUN extras_explorerjs:getTips')
param='';
text =
......
{"graph": [["name", "()"]], "links": [{"target": 34, "source": 54, "weight": 1}, {"target": 25, "source": 54, "weight": 1}, {"target": 10, "source": 54, "weight": 1}, {"target": 20, "source": 14, "weight": 1}, {"target": 67, "source": 14, "weight": 1}, {"target": 4, "source": 55, "weight": 1}, {"target": 38, "source": 55, "weight": 1}, {"target": 34, "source": 15, "weight": 1}, {"target": 33, "source": 56, "weight": 1}, {"target": 19, "source": 56, "weight": 1}, {"target": 73, "source": 56, "weight": 1}, {"target": 10, "source": 56, "weight": 1}, {"target": 26, "source": 57, "weight": 1}, {"target": 7, "source": 57, "weight": 1}, {"target": 76, "source": 0, "weight": 1}, {"target": 21, "source": 0, "weight": 1}, {"target": 75, "source": 0, "weight": 1}, {"target": 58, "source": 16, "weight": 1}, {"target": 77, "source": 16, "weight": 1}, {"target": 22, "source": 32, "weight": 1}, {"target": 21, "source": 32, "weight": 1}, {"target": 58, "source": 32, "weight": 1}, {"target": 74, "source": 33, "weight": 1}, {"target": 73, "source": 33, "weight": 1}, {"target": 67, "source": 34, "weight": 1}, {"target": 8, "source": 18, "weight": 1}, {"target": 7, "source": 18, "weight": 1}, {"target": 39, "source": 18, "weight": 1}, {"target": 51, "source": 35, "weight": 1}, {"target": 7, "source": 1, "weight": 1}, {"target": 53, "source": 1, "weight": 1}, {"target": 79, "source": 1, "weight": 1}, {"target": 46, "source": 59, "weight": 1}, {"target": 48, "source": 59, "weight": 1}, {"target": 42, "source": 59, "weight": 1}, {"target": 22, "source": 60, "weight": 1}, {"target": 78, "source": 60, "weight": 1}, {"target": 79, "source": 60, "weight": 1}, {"target": 40, "source": 61, "weight": 1}, {"target": 62, "source": 61, "weight": 1}, {"target": 17, "source": 61, "weight": 1}, {"target": 39, "source": 61, "weight": 1}, {"target": 12, "source": 9, "weight": 1}, {"target": 7, "source": 9, "weight": 1}, {"target": 4, "source": 36, "weight": 1}, {"target": 74, "source": 36, "weight": 1}, {"target": 3, "source": 36, "weight": 1}, {"target": 70, "source": 37, "weight": 1}, {"target": 49, "source": 37, "weight": 1}, {"target": 6, "source": 37, "weight": 1}, {"target": 69, "source": 19, "weight": 1}, {"target": 43, "source": 19, "weight": 1}, {"target": 10, "source": 19, "weight": 1}, {"target": 44, "source": 38, "weight": 1}, {"target": 64, "source": 7, "weight": 1}, {"target": 29, "source": 7, "weight": 1}, {"target": 53, "source": 7, "weight": 1}, {"target": 66, "source": 7, "weight": 1}, {"target": 27, "source": 7, "weight": 1}, {"target": 67, "source": 7, "weight": 1}, {"target": 17, "source": 62, "weight": 1}, {"target": 26, "source": 2, "weight": 1}, {"target": 4, "source": 2, "weight": 1}, {"target": 74, "source": 2, "weight": 1}, {"target": 75, "source": 12, "weight": 1}, {"target": 21, "source": 12, "weight": 1}, {"target": 69, "source": 43, "weight": 1}, {"target": 63, "source": 43, "weight": 1}, {"target": 69, "source": 63, "weight": 1}, {"target": 65, "source": 63, "weight": 1}, {"target": 11, "source": 52, "weight": 1}, {"target": 39, "source": 52, "weight": 1}, {"target": 51, "source": 20, "weight": 1}, {"target": 23, "source": 65, "weight": 1}, {"target": 66, "source": 4, "weight": 1}, {"target": 30, "source": 4, "weight": 1}, {"target": 44, "source": 4, "weight": 1}, {"target": 45, "source": 4, "weight": 1}, {"target": 22, "source": 21, "weight": 1}, {"target": 24, "source": 21, "weight": 1}, {"target": 75, "source": 21, "weight": 1}, {"target": 41, "source": 66, "weight": 1}, {"target": 22, "source": 5, "weight": 1}, {"target": 50, "source": 22, "weight": 1}, {"target": 42, "source": 23, "weight": 1}, {"target": 28, "source": 24, "weight": 1}, {"target": 75, "source": 24, "weight": 1}, {"target": 29, "source": 67, "weight": 1}, {"target": 71, "source": 68, "weight": 1}, {"target": 39, "source": 68, "weight": 1}, {"target": 73, "source": 25, "weight": 1}, {"target": 10, "source": 25, "weight": 1}, {"target": 72, "source": 31, "weight": 1}, {"target": 28, "source": 31, "weight": 1}, {"target": 77, "source": 69, "weight": 1}, {"target": 79, "source": 41, "weight": 1}, {"target": 13, "source": 41, "weight": 1}, {"target": 26, "source": 44, "weight": 1}, {"target": 48, "source": 46, "weight": 1}, {"target": 51, "source": 46, "weight": 1}, {"target": 6, "source": 70, "weight": 1}, {"target": 11, "source": 47, "weight": 1}, {"target": 28, "source": 72, "weight": 1}, {"target": 8, "source": 72, "weight": 1}, {"target": 8, "source": 28, "weight": 1}, {"target": 79, "source": 53, "weight": 1}, {"target": 79, "source": 13, "weight": 1}], "nodes": [{"id": "matrix solid-phase dispersion"}, {"id": "systemic insecticides"}, {"id": "pyrethroid insecticide"}, {"id": "honey bee colony losses"}, {"id": "neonicotinoid insecticides"}, {"id": "aqueous media"}, {"id": "tau-fluvalinate residues"}, {"id": "honey bees"}, {"id": "stir bar sorptive extraction"}, {"id": "field conditions"}, {"id": "dispersive liquid-liquid microextraction"}, {"id": "honeybee colonies"}, {"id": "environmental contaminants"}, {"id": "osmia lignaria"}, {"id": "honey bee colonies"}, {"id": "chromatographic determination"}, {"id": "case study"}, {"id": "adult honey bees"}, {"id": "high levels"}, {"id": "diode-array detection"}, {"id": "semi-field conditions"}, {"id": "gas chromatography"}, {"id": "degradation products"}, {"id": "veterinary drugs"}, {"id": "electron-capture detection"}, {"id": "organochlorine pesticides"}, {"id": "varroa mites"}, {"id": "repellent chemicals"}, {"id": "solid-phase microextraction"}, {"id": "bee products"}, {"id": "foraging behavior"}, {"id": "organophosphorus pesticides"}, {"id": "solid-phase extraction"}, {"id": "solvent extraction"}, {"id": "honey samples"}, {"id": "diamondback moth"}, {"id": "potential impact"}, {"id": "hive ( part"}, {"id": "colony population decline"}, {"id": "honey bee colony"}, {"id": "larval honey bees"}, {"id": "megachile rotundata"}, {"id": "life-history traits"}, {"id": "liquid chromatography"}, {"id": "honey bee"}, {"id": "fluvalinate resistance"}, {"id": "pesticide determination"}, {"id": "chronic exposure"}, {"id": "liquid chromatography-tandem mass spectrometry"}, {"id": "agricultural landscapes"}, {"id": "flight activity"}, {"id": "other insects"}, {"id": "plant protection products"}, {"id": "foraging activity"}, {"id": "gas chromatography-mass spectrometry"}, {"id": "colony collapse disorder"}, {"id": "high performance liquid chromatography"}, {"id": "assess sublethal effects"}, {"id": "crop pollination"}, {"id": "multi-residue method"}, {"id": "pesticide risk assessment"}, {"id": "biotin-binding protein"}, {"id": "hypopharyngeal glands"}, {"id": "sensitive method"}, {"id": "bumble bees"}, {"id": "simultaneous determination"}, {"id": "laboratory tests"}, {"id": "pesticide residues"}, {"id": "agricultural landscape"}, {"id": "neonicotinoid insecticides residues"}, {"id": "pesticide fate"}, {"id": "ecosystem services"}, {"id": "liquid chromatography-mass spectrometry"}, {"id": "bee pollen"}, {"id": "gas chromatographic"}, {"id": "mass spectrometric"}, {"id": "honey bee losses"}, {"id": "crop pollinators"}, {"id": "colony health"}, {"id": "sublethal effects"}], "multigraph": false, "directed": false}
\ No newline at end of file
This diff is collapsed.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
/**
* @preserve
* Project: Bootstrap Hover Dropdown
* Author: Cameron Spear
* Version: v2.0.10
* Contributors: Mattia Larentis
* Dependencies: Bootstrap's Dropdown plugin, jQuery
* Description: A simple plugin to enable Bootstrap dropdowns to active on hover and provide a nice user experience.
* License: MIT
* Homepage: http://cameronspear.com/blog/bootstrap-dropdown-on-hover-plugin/
*/
!function($,n,e){var o=$();$.fn.dropdownHover=function(e){return"ontouchstart"in document?this:(o=o.add(this.parent()),this.each(function(){function t(e){o.find(":focus").blur(),h.instantlyCloseOthers===!0&&o.removeClass("open"),n.clearTimeout(c),i.addClass("open"),r.trigger(a)}var r=$(this),i=r.parent(),d={delay:500,instantlyCloseOthers:!0},s={delay:$(this).data("delay"),instantlyCloseOthers:$(this).data("close-others")},a="show.bs.dropdown",u="hide.bs.dropdown",h=$.extend(!0,{},d,e,s),c;i.hover(function(n){return i.hasClass("open")||r.is(n.target)?void t(n):!0},function(){c=n.setTimeout(function(){i.removeClass("open"),r.trigger(u)},h.delay)}),r.hover(function(n){return i.hasClass("open")||i.is(n.target)?void t(n):!0}),i.find(".dropdown-submenu").each(function(){var e=$(this),o;e.hover(function(){n.clearTimeout(o),e.children(".dropdown-menu").show(),e.siblings().children(".dropdown-menu").hide()},function(){var t=e.children(".dropdown-menu");o=n.setTimeout(function(){t.hide()},h.delay)})})}))},$(document).ready(function(){$('[data-hover="dropdown"]').dropdownHover()})}(jQuery,this);
\ No newline at end of file
/* =========================================================
* bootstrap-modal.js v2.0.2
* http://twitter.github.com/bootstrap/javascript.html#modals
* =========================================================
* Copyright 2012 Twitter, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* ========================================================= */
!function( $ ){
"use strict"
/* MODAL CLASS DEFINITION
* ====================== */
var Modal = function ( content, options ) {
this.options = options
this.$element = $(content)
.delegate('[data-dismiss="modal"]', 'click.dismiss.modal', $.proxy(this.hide, this))
}
Modal.prototype = {
constructor: Modal
, toggle: function () {
return this[!this.isShown ? 'show' : 'hide']()
}
, show: function () {
var that = this
if (this.isShown) return
$('body').addClass('modal-open')
this.isShown = true
this.$element.trigger('show')
escape.call(this)
backdrop.call(this, function () {
var transition = $.support.transition && that.$element.hasClass('fade')
!that.$element.parent().length && that.$element.appendTo(document.body) //don't move modals dom position
that.$element
.show()
if (transition) {
that.$element[0].offsetWidth // force reflow
}
that.$element.addClass('in')
transition ?
that.$element.one($.support.transition.end, function () { that.$element.trigger('shown') }) :
that.$element.trigger('shown')
})
}
, hide: function ( e ) {
e && e.preventDefault()
if (!this.isShown) return
var that = this
this.isShown = false
$('body').removeClass('modal-open')
escape.call(this)
this.$element
.trigger('hide')
.removeClass('in')
$.support.transition && this.$element.hasClass('fade') ?
hideWithTransition.call(this) :
hideModal.call(this)
}
}
/* MODAL PRIVATE METHODS
* ===================== */
function hideWithTransition() {
var that = this
, timeout = setTimeout(function () {
that.$element.off($.support.transition.end)
hideModal.call(that)
}, 500)
this.$element.one($.support.transition.end, function () {
clearTimeout(timeout)
hideModal.call(that)
})
}
function hideModal( that ) {
this.$element
.hide()
.trigger('hidden')
backdrop.call(this)
}
function backdrop( callback ) {
var that = this
, animate = this.$element.hasClass('fade') ? 'fade' : ''
if (this.isShown && this.options.backdrop) {
var doAnimate = $.support.transition && animate
this.$backdrop = $('<div class="modal-backdrop ' + animate + '" />')
.appendTo(document.body)
if (this.options.backdrop != 'static') {
this.$backdrop.click($.proxy(this.hide, this))
}
if (doAnimate) this.$backdrop[0].offsetWidth // force reflow
this.$backdrop.addClass('in')
doAnimate ?
this.$backdrop.one($.support.transition.end, callback) :
callback()
} else if (!this.isShown && this.$backdrop) {
this.$backdrop.removeClass('in')
$.support.transition && this.$element.hasClass('fade')?
this.$backdrop.one($.support.transition.end, $.proxy(removeBackdrop, this)) :
removeBackdrop.call(this)
} else if (callback) {
callback()
}
}
function removeBackdrop() {
this.$backdrop.remove()
this.$backdrop = null
}
function escape() {
var that = this
if (this.isShown && this.options.keyboard) {
$(document).on('keyup.dismiss.modal', function ( e ) {
e.which == 27 && that.hide()
})
} else if (!this.isShown) {
$(document).off('keyup.dismiss.modal')
}
}
/* MODAL PLUGIN DEFINITION
* ======================= */
$.fn.modal = function ( option ) {
return this.each(function () {
var $this = $(this)
, data = $this.data('modal')
, options = $.extend({}, $.fn.modal.defaults, $this.data(), typeof option == 'object' && option)
if (!data) $this.data('modal', (data = new Modal(this, options)))
if (typeof option == 'string') data[option]()
else if (options.show) data.show()
})
}
$.fn.modal.defaults = {
backdrop: true
, keyboard: true
, show: true
}
$.fn.modal.Constructor = Modal
/* MODAL DATA-API
* ============== */
$(function () {
$('body').on('click.modal.data-api', '[data-toggle="modal"]', function ( e ) {
var $this = $(this), href
, $target = $($this.attr('data-target') || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '')) //strip for ie7
, option = $target.data('modal') ? 'toggle' : $.extend({}, $target.data(), $this.data())
e.preventDefault()
$target.modal(option)
})
})
}( window.jQuery );
\ No newline at end of file
This diff is collapsed.
/* ===================================================
* bootstrap-transition.js v2.0.2
* http://twitter.github.com/bootstrap/javascript.html#transitions
* ===================================================
* Copyright 2012 Twitter, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* ========================================================== */
!function( $ ) {
$(function () {
"use strict"
/* CSS TRANSITION SUPPORT (https://gist.github.com/373874)
* ======================================================= */
$.support.transition = (function () {
var thisBody = document.body || document.documentElement
, thisStyle = thisBody.style
, support = thisStyle.transition !== undefined || thisStyle.WebkitTransition !== undefined || thisStyle.MozTransition !== undefined || thisStyle.MsTransition !== undefined || thisStyle.OTransition !== undefined
return support && {
end: (function () {
var transitionEnd = "TransitionEnd"
// if ( $.browser.webkit ) {
// transitionEnd = "webkitTransitionEnd"
// } else if ( $.browser.mozilla ) {
// transitionEnd = "transitionend"
// } else if ( $.browser.opera ) {
// transitionEnd = "oTransitionEnd"
// }
return transitionEnd
}())
}
})()
})
}( window.jQuery );
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
body{padding-top:50px}#banner{border-bottom:0}.page-header h1{font-size:4em}.bs-docs-section{margin-top:8em}.affix{top:70px}footer{margin:5em 0}footer li{float:left;margin-right:1.5em;margin-bottom:1.5em}footer p{margin-bottom:0;clear:left}.splash{padding:6em 0 2em;color:#fff;text-align:center;background:-webkit-linear-gradient(70deg,#080f1f 30%,#2b4b5a 87%,#435e67 100%);background:-o-linear-gradient(70deg,#080f1f 30%,#2b4b5a 87%,#435e67 100%);background:-ms-linear-gradient(70deg,#080f1f 30%,#2b4b5a 87%,#435e67 100%);background:-moz-linear-gradient(70deg,#080f1f 30%,#2b4b5a 87%,#435e67 100%);background:linear-gradient(20deg,#080f1f 30%,#2b4b5a 87%,#435e67 100%);background-attachment:fixed;background-color:#1c2533}.splash .alert{margin:4em 0 2em}.splash h1{font-size:4em}.splash #social{margin-top:6em}.section-tout{padding:4em 0 3em;background-color:#eaf1f1;border-top:1px solid rgba(255,255,255,0.1);border-bottom:1px solid rgba(0,0,0,0.1)}.section-tout [class^="icon-"]{margin-right:.5em}.section-tout p{margin-bottom:3em}.section-preview{padding:4em 0 4em}.section-preview .preview{margin-bottom:4em;background-color:#eaf1f1;border:1px solid rgba(0,0,0,0.1);border-radius:6px}.section-preview .preview .image{padding:5px}.section-preview .preview .image img{border:1px solid rgba(0,0,0,0.1)}.section-preview .preview .options{padding:0 2em 2em;text-align:center}.section-preview .preview .options p{margin-bottom:2em}.section-preview .dropdown-menu{text-align:left}.section-preview .lead{margin-bottom:2em}@media(max-width:767px){.section-preview .image img{width:100%}}.bsa .one .bsa_it_ad{background-color:transparent!important;border:none!important}.bsa .one .bsa_it_ad .bsa_it_t,.bsa .one .bsa_it_ad .bsa_it_d{color:inherit!important}.bsa .one .bsa_it_p{display:none}
$('[data-toggle="tooltip"]').tooltip();
\ No newline at end of file
(function(){
var bsa = document.createElement('script');
bsa.type = 'text/javascript';
bsa.async = true;
bsa.src = 'http://s3.buysellads.com/ac/bsa.js';
(document.getElementsByTagName('head')[0]||document.getElementsByTagName('body')[0]).appendChild(bsa);
})();
\ No newline at end of file
This diff is collapsed.
#heatgraph {
/*border: 1px solid #000;*/
width: 700px;
height:50px;
bottom: 10px;
position:absolute;
left: 0;
right: 0;
margin: 0 auto;
}
.loader{
text-align:center;
transform: translate(0, 50%) !important;
-ms-transform: translate(0, 50%) !important; /*IE 9*/
-webkit-transform: translate(0, 50%) !important; /*Safari and Chrome */
}
.navbar {
margin-bottom:1px;
}
#defaultop{
min-height: 5%;
max-height: 10%;
}
#sigma-example {
width: 100%;
height: 300px;
position:relative;
float:left;
}
.clusters_legend {
position:absolute;
bottom:1px;
left:1px;
border:solid 1px red;
font-size:xx-small;
}
.my-legend {
position:absolute;
bottom:5px;
left:5px;
background-color:white;
opacity: 0.8;
color:#250587;
margin: 7px;
padding: 5px;
-moz-border-radius: 3px;
-webkit-border-radius: 3px;
-border-radius: 3px;
-moz-box-shadow: 0px 2px 6px #000;
-webkit-box-shadow: 0px 2px 6px #000;
box-shadow: 0px 2px 6px #000;
}
.my-legend .legend-title {
text-align: left;
margin-bottom: 5px;
font-weight: bold;
font-size: 90%;
}
.my-legend .legend-scale ul {
margin: 0;
margin-bottom: 5px;
padding: 0;
float: left;
list-style: none;
}
.my-legend .legend-scale ul li {
font-size: 80%;
list-style: none;
margin-left: 0;
line-height: 18px;
margin-bottom: 2px;
}
.my-legend ul.legend-labels li span {
display: block;
float: left;
height: 16px;
width: 30px;
margin-right: 5px;
margin-left: 0;
border: 1px solid #999;
}
.my-legend .legend-source {
font-size: 70%;
color: #999;
clear: both;
}
.my-legend a {
color: #777;
}
/*.btn-sm[normal] {*/
/* background-image: -webkit-linear-gradient(#5f8ab9, #3e648d 50%, #385a7f);*/
/* background-image: linear-gradient(#5f8ab9, #3e648d 50%, #385a7f);*/
/* background-repeat: no-repeat;*/
/* filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff5f8ab9', endColorstr='#ff385a7f', GradientType=0);*/
/* filter: none;*/
/* border: 1px solid #2e4b69;*/
/*}*/
#left{
display: inline-block;
}
/*.modal-vertical-centered {*/
#selectionsBox{
text-align:center;
background-color:white;
color:#250587;
margin: 7px;
padding: 3px;
border: 1px solid #666;
-moz-border-radius: 3px;
-webkit-border-radius: 3px;
-border-radius: 3px;
-moz-box-shadow: 0px 2px 6px #000;
-webkit-box-shadow: 0px 2px 6px #000;
box-shadow: 0px 2px 6px #000;
}
/*.selection-item{
display:inline-block;
border:solid 1px;
-moz-border-radius: 6px;
-webkit-border-radius: 6px;
-khtml-border-radius: 6px;'+
border-color:#BDBDBD;
padding:0px 2px 0px 2px;
margin:1px 0px 1px 0px;
cursor: pointer;
}*/
#opossitesBox{
margin: 7px;
padding: 10px;
border-style:solid;
background-color:white;
margin: 7px;
border: 1px solid #666;
-moz-border-radius: 3px;
-webkit-border-radius: 3px;
-border-radius: 3px;
-moz-box-shadow: 0px 2px 6px #000;
-webkit-box-shadow: 0px 2px 6px #000;
box-shadow: 0px 2px 6px #000;
}
.tagcloud-item{
display:inline-block;
border:solid 1px;
/*box-shadow: 0px 0px 0px 1px rgba(0,0,0,0.3); */
-moz-border-radius: 6px;
-webkit-border-radius: 6px;
-khtml-border-radius: 6px;'+
border-color:#BDBDBD;
padding:0px 2px 0px 2px;
margin:1px 0px 1px 0px;
cursor: pointer;
}
#topPapers{
margin: 7px;
padding: 10px 0px 10px 10px;
border-style:solid;
background-color:white;
color:black;
margin: 7px;
border: 1px solid #666;
-moz-border-radius: 3px;
-webkit-border-radius: 3px;
-border-radius: 3px;
-moz-box-shadow: 0px 2px 6px #000;
-webkit-box-shadow: 0px 2px 6px #000;
box-shadow: 0px 2px 6px #000;
}
#topProposals{
margin: 7px;
padding: 10px 0px 10px 10px;
border-style:solid;
background-color:white;
color:black;
margin: 7px;
border: 1px solid #666;
-moz-border-radius: 3px;
-webkit-border-radius: 3px;
-border-radius: 3px;
-moz-box-shadow: 0px 2px 6px #000;
-webkit-box-shadow: 0px 2px 6px #000;
box-shadow: 0px 2px 6px #000;
}
.grey {
color: #cccccc; font-style: italic;
}
.gradient {
background-color: #f0f0f8;
background-image: -webkit-radial-gradient(#ffffff, #d8d8e0); background-image: -moz-radial-gradient(#ffffff, #d8d8e0);
/*background-color: #434343;*/
/*background-image: linear-gradient(#434343, #282828);*/
background-image: linear-gradient(0deg, transparent 24%, rgba(0, 0, 0, .02) 25%, rgba(0, 0, 0, .02) 26%, transparent 27%, transparent 74%, rgba(0, 0, 0, .02) 75%, rgba(0, 0, 0, .02) 76%, transparent 77%, transparent), linear-gradient(90deg, transparent 24%, rgba(0, 0, 0, .02) 25%, rgba(0, 0, 0, .02) 26%, transparent 27%, transparent 74%, rgba(0, 0, 0, .02) 75%, rgba(0, 0, 0, .02) 76%, transparent 77%, transparent);
background-size: 50px 50px;
}
/* ZOOM IN OUT */
#ctlzoom {
position: absolute; right: 300px; bottom: 5px; list-style: none; padding: 0; margin: 0;/*EDIT*/
}
#ctlzoom li {
padding: 0; margin: 10px 0; width: 36px; text-align: center;
}
#zoomSliderzone {
height: 120px;
}
#zoomMinusButton, #zoomPlusButton {
display: block; width: 24px; height: 24px; background:url("../img2/plusmoins.png"); margin: 0 auto;
}
#zoomMinusButton {
background-position: 0 -24px;
}
#zoomMinusButton:hover {
background-position: -24px -24px;
}
#zoomPlusButton {
background-position: 0 0;
}
#zoomPlusButton:hover {
background-position: -24px 0;
}
#lensButton {
display: block; width: 36px; height: 36px; background:url("../img2/loupe-edges2.png"); margin: 0 auto;
}
#lensButton {
background-position: -72px 0;
}
#lensButton:hover {
background-position: -36px 0;
}
#lensButton.off {
background-position: 0 0;
}
#lensButton.off:hover {
background-position: -108px 0;
}
#edgesButton {
display: block; width: 36px; height: 36px; background:url("../img2/loupe-edges.png"); margin: 0 auto;
}
#edgesButton {
background-position: -72px -36px;
}
#edgesButton:hover {
background-position: -36px -36px;
}
#edgesButton.off {
background-position: 0 -36px;
}
#edgesButton.off:hover {
background-position: -108px -36px;
}
#unfold {
width: 12px; height: 12px; background: rgb(250, 250, 252); padding: 2px 2px 2px 0; border-top-right-radius: 5px; border-bottom-right-radius: 5px; box-shadow: 1px 1px 2px #808090;
}
#aUnfold {
display: block; width: 12px; height: 12px; background-image: url("../img2/fleches-horiz.png"); margin: 0 auto;
}
/*
#saveAs {
display: block; width: 30px; height: 30px; background:url("../img2/Save.png"); margin: 0 auto;
}
*/
#zoomSlider {
background:#fff;
border:1px solid #aaa;
height: 120px; margin: 0 auto;
}
#showChat{
position: absolute; top: 16px; right: -14px; width: 20px; height: 100px; background: rgb(250, 250, 252); padding: 2px 2px 2px 0; border-top-left-radius: 5px; border-bottom-left-radius: 5px; box-shadow: 1px 1px 2px #808090;
}
#aShowChat {
float: right; width: 100%; height: 100%; background-image: url("../img2/chat.png");
}
/* GESTION DE LA BARRE DE GAUCHE */
.leftarrow {
background-position: -12px 0;
}
.rightarrow {
background-position: 0 0;
}
.leftarrow:hover {
background-position: -12px -12px;
}
.rightarrow:hover {
background-position: 0 -12px;
}
#tips{
padding-left: 5%;
padding-right: 5%;
font-size:80%;
}
#tips ul{
/*list-style:none;*/
padding-left:10%;
}
#information {
font-size:80%;
}
#information ul {
list-style:none;
padding-left:5%;
}
.btn-sm:hover {
font-weight: bold;
}
/* Example Styles for Demo */
.etabs { margin: 0; padding: 0; }
.tab { display: inline-block; zoom:1; *display:inline; background: #eee; border: solid 1px #999; border-bottom: none; -moz-border-radius: 4px 4px 0 0; -webkit-border-radius: 4px 4px 0 0; }
.tab a { font-size: 12px; line-height: 2em; display: block; padding: 0 10px; outline: none; }
.tab a:hover { text-decoration: underline; }
.tab.active { background: #fff; padding-top: 6px; position: relative; top: 1px; border-color: #666; }
.tab a.active { font-weight: bold; }
.tab-container .panel-container { background: #fff; border: solid #666 1px; padding: 10px; -moz-border-radius: 0 4px 4px 4px; -webkit-border-radius: 0 4px 4px 4px; }
.panel-container { margin-bottom: 10px; }
@font-face {
font-family: 'Josefin Sans';
font-style: normal;
font-weight: 300;
src: local('Josefin Sans Light'), local('JosefinSans-Light'), url('JosefinSans300.woff') format('woff');
}
@font-face {
font-family: 'Josefin Sans';
font-style: normal;
font-weight: 400;
src: local('Josefin Sans'), local('JosefinSans'), url('JosefinSans400.woff') format('woff');
}
@font-face {
font-family: 'Josefin Sans';
font-style: normal;
font-weight: 700;
src: local('Josefin Sans Bold'), local('JosefinSans-Bold'), url('JosefinSans700.woff') format('woff');
}
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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