diff --git a/.gradle/4.10.3/fileContent/fileContent.lock b/.gradle/4.10.3/fileContent/fileContent.lock
index ae240d8..2cf0f19 100644
Binary files a/.gradle/4.10.3/fileContent/fileContent.lock and b/.gradle/4.10.3/fileContent/fileContent.lock differ
diff --git a/.gradle/4.10.3/fileHashes/fileHashes.bin b/.gradle/4.10.3/fileHashes/fileHashes.bin
index 88948f2..b6b0b5a 100644
Binary files a/.gradle/4.10.3/fileHashes/fileHashes.bin and b/.gradle/4.10.3/fileHashes/fileHashes.bin differ
diff --git a/.gradle/4.10.3/fileHashes/fileHashes.lock b/.gradle/4.10.3/fileHashes/fileHashes.lock
index 6555221..d71c35c 100644
Binary files a/.gradle/4.10.3/fileHashes/fileHashes.lock and b/.gradle/4.10.3/fileHashes/fileHashes.lock differ
diff --git a/.gradle/4.10.3/javaCompile/classAnalysis.bin b/.gradle/4.10.3/javaCompile/classAnalysis.bin
index d177f16..0000009 100644
Binary files a/.gradle/4.10.3/javaCompile/classAnalysis.bin and b/.gradle/4.10.3/javaCompile/classAnalysis.bin differ
diff --git a/.gradle/4.10.3/javaCompile/javaCompile.lock b/.gradle/4.10.3/javaCompile/javaCompile.lock
index ffd5eb1..dd6344f 100644
Binary files a/.gradle/4.10.3/javaCompile/javaCompile.lock and b/.gradle/4.10.3/javaCompile/javaCompile.lock differ
diff --git a/.gradle/4.10.3/taskHistory/taskHistory.bin b/.gradle/4.10.3/taskHistory/taskHistory.bin
index 74d7fb6..99e4df8 100644
Binary files a/.gradle/4.10.3/taskHistory/taskHistory.bin and b/.gradle/4.10.3/taskHistory/taskHistory.bin differ
diff --git a/.gradle/4.10.3/taskHistory/taskHistory.lock b/.gradle/4.10.3/taskHistory/taskHistory.lock
index f7a41e8..0b9a483 100644
Binary files a/.gradle/4.10.3/taskHistory/taskHistory.lock and b/.gradle/4.10.3/taskHistory/taskHistory.lock differ
diff --git a/.gradle/buildOutputCleanup/buildOutputCleanup.lock b/.gradle/buildOutputCleanup/buildOutputCleanup.lock
index 3e1a6c3..22661ad 100644
Binary files a/.gradle/buildOutputCleanup/buildOutputCleanup.lock and b/.gradle/buildOutputCleanup/buildOutputCleanup.lock differ
diff --git a/.idea/vcs.xml b/.idea/vcs.xml
index 35eb1dd..eaeec96 100644
--- a/.idea/vcs.xml
+++ b/.idea/vcs.xml
@@ -2,5 +2,6 @@
+
\ No newline at end of file
diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index 32f9703..ff33872 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -2,46 +2,123 @@
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
-
+
-
+
+
+
-
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -68,39 +145,97 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
+
+
-
-
+
+
-
+
-
-
+
+
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
+
+
@@ -109,13 +244,10 @@
-
+
-
-
-
-
-
+
+
@@ -123,8 +255,8 @@
-
-
+
+
@@ -132,52 +264,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -189,36 +275,36 @@
- build
- ANA
- getD
- Start
- getKeywordsPatent
- getFirst
- asPercentile
- Failed to analyze Document with DOI
- removeOne
- remove
- asPerce
- Starte
- Star
- indexOf('D')
- saveNewerXML
- Now Im
- getPatents
- sort
- sortJson
- getFirst50
- None
- Classification
- "D"
- KeywordsPerYear
- RelativeKeywor
- getDocum
- Keywords
- getKeywordsDocumentPer
+ CPCFr
+ getAmount
+ Org
+ Inventor
+ CITY
+ <PDAT>
+ All
+ inventor
+ Classification miss
+ h
+ "h"
+ Classificat
+ searchComplex
+ search
+ excel
+ Auth
+ authors
+ getKEy
+ GetAll
+ Laden der
+ full
+ Doi
+ starte
+ Laden der PatentKe
+ Authors
+ Starte Key
+ Author
+ Starte Au
getKeywords
- getKeywo
+ Cit
@@ -244,34 +330,36 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
+
+
-
+
+
@@ -314,9 +402,14 @@
-
+
+
+
+
+
+
+
-
@@ -332,7 +425,7 @@
-
+
@@ -344,6 +437,7 @@
+
@@ -382,8 +476,8 @@
-
+
@@ -434,13 +528,29 @@
1609359396288
-
+
+ 1610986466673
+
+
+
+ 1610986466673
+
+
+
+
+
+
+
+
+
+
+
-
+
@@ -449,14 +559,14 @@
-
-
+
+
-
+
-
-
+
+
@@ -472,7 +582,7 @@
-
+
@@ -481,14 +591,14 @@
-
-
+
+
-
+
-
-
+
+
@@ -512,7 +622,8 @@
-
+
+
@@ -520,76 +631,38 @@
-
- file://$PROJECT_DIR$/src/main/java/USPCCrawler.java
- 86
-
-
-
-
- file://$PROJECT_DIR$/src/main/java/USPCImporter.java
- 33
-
-
-
file://$PROJECT_DIR$/src/main/java/PatentImporter.java
- 567
+ 686
- file://$PROJECT_DIR$/src/main/java/FilterBuilderPatent.java
- 90
+ file://$PROJECT_DIR$/src/main/java/DocumentQueries.java
+ 429
-
+
+
+
+ file://$PROJECT_DIR$/src/main/java/PatentQueries.java
+ 459
+
+
-
-
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
@@ -609,34 +682,7 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
@@ -658,58 +704,120 @@
-
-
-
-
-
-
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -717,103 +825,41 @@
-
+
-
-
+
+
-
+
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
@@ -822,59 +868,113 @@
-
-
+
+
-
+
-
-
+
+
+
+
+
+
-
-
+
+
-
-
+
+
+
+
-
+
-
-
+
+
+
+
+
-
+
-
-
+
+
-
+
-
-
+
+
+
+
+
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/build/classes/java/main/CPCImporter.class b/build/classes/java/main/CPCImporter.class
index 9020596..af3b9ef 100644
Binary files a/build/classes/java/main/CPCImporter.class and b/build/classes/java/main/CPCImporter.class differ
diff --git a/build/classes/java/main/CorporatePatentClassificationCrawler.class b/build/classes/java/main/CorporatePatentClassificationCrawler.class
index e8c0ccb..a3cc2c4 100644
Binary files a/build/classes/java/main/CorporatePatentClassificationCrawler.class and b/build/classes/java/main/CorporatePatentClassificationCrawler.class differ
diff --git a/build/classes/java/main/DocumentQueries.class b/build/classes/java/main/DocumentQueries.class
index 2353989..f025b8a 100644
Binary files a/build/classes/java/main/DocumentQueries.class and b/build/classes/java/main/DocumentQueries.class differ
diff --git a/build/classes/java/main/DoneAnalyzes.class b/build/classes/java/main/DoneAnalyzes.class
index 34bc311..c90e3de 100644
Binary files a/build/classes/java/main/DoneAnalyzes.class and b/build/classes/java/main/DoneAnalyzes.class differ
diff --git a/build/classes/java/main/FilterBuilderDocument.class b/build/classes/java/main/FilterBuilderDocument.class
index 7350d17..1801cf8 100644
Binary files a/build/classes/java/main/FilterBuilderDocument.class and b/build/classes/java/main/FilterBuilderDocument.class differ
diff --git a/build/classes/java/main/FilterBuilderPatent.class b/build/classes/java/main/FilterBuilderPatent.class
index e2537d7..d65ab06 100644
Binary files a/build/classes/java/main/FilterBuilderPatent.class and b/build/classes/java/main/FilterBuilderPatent.class differ
diff --git a/build/classes/java/main/Main$1.class b/build/classes/java/main/Main$1.class
index c3ed96e..eec0481 100644
Binary files a/build/classes/java/main/Main$1.class and b/build/classes/java/main/Main$1.class differ
diff --git a/build/classes/java/main/Main$2.class b/build/classes/java/main/Main$2.class
index e28ddf1..5afe1b2 100644
Binary files a/build/classes/java/main/Main$2.class and b/build/classes/java/main/Main$2.class differ
diff --git a/build/classes/java/main/Main$3.class b/build/classes/java/main/Main$3.class
index cbcd18c..9ab9272 100644
Binary files a/build/classes/java/main/Main$3.class and b/build/classes/java/main/Main$3.class differ
diff --git a/build/classes/java/main/Main$4.class b/build/classes/java/main/Main$4.class
index e94afa3..c6ade3b 100644
Binary files a/build/classes/java/main/Main$4.class and b/build/classes/java/main/Main$4.class differ
diff --git a/build/classes/java/main/Main.class b/build/classes/java/main/Main.class
index 520e0d8..03426f3 100644
Binary files a/build/classes/java/main/Main.class and b/build/classes/java/main/Main.class differ
diff --git a/build/classes/java/main/Mapper.class b/build/classes/java/main/Mapper.class
index 6acb127..4f6d6cf 100644
Binary files a/build/classes/java/main/Mapper.class and b/build/classes/java/main/Mapper.class differ
diff --git a/build/classes/java/main/PatentImporter.class b/build/classes/java/main/PatentImporter.class
index 445cb0f..e69fdfb 100644
Binary files a/build/classes/java/main/PatentImporter.class and b/build/classes/java/main/PatentImporter.class differ
diff --git a/build/classes/java/main/PatentQueries.class b/build/classes/java/main/PatentQueries.class
index d3582be..1a1b5a7 100644
Binary files a/build/classes/java/main/PatentQueries.class and b/build/classes/java/main/PatentQueries.class differ
diff --git a/build/classes/java/main/Queries.class b/build/classes/java/main/Queries.class
deleted file mode 100644
index cfa6404..0000000
Binary files a/build/classes/java/main/Queries.class and /dev/null differ
diff --git a/build/classes/java/main/QuerySupport.class b/build/classes/java/main/QuerySupport.class
index 634d3c9..fed43fb 100644
Binary files a/build/classes/java/main/QuerySupport.class and b/build/classes/java/main/QuerySupport.class differ
diff --git a/build/classes/java/main/Server$AnalyzeHandler.class b/build/classes/java/main/Server$AnalyzeHandler.class
index caee3c9..6d6dcd0 100644
Binary files a/build/classes/java/main/Server$AnalyzeHandler.class and b/build/classes/java/main/Server$AnalyzeHandler.class differ
diff --git a/build/classes/java/main/Server$QueryHandler.class b/build/classes/java/main/Server$QueryHandler.class
index 8b1a6fa..8ca0ba6 100644
Binary files a/build/classes/java/main/Server$QueryHandler.class and b/build/classes/java/main/Server$QueryHandler.class differ
diff --git a/build/classes/java/main/Server$SearchHandler.class b/build/classes/java/main/Server$SearchHandler.class
index 3c684fb..73169cc 100644
Binary files a/build/classes/java/main/Server$SearchHandler.class and b/build/classes/java/main/Server$SearchHandler.class differ
diff --git a/build/classes/java/main/Server.class b/build/classes/java/main/Server.class
index d9780d0..a32d19e 100644
Binary files a/build/classes/java/main/Server.class and b/build/classes/java/main/Server.class differ
diff --git a/build/classes/java/main/Settings.class b/build/classes/java/main/Settings.class
index 1f9b5df..b23ad9b 100644
Binary files a/build/classes/java/main/Settings.class and b/build/classes/java/main/Settings.class differ
diff --git a/build/classes/java/main/USPCCrawler.class b/build/classes/java/main/USPCCrawler.class
index d77d22c..74bf18b 100644
Binary files a/build/classes/java/main/USPCCrawler.class and b/build/classes/java/main/USPCCrawler.class differ
diff --git a/build/classes/java/main/USPCImporter.class b/build/classes/java/main/USPCImporter.class
index d77f277..3684327 100644
Binary files a/build/classes/java/main/USPCImporter.class and b/build/classes/java/main/USPCImporter.class differ
diff --git a/build/classes/java/main/WOSImporter.class b/build/classes/java/main/WOSImporter.class
index 911ea1f..964889e 100644
Binary files a/build/classes/java/main/WOSImporter.class and b/build/classes/java/main/WOSImporter.class differ
diff --git a/build/classes/java/main/WoSCrawler$1.class b/build/classes/java/main/WoSCrawler$1.class
index ceef485..38d9682 100644
Binary files a/build/classes/java/main/WoSCrawler$1.class and b/build/classes/java/main/WoSCrawler$1.class differ
diff --git a/build/classes/java/main/WoSCrawler.class b/build/classes/java/main/WoSCrawler.class
index 08f555b..a07a936 100644
Binary files a/build/classes/java/main/WoSCrawler.class and b/build/classes/java/main/WoSCrawler.class differ
diff --git a/build/resources/main/analyse.html b/build/resources/main/analyse.html
deleted file mode 100644
index 46ba897..0000000
--- a/build/resources/main/analyse.html
+++ /dev/null
@@ -1,90 +0,0 @@
-
-
-
-
-
- Analyse
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Dokumente
-
- Anzahl der Dokumente über die Jahre (Absolut)
-
-
-
-
- Anzahl der Dokumente über die Jahre (Relativ zum letztem Jahr)
-
-
-
-
-
- Patente
-
- Anzahl der Patente über die Jahre (Absolut)
-
-
-
- Anzahl der Patente über die Jahre (Relativ zum letztem Jahr)
-
-
-
-
- Vergleich
-
- Vergleich der Anzahl basierend auf dem prozentualen Unterschied zum Vorjahr
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/build/resources/main/analyseStyles.css b/build/resources/main/analyseStyles.css
deleted file mode 100644
index cdd717c..0000000
--- a/build/resources/main/analyseStyles.css
+++ /dev/null
@@ -1,6 +0,0 @@
-.yearContainer {
- width: 100vw;
- height: 40vw;
- border-top: black 1px solid;
- border-bottom: black 1px solid;
- }
\ No newline at end of file
diff --git a/build/resources/main/commonStyles.css b/build/resources/main/commonStyles.css
deleted file mode 100644
index 5ea4d13..0000000
--- a/build/resources/main/commonStyles.css
+++ /dev/null
@@ -1,73 +0,0 @@
-.body {
- font-family: "Lato", sans-serif;
- margin:0px;
-}
-
-.container {
- display: grid;
- grid-template-columns: 1fr;
-}
-
-.nav-wrapper {
- display: flex;
- justify-content: space-between;
- padding: 38px;
-}
-
-.left-side {
- display: flex;
-}
-
-.nav-wrapper > .left-side > div {
- margin-right: 20px;
- font-size: 0.9em;
-}
-
-.nav-link-wrapper{
- height: 22px;
- border-bottom: 1px solid transparent;
- transition: border-bottom 0.5s;
-}
-
-.nav-link-wrapper a {
- color :#8a8a8a;
- text-decoration: none;
- transition: color 0.5s;
-}
-
-.nav-link-wrapper:hover {
- border-bottom: 1px solid black;
-}
-
-.nav-link-wrapper:hover a {
- color: black;
-}
-
-.active-nav-link a {
- color: black;
-}
-
-.active-nav-link {
- border-bottom: 1px solid black;
-}
-
-details {
- padding: 15px;
- margin-bottom: 15px;
-}
-
-.loader {
- border: 16px solid #f3f3f3; /* Light grey */
- border-top: 16px solid #3498db; /* Blue */
- border-radius: 50%;
- width: 120px;
- height: 120px;
- animation: spin 2s linear infinite;
- margin: auto;
- margin-top: 20%;
-}
-
-@keyframes spin {
- 0% { transform: rotate(0deg); }
- 100% { transform: rotate(360deg); }
-}
\ No newline at end of file
diff --git a/build/resources/main/currentSearch.js b/build/resources/main/currentSearch.js
deleted file mode 100644
index 354291d..0000000
--- a/build/resources/main/currentSearch.js
+++ /dev/null
@@ -1,53 +0,0 @@
-document.getElementById("submitAnalyse").onclick = function () { search() }
-
-function search() {
- var searchString = document.getElementById("idSearchBar").value;
- if (searchString == "") {
- window.sessionStorage.setItem("search", "None");
- window.location.href = "analyse.html";
- }
-
- var search = new String();
-
- if (document.getElementById('checkBoxTopic').checked == true) {
- if (search.length > 0) {
- search = search + " OR ";
- }
- search = search + "TS=('" + searchString + "')"
- }
-
- if (document.getElementById('checkBoxAK').checked == true) {
- if (search.length > 0) {
- search = search + " OR ";
- }
- search = search + "AK=('" + searchString + "')"
- }
-
- if (document.getElementById('checkBoxKP').checked == true) {
- if (search.length > 0) {
- search = search + " OR ";
- }
- search = search + "KP=('" + searchString + "')"
- }
-
- if (document.getElementById('checkBoxRA').checked == true) {
- if (search.length > 0) {
- search = search + " OR ";
- }
- search = search + "SU=('" + searchString + "')"
- }
-
- if (document.getElementById('checkBoxWOSCategory').checked == true) {
- if (search.length > 0) {
- search = search + " OR ";
- }
- search = search + "WC=('" + searchString + "')"
- }
-
- window.sessionStorage.setItem("search", search);
-
- window.location.href = "analyse.html";
-
-
-
-}
\ No newline at end of file
diff --git a/build/resources/main/currentSearchScript.js b/build/resources/main/currentSearchScript.js
deleted file mode 100644
index b4502f2..0000000
--- a/build/resources/main/currentSearchScript.js
+++ /dev/null
@@ -1,31 +0,0 @@
-xhrCurrent = new XMLHttpRequest();
-url = 'http://localhost:8000/searches';
-xhrCurrent.open("POST", url, true);
-xhrCurrent.setRequestHeader('Access-Control-Allow-Methods', 'POST');
-xhrCurrent.setRequestHeader("Content-Type", "application/json");
-xhrCurrent.onerror = function () {
- alert("Fehler");
-}
-xhrCurrent.onreadystatechange = function () {
- if (xhrCurrent.readyState === 4 && xhrCurrent.status === 200) {
- var parent = document.getElementById("currentSearch");
- var child = parent.lastElementChild;
- while (child) {
- parent.removeChild(child);
- child = parent.lastElementChild;
- }
- var textField = document.createElement("p");
- var json = JSON.parse(xhrCurrent.response);
- var output = json.Search;
- textField.innerHTML = output;
- document.getElementById("currentSearch").appendChild(textField);
- }
-};
-
-// Converting JSON data to string
-var data = JSON.stringify({ "Search": "current" });
-
-// Sending data with the request
-xhrCurrent.send(data);
-
-
diff --git a/build/resources/main/doneSearchesScript.js b/build/resources/main/doneSearchesScript.js
deleted file mode 100644
index 361d307..0000000
--- a/build/resources/main/doneSearchesScript.js
+++ /dev/null
@@ -1,49 +0,0 @@
-xhrDone = new XMLHttpRequest();
-let url = 'http://localhost:8000/searches';
-xhrDone.open("POST", url, true);
-xhrDone.setRequestHeader('Access-Control-Allow-Methods', 'POST');
-xhrDone.setRequestHeader("Content-Type", "application/json");
-xhrDone.onerror = function () {
- alert("Fehler");
-}
-xhrDone.onreadystatechange = function () {
- if (xhrDone.readyState === 4 && xhrDone.status === 200) {
- var parent = document.getElementById("doneSearches");
- var child = parent.lastElementChild;
- while (child) {
- parent.removeChild(child);
- child = parent.lastElementChild;
- }
- var resp = xhrDone.response;
- var json = JSON.parse(resp);
- var output = json.Search;
- var array = [];
- if (output == "") {
- return;
- }
- while (output.indexOf(';') != -1) {
- var a = output.substring(0, output.indexOf(";") - 1);
- output = output.substring(output.indexOf(";") + 1);
- array.push(a.trim());
- }
- array.push(output.trim());
- for (var i = 0; i < array.length; i++) {
- var button = document.createElement("button");
- var text = array[i];
- button.innerText = text;
- document.getElementById("doneSearches").appendChild(button);
- button.onclick = function () {
- window.sessionStorage.setItem("search", button.textContent);
- location.href = "analyse.html";
- }
- }
- }
-};
-
-// Converting JSON data to string
-var data = JSON.stringify({ "Search": "done" });
-
-// Sending data with the request
-xhrDone.send(data);
-
-
diff --git a/build/resources/main/index.html b/build/resources/main/index.html
deleted file mode 100644
index aa053da..0000000
--- a/build/resources/main/index.html
+++ /dev/null
@@ -1,78 +0,0 @@
-
-
-
-
-
- Suche
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/build/resources/main/log.html b/build/resources/main/log.html
deleted file mode 100644
index 2715ab7..0000000
--- a/build/resources/main/log.html
+++ /dev/null
@@ -1,30 +0,0 @@
-
-
-
-
-
- Analyse
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/build/resources/main/logStyles.css b/build/resources/main/logStyles.css
deleted file mode 100644
index e69de29..0000000
diff --git a/build/resources/main/pendingSearchScript.js b/build/resources/main/pendingSearchScript.js
deleted file mode 100644
index 197fce5..0000000
--- a/build/resources/main/pendingSearchScript.js
+++ /dev/null
@@ -1,46 +0,0 @@
-xhrPending = new XMLHttpRequest();
-url = 'http://localhost:8000/searches';
-xhrPending.open("POST", url, true);
-xhrPending.setRequestHeader('Access-Control-Allow-Methods', 'POST');
-xhrPending.setRequestHeader("Content-Type", "application/json");
-xhrPending.onerror = function () {
- alert("Fehler");
-}
-xhrPending.onreadystatechange = function () {
- if (xhrPending.readyState === 4 && xhrPending.status === 200) {
- var parent = document.getElementById("pendingSearch");
- var child = parent.lastElementChild;
- while (child) {
- parent.removeChild(child);
- child = parent.lastElementChild;
- }
- var resp = xhrPending.response;
- var json = JSON.parse(resp);
- var output = json.Search;
- var array = [];
- if (output == "") {
- return;
- }
- while (output.indexOf(';') != -1) {
- var a = output.substring(0, output.indexOf(";") - 1);
- output = output.substring(output.indexOf(";") + 1);
- array.push(a.trim());
- }
- array.push(output.trim());
- for (var i = 0; i < array.length; i++) {
- var textField = document.createElement("p");
- var text = array[i];
- textField.innerText = text;
- document.getElementById("pendingSearch").appendChild(textField);
-
- }
- }
-};
-
-// Converting JSON data to string
-var data = JSON.stringify({ "Search": "pending" });
-
-// Sending data with the request
-xhrPending.send(data);
-
-
diff --git a/build/resources/main/search.html b/build/resources/main/search.html
deleted file mode 100644
index 01556b2..0000000
--- a/build/resources/main/search.html
+++ /dev/null
@@ -1,100 +0,0 @@
-
-
-
-
-
- Suche
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/build/resources/main/searchScript.js b/build/resources/main/searchScript.js
deleted file mode 100644
index 22e5a64..0000000
--- a/build/resources/main/searchScript.js
+++ /dev/null
@@ -1,69 +0,0 @@
-document.getElementById("submitSearch").onclick = function () { search() }
-
-function search() {
- var searchString = document.getElementById("idSearchBar").value;
- if (searchString == "") {
- alert("Suche ist leer");
- return;
- }
-
- var search = new String();
-
- if (document.getElementById('checkBoxTopic').checked == true) {
- if (search.length > 0) {
- search = search + " OR ";
- }
- search = search + "TS=('" + searchString + "')"
- }
-
- if (document.getElementById('checkBoxAK').checked == true) {
- if (search.length > 0) {
- search = search + " OR ";
- }
- search = search + "AK=('" + searchString + "')"
- }
-
- if (document.getElementById('checkBoxKP').checked == true) {
- if (search.length > 0) {
- search = search + " OR ";
- }
- search = search + "KP=('" + searchString + "')"
- }
-
- if (document.getElementById('checkBoxRA').checked == true) {
- if (search.length > 0) {
- search = search + " OR ";
- }
- search = search + "SU=('" + searchString + "')"
- }
-
- if (document.getElementById('checkBoxWOSCategory').checked == true) {
- if (search.length > 0) {
- search = search + " OR ";
- }
- search = search + "WC=('" + searchString + "')"
- }
-
- let xhr = new XMLHttpRequest();
- let url = 'http://localhost:8000/query';
- xhr.open("POST", url, true);
- xhr.setRequestHeader('Access-Control-Allow-Methods', 'POST');
- xhr.setRequestHeader("Content-Type", "application/json");
- xhr.onerror = function () {
- alert("Fehler");
- }
- xhr.onreadystatechange = function () {
- if (xhr.readyState === 4 && xhr.status === 200) {
-
- }
- };
-
- // Converting JSON data to string
- var data = JSON.stringify({ "Search": search });
-
- // Sending data with the request
- xhr.send(data);
-
-
-
-}
\ No newline at end of file
diff --git a/build/resources/main/searchStyles.css b/build/resources/main/searchStyles.css
deleted file mode 100644
index 897ef4c..0000000
--- a/build/resources/main/searchStyles.css
+++ /dev/null
@@ -1,58 +0,0 @@
-.searchBar-wrapper {
- padding: 20px;
- margin-left: auto;
- margin-right: auto;
-}
-
-.searchBar {
- margin-right: auto;
- margin-left: auto;
-}
-
-.checkBoxes-wrapper {
- padding: 20px;
-
-}
-
-.checkBoxes {
- display: flex;
- justify-content: center;
-}
-
-.checkBox {
- padding: 5px;
-}
-
-.submitSearch {
- padding: 20px;
- display: flex;
- justify-content: center;
-}
-
-.search-wrapper {
- padding: 20px;
- display: grid;
- border: 1px solid;
-}
-
-.doneSearchWrapper {
- padding:20px;
- display: grid;
- border: 1px solid;
-}
-
-.currentSearchWrapper {
- padding:20px;
- display: grid;
- border: 1px solid;
-}
-
-.pendingSearchWrapper {
- padding:20px;
- display: grid;
- border: 1px solid;
-}
-
-.pendingSearchWrapper p {
-
-}
\ No newline at end of file
diff --git a/build/resources/main/yearsDocument.js b/build/resources/main/yearsDocument.js
deleted file mode 100644
index 07ac9b7..0000000
--- a/build/resources/main/yearsDocument.js
+++ /dev/null
@@ -1,110 +0,0 @@
-xhrDocumentYears = new XMLHttpRequest();
-url = 'http://localhost:8000/analyze';
-xhrDocumentYears.open("POST", url, true);
-xhrDocumentYears.setRequestHeader('Access-Control-Allow-Methods', 'POST');
-xhrDocumentYears.setRequestHeader("Content-Type", "application/json");
-alreadyPlottetyearsDocument = false;
-var dataDocumentYears = [];
-xhrDocumentYears.onreadystatechange = function () {
- if (xhrDocumentYears.readyState === 4 && xhrDocumentYears.status === 200) {
- var resp = xhrDocumentYears.response;
- var json = JSON.parse(resp);
- for (var key in json) {
- dataDocumentYears.push({ date: key, value: +json[key] })
- }
- if (document.getElementById("documentYearsDetails").open) {
- if (!alreadyPlottetyearsDocument) {
- plotYearsDocument();
- }
-
- }
- else {
- document.getElementById("documentYearsDetails")
- .addEventListener("toggle", c = function () {
- if (!alreadyPlottetyearsDocument)
- plotYearsDocument()
- })
- }
-
- }
-};
-
-// Converting JSON data to string
-var dataJson = JSON.stringify({ "Search": "Years", "Type": "Document", "Filter": window.sessionStorage.getItem("search") });
-
-// Sending data with the request
-xhrDocumentYears.send(dataJson);
-
-
-
-function plotYearsDocument() {
- alreadyPlottetyearsDocument = true;
- margin = ({ top: 50, right: 50, bottom: 50, left: 50 })
- const element = document.getElementById("yearDocumentContainer");
- height = element.clientHeight;
- width = element.clientWidth;
- const list = element.childNodes;
- element.removeChild(list[1]);
- const svg = d3.select("#yearDocumentContainer")
- .select("svg")
- .attr("viewBox", [0, 0, width, height])
- .style("-webkit-tap-highlight-color", "transparent")
- .style("overflow", "visible");
-
- x = d3.scaleBand()
- .domain(dataDocumentYears.map(d => d.date))
- .range([margin.left, width - margin.right])
- .padding(0.1)
-
- y = d3.scaleLinear()
- .domain([0, d3.max(dataDocumentYears, d => d.value)]).nice()
- .range([height - margin.bottom, margin.top])
-
- line = d3.line()
- .curve(d3.curveStep)
- .defined(d => !isNaN(d.value))
- .x(d => x(d.date))
- .y(d => y(d.value))
-
-
- xAxis = g => g
- .attr("transform", `translate(0,${height - margin.bottom})`)
- .call(d3.axisBottom(x).ticks(width / 80).tickSizeOuter(0))
-
- yAxis = g => g
- .attr("transform", `translate(${margin.left},0)`)
- .call(d3.axisLeft(y))
- .call(g => g.select(".tick:last-of-type text").clone()
- .attr("x", 3)
- .attr("text-anchor", "start")
- .attr("font-weight", "bold")
- .text(dataDocumentYears.y))
-
- svg.append("g")
- .attr("class", "xAxisYearsDocument")
- .call(xAxis);
-
- svg.append("g")
- .attr("class", "yAxis")
- .call(yAxis);
-
- svg.append("path")
- .datum(dataDocumentYears)
- .attr("fill", "none")
- .attr("stroke", "steelblue")
- .attr("stroke-width", 1.5)
- .attr("stroke-linejoin", "round")
- .attr("stroke-linecap", "round")
- .attr("d", line);
-
- var ticks = d3.selectAll(".xAxisYearsDocument").selectAll(".tick text");
-
- ticks.each(function (_, i) {
- if (i % 3 !== 0) d3.select(this).remove();
- })
-}
-
-
-
-
-
diff --git a/build/resources/main/yearsPatent.js b/build/resources/main/yearsPatent.js
deleted file mode 100644
index c94b5b7..0000000
--- a/build/resources/main/yearsPatent.js
+++ /dev/null
@@ -1,104 +0,0 @@
-let xhrYearsPatent = new XMLHttpRequest();
-url = 'http://localhost:8000/analyze';
-xhrYearsPatent.open("POST", url, true);
-xhrYearsPatent.setRequestHeader('Access-Control-Allow-Methods', 'POST');
-xhrYearsPatent.setRequestHeader("Content-Type", "application/json");
-alreadyPlottetYearsPatent = false;
-var dataPatentYears = [];
-xhrYearsPatent.onreadystatechange = function () {
- if (xhrYearsPatent.readyState === 4 && xhrYearsPatent.status === 200) {
- var resp = xhrYearsPatent.response;
- var json = JSON.parse(resp);
- for (var key in json) {
- dataPatentYears.push({ date: key, value: +json[key] })
- }
- if (document.getElementById("patentYearsDetails").open) {
- if (!alreadyPlottetYearsPatent) {
- plotYearsPatent();
- }
-
- }
- else {
- document.getElementById("patentYearsDetails")
- .addEventListener("toggle", b = function () {
- if (!alreadyPlottetYearsPatent)
- plotYearsPatent()
- })
- }
-
- }
-};
-
-// Converting JSON data to string
-var dataJson = JSON.stringify({ "Search": "Years", "Type": "Patent", "Filter": "None" });//window.sessionStorage.getItem("patentSearch")});
-
-// Sending data with the request
-xhrYearsPatent.send(dataJson);
-
-
-
-function plotYearsPatent() {
- alreadyPlottetYearsPatent = true;
- margin = ({ top: 50, right: 50, bottom: 50, left: 50 })
- const element = document.getElementById("yearPatentContainer");
- height = element.clientHeight;
- width = element.clientWidth;
- const list = element.childNodes;
- element.removeChild(list[1]);
- const svg = d3.select("#yearPatentContainer")
- .select("svg")
- .attr("viewBox", [0, 0, width, height])
- .style("-webkit-tap-highlight-color", "transparent")
- .style("overflow", "visible");
-
- x = d3.scaleBand()
- .domain(dataPatentYears.map(d => d.date))
- .range([margin.left, width - margin.right])
- .padding(0.1)
-
- y = d3.scaleLinear()
- .domain([0, d3.max(dataPatentYears, d => d.value)]).nice()
- .range([height - margin.bottom, margin.top])
-
- line = d3.line()
- .curve(d3.curveStep)
- .defined(d => !isNaN(d.value))
- .x(d => x(d.date))
- .y(d => y(d.value))
-
-
- xAxis = g => g
- .attr("transform", `translate(0,${height - margin.bottom})`)
- .call(d3.axisBottom(x).ticks(width / 80).tickSizeOuter(0))
-
- yAxis = g => g
- .attr("transform", `translate(${margin.left},0)`)
- .call(d3.axisLeft(y))
- .call(g => g.select(".tick:last-of-type text").clone()
- .attr("x", 3)
- .attr("text-anchor", "start")
- .attr("font-weight", "bold")
- .text(dataPatentYears.y))
-
- svg.append("g")
- .attr("class", "xAxisYearsPatent")
- .call(xAxis);
-
- svg.append("g")
- .attr("class", "yAxis")
- .call(yAxis);
-
- svg.append("path")
- .datum(dataPatentYears)
- .attr("fill", "none")
- .attr("stroke", "steelblue")
- .attr("stroke-width", 1.5)
- .attr("stroke-linejoin", "round")
- .attr("stroke-linecap", "round")
- .attr("d", line);
-
- var ticks = d3.selectAll(".xAxisYearsPatent").selectAll(".tick text");
- ticks.each(function (_, i) {
- if (i % 3 !== 0) d3.select(this).remove();
- })
-}
\ No newline at end of file
diff --git a/build/resources/main/yearsRelativeComparison.js b/build/resources/main/yearsRelativeComparison.js
deleted file mode 100644
index fb80f73..0000000
--- a/build/resources/main/yearsRelativeComparison.js
+++ /dev/null
@@ -1,94 +0,0 @@
-alreadyPlottedComparisonYearsRelative = false;
-
-function plotYearsRelativeComparison() {
- alreadyPlottedComparisonYearsRelative = true;
- margin = ({ top: 50, right: 50, bottom: 50, left: 50 })
- const element = document.getElementById("yearRelativeComparisonContainer");
- height = element.clientHeight;
- width = element.clientWidth;
- const list = element.childNodes;
- element.removeChild(list[1]);
- const svg = d3.select("#yearRelativeComparisonContainer")
- .select("svg")
- .attr("viewBox", [0, 0, width, height])
- .style("-webkit-tap-highlight-color", "transparent")
- .style("overflow", "visible");
-
- x = d3.scaleBand()
- .domain(dataDocumentYearsRelative.map(d => d.date))
- .range([margin.left, width - margin.right])
- .padding(0.1)
-
- min1 = d3.min(dataDocumentYearsRelative, d => d.value);
- min2 = d3.min(dataPatentYearsRelative, d => d.value);
- min = Math.min(min1,min2);
-
- max1 = d3.max(dataDocumentYearsRelative, d => d.value)
- max2 = d3.max(dataPatentYearsRelative, d => d.value)
-
- max = Math.max(max1,max2);
- y = d3.scaleLinear()
- .domain([min, max]).nice()
- .range([height - margin.bottom, margin.top])
-
-
-
-
- xAxis = g => g
- .attr("transform", `translate(0,${height - margin.bottom})`)
- .call(d3.axisBottom(x).ticks(width / 80).tickSizeOuter(0))
-
- yAxis = g => g
- .attr("transform", `translate(${margin.left},0)`)
- .call(d3.axisLeft(y))
- .call(g => g.select(".tick:last-of-type text").clone()
- .attr("x", 3)
- .attr("text-anchor", "start")
- .attr("font-weight", "bold")
- .text(dataDocumentYearsRelative.y))
-
- svg.append("g")
- .attr("class", "xAxisYearsRelativeComparison")
- .call(xAxis);
-
- svg.append("g")
- .attr("class", "yAxis")
- .call(yAxis);
-
- line = d3.line()
- .curve(d3.curveStep)
- .defined(d => !isNaN(d.value))
- .x(d => x(d.date))
- .y(d => y(d.value))
-
- svg.append("path")
- .datum(dataDocumentYearsRelative)
- .attr("fill", "none")
- .attr("stroke", "steelblue")
- .attr("stroke-width", 1.5)
- .attr("stroke-linejoin", "round")
- .attr("stroke-linecap", "round")
- .attr("d", line);
-
- line = d3.line()
- .curve(d3.curveStep)
- .defined(d => !isNaN(d.value))
- .x(d => x(d.date))
- .y(d => y(d.value))
-
- svg.append("path")
- .datum(dataPatentYearsRelative)
- .attr("fill", "none")
- .attr("stroke", "red")
- .attr("stroke-width", 1.5)
- .attr("stroke-linejoin", "round")
- .attr("stroke-linecap", "round")
- .attr("d", line);
-
-
- var ticks = d3.selectAll(".xAxisYearsRelativeComparison").selectAll(".tick text");
-
- ticks.each(function (_, i) {
- if (i % 3 !== 0) d3.select(this).remove();
- })
-}
\ No newline at end of file
diff --git a/build/resources/main/yearsRelativeDocument.js b/build/resources/main/yearsRelativeDocument.js
deleted file mode 100644
index 8182b42..0000000
--- a/build/resources/main/yearsRelativeDocument.js
+++ /dev/null
@@ -1,134 +0,0 @@
-xhrDocumentYearsRelative = new XMLHttpRequest();
-url = 'http://localhost:8000/analyze';
-xhrDocumentYearsRelative.open("POST", url, true);
-xhrDocumentYearsRelative.setRequestHeader('Access-Control-Allow-Methods', 'POST');
-xhrDocumentYearsRelative.setRequestHeader("Content-Type", "application/json");
-alreadyPlottetDocumentYearsRelative = false;
-var dataDocumentYearsRelative = [];
-yearsRelativeDocumentBoolean = false;
-xhrDocumentYearsRelative.onreadystatechange = function () {
- if (xhrDocumentYearsRelative.readyState === 4 && xhrDocumentYearsRelative.status === 200) {
- var resp = xhrDocumentYearsRelative.response;
- var json = JSON.parse(resp);
- for (var key in json) {
- dataDocumentYearsRelative.push({ date: key, value: +json[key] })
- }
- if (document.getElementById("documentYearsRelativeDetails").open) {
- if (!alreadyPlottetDocumentYearsRelative) {
- plotYearsRelativeDocument();
- }
-
- }
- else {
- document.getElementById("documentYearsRelativeDetails")
- .addEventListener("toggle", d = function () {
- if (!alreadyPlottetDocumentYearsRelative)
- plotYearsRelativeDocument()
- })
- }
-
- //Comparison
- if(yearsRelativePatentBoolean == true)
- {
- if (document.getElementById("yearRelativeCompasionDetails").open) {
- if (!alreadyPlottedComparisonYearsRelative) {
- plotYearsRelativeComparison();
- }
-
- }
- else {
- document.getElementById("yearRelativeCompasionDetails")
- .addEventListener("toggle", d = function () {
- if (!alreadyPlottedComparisonYearsRelative)
- plotYearsRelativeComparison()
- })
- }
- yearsRelativeDocumentBoolean = true;
- }
- else{
- yearsRelativeDocumentBoolean = true;
- }
-
-
- }
-};
-
-// Converting JSON data to string
-var dataJson = JSON.stringify({ "Search": "YearsRelative", "Type": "Document", "Filter": window.sessionStorage.getItem("search") });
-
-// Sending data with the request
-xhrDocumentYearsRelative.send(dataJson);
-
-
-
-function plotYearsRelativeDocument() {
- alreadyPlottetDocumentYearsRelative = true;
- margin = ({ top: 50, right: 50, bottom: 50, left: 50 })
- const element = document.getElementById("yearRelativeDocumentContainer");
- height = element.clientHeight;
- width = element.clientWidth;
- const list = element.childNodes;
- element.removeChild(list[1]);
- const svg = d3.select("#yearRelativeDocumentContainer")
- .select("svg")
- .attr("viewBox", [0, 0, width, height])
- .style("-webkit-tap-highlight-color", "transparent")
- .style("overflow", "visible");
-
- x = d3.scaleBand()
- .domain(dataDocumentYearsRelativeA.map(d => d.date))
- .range([margin.left, width - margin.right])
- .padding(0.1)
-
- y = d3.scaleLinear()
- .domain([d3.min(dataDocumentYearsRelative, d => d.value), d3.max(dataDocumentYearsRelative, d => d.value)]).nice()
- .range([height - margin.bottom, margin.top])
-
- line = d3.line()
- .curve(d3.curveStep)
- .defined(d => !isNaN(d.value))
- .x(d => x(d.date))
- .y(d => y(d.value))
-
-
- xAxis = g => g
- .attr("transform", `translate(0,${height - margin.bottom})`)
- .call(d3.axisBottom(x).ticks(width / 80).tickSizeOuter(0))
-
- yAxis = g => g
- .attr("transform", `translate(${margin.left},0)`)
- .call(d3.axisLeft(y))
- .call(g => g.select(".tick:last-of-type text").clone()
- .attr("x", 3)
- .attr("text-anchor", "start")
- .attr("font-weight", "bold")
- .text(dataDocumentYearsRelative.y))
-
- svg.append("g")
- .attr("class", "xAxisYearsRelativeDocument")
- .call(xAxis);
-
- svg.append("g")
- .attr("class", "yAxis")
- .call(yAxis);
-
- svg.append("path")
- .datum(dataDocumentYearsRelative)
- .attr("fill", "none")
- .attr("stroke", "steelblue")
- .attr("stroke-width", 1.5)
- .attr("stroke-linejoin", "round")
- .attr("stroke-linecap", "round")
- .attr("d", line);
-
- var ticks = d3.selectAll(".xAxisYearsRelativeDocument").selectAll(".tick text");
-
- ticks.each(function (_, i) {
- if (i % 3 !== 0) d3.select(this).remove();
- })
-}
-
-
-
-
-
diff --git a/build/resources/main/yearsRelativePatent.js b/build/resources/main/yearsRelativePatent.js
deleted file mode 100644
index 67d53dc..0000000
--- a/build/resources/main/yearsRelativePatent.js
+++ /dev/null
@@ -1,128 +0,0 @@
-let xhrYearsRelativePatent = new XMLHttpRequest();
-url = 'http://localhost:8000/analyze';
-xhrYearsRelativePatent.open("POST", url, true);
-xhrYearsRelativePatent.setRequestHeader('Access-Control-Allow-Methods', 'POST');
-xhrYearsRelativePatent.setRequestHeader("Content-Type", "application/json");
-alreadyPlottetYearsRelativePatent = false;
-var dataPatentYearsRelative = [];
-yearsRelativePatentBoolean = false;
-xhrYearsRelativePatent.onreadystatechange = function () {
- if (xhrYearsRelativePatent.readyState === 4 && xhrYearsRelativePatent.status === 200) {
- var resp = xhrYearsRelativePatent.response;
- var json = JSON.parse(resp);
- for (var key in json) {
- dataPatentYearsRelative.push({ date: key, value: +json[key] })
- }
- if (document.getElementById("patentYearsRelativeDetails").open) {
- if (!alreadyPlottetYearsRelativePatent) {
- plotYearsRelativePatent();
- }
-
- }
- else {
- document.getElementById("patentYearsRelativeDetails")
- .addEventListener("toggle", a = function () {
- if (!alreadyPlottetYearsRelativePatent)
- plotYearsRelativePatent()
- })
- }
-
- }
-
- //Comparison
- if(yearsRelativeDocumentBoolean == true)
- {
- if (document.getElementById("yearRelativeCompasionDetails").open) {
- if (!alreadyPlottedComparisonYearsRelative) {
- plotYearsRelativeComparison();
- }
-
- }
- else {
- document.getElementById("yearRelativeCompasionDetails")
- .addEventListener("toggle", d = function () {
- if (!alreadyPlottedComparisonYearsRelative)
- plotYearsRelativeComparison()
- })
- }
- yearsRelativePatentBoolean = true;
- }
- else{
- yearsRelativePatentBoolean = true;
- }
-};
-
-// Converting JSON data to string
-var dataJson = JSON.stringify({ "Search": "YearsRelative", "Type": "Patent", "Filter": "None" });//window.sessionStorage.getItem("patentSearch")});
-
-// Sending data with the request
-xhrYearsRelativePatent.send(dataJson);
-
-
-
-function plotYearsRelativePatent() {
- alreadyPlottetYearsRelativePatent = true;
-
- margin = ({ top: 50, right: 50, bottom: 50, left: 50 })
- const element = document.getElementById("yearRelativePatentContainer");
- height = element.clientHeight;
- width = element.clientWidth;
- const list = element.childNodes;
- element.removeChild(list[1]);
- const svg = d3.select("#yearRelativePatentContainer")
- .select("svg")
- .attr("viewBox", [0, 0, width, height])
- .style("-webkit-tap-highlight-color", "transparent")
- .style("overflow", "visible");
-
- x = d3.scaleBand()
- .domain(dataPatentYearsRelative.map(d => d.date))
- .range([margin.left, width - margin.right])
- .padding(0.1)
-
- y = d3.scaleLinear()
- .domain([d3.min(dataPatentYearsRelative, d => d.value), d3.max(dataPatentYearsRelative, d => d.value)]).nice()
- .range([height - margin.bottom, margin.top])
-
- line = d3.line()
- .curve(d3.curveStep)
- .defined(d => !isNaN(d.value))
- .x(d => x(d.date))
- .y(d => y(d.value))
-
-
- xAxis = g => g
- .attr("transform", `translate(0,${height - margin.bottom})`)
- .call(d3.axisBottom(x).ticks(width / 80).tickSizeOuter(0))
-
- yAxis = g => g
- .attr("transform", `translate(${margin.left},0)`)
- .call(d3.axisLeft(y))
- .call(g => g.select(".tick:last-of-type text").clone()
- .attr("x", 3)
- .attr("text-anchor", "start")
- .attr("font-weight", "bold")
- .text(dataPatentYearsRelative.y))
-
- svg.append("g")
- .attr("class", "xAxisYearsRelativePatent")
- .call(xAxis);
-
- svg.append("g")
- .attr("class", "yAxis")
- .call(yAxis);
-
- svg.append("path")
- .datum(dataPatentYearsRelative)
- .attr("fill", "none")
- .attr("stroke", "steelblue")
- .attr("stroke-width", 1.5)
- .attr("stroke-linejoin", "round")
- .attr("stroke-linecap", "round")
- .attr("d", line);
-
- var ticks = d3.selectAll(".xAxisYearsRelativePatent").selectAll(".tick text");
- ticks.each(function (_, i) {
- if (i % 3 !== 0) d3.select(this).remove();
- })
-}
\ No newline at end of file
diff --git a/debug.log b/debug.log
index 74d220f..8b28338 100644
--- a/debug.log
+++ b/debug.log
@@ -31,3 +31,45 @@
[0117/133239.268:ERROR:directory_reader_win.cc(43)] FindFirstFile: Das System kann den angegebenen Pfad nicht finden. (0x3)
[0117/201327.147:ERROR:directory_reader_win.cc(43)] FindFirstFile: Das System kann den angegebenen Pfad nicht finden. (0x3)
[0118/110854.834:ERROR:directory_reader_win.cc(43)] FindFirstFile: Das System kann den angegebenen Pfad nicht finden. (0x3)
+[0119/114834.558:ERROR:directory_reader_win.cc(43)] FindFirstFile: Das System kann den angegebenen Pfad nicht finden. (0x3)
+[0119/120706.829:ERROR:directory_reader_win.cc(43)] FindFirstFile: Das System kann den angegebenen Pfad nicht finden. (0x3)
+[0119/130909.908:ERROR:directory_reader_win.cc(43)] FindFirstFile: Das System kann den angegebenen Pfad nicht finden. (0x3)
+[0119/132252.132:ERROR:directory_reader_win.cc(43)] FindFirstFile: Das System kann den angegebenen Pfad nicht finden. (0x3)
+[0119/151458.435:ERROR:directory_reader_win.cc(43)] FindFirstFile: Das System kann den angegebenen Pfad nicht finden. (0x3)
+[0119/153348.851:ERROR:directory_reader_win.cc(43)] FindFirstFile: Das System kann den angegebenen Pfad nicht finden. (0x3)
+[0119/154946.481:ERROR:directory_reader_win.cc(43)] FindFirstFile: Das System kann den angegebenen Pfad nicht finden. (0x3)
+[0120/111559.749:ERROR:directory_reader_win.cc(43)] FindFirstFile: Das System kann den angegebenen Pfad nicht finden. (0x3)
+[0120/113609.271:ERROR:directory_reader_win.cc(43)] FindFirstFile: Das System kann den angegebenen Pfad nicht finden. (0x3)
+[0120/182859.637:ERROR:directory_reader_win.cc(43)] FindFirstFile: Das System kann den angegebenen Pfad nicht finden. (0x3)
+[0121/122126.929:ERROR:directory_reader_win.cc(43)] FindFirstFile: Das System kann den angegebenen Pfad nicht finden. (0x3)
+[0121/134828.509:ERROR:directory_reader_win.cc(43)] FindFirstFile: Das System kann den angegebenen Pfad nicht finden. (0x3)
+[0121/141328.880:ERROR:directory_reader_win.cc(43)] FindFirstFile: Das System kann den angegebenen Pfad nicht finden. (0x3)
+[0121/141835.661:ERROR:directory_reader_win.cc(43)] FindFirstFile: Das System kann den angegebenen Pfad nicht finden. (0x3)
+[0121/145515.672:ERROR:directory_reader_win.cc(43)] FindFirstFile: Das System kann den angegebenen Pfad nicht finden. (0x3)
+[0121/145827.279:ERROR:directory_reader_win.cc(43)] FindFirstFile: Das System kann den angegebenen Pfad nicht finden. (0x3)
+[0121/145924.967:ERROR:directory_reader_win.cc(43)] FindFirstFile: Das System kann den angegebenen Pfad nicht finden. (0x3)
+[0121/153004.255:ERROR:directory_reader_win.cc(43)] FindFirstFile: Das System kann den angegebenen Pfad nicht finden. (0x3)
+[0121/153421.757:ERROR:directory_reader_win.cc(43)] FindFirstFile: Das System kann den angegebenen Pfad nicht finden. (0x3)
+[0121/160144.507:ERROR:directory_reader_win.cc(43)] FindFirstFile: Das System kann den angegebenen Pfad nicht finden. (0x3)
+[0121/162902.862:ERROR:directory_reader_win.cc(43)] FindFirstFile: Das System kann den angegebenen Pfad nicht finden. (0x3)
+[0121/164218.093:ERROR:directory_reader_win.cc(43)] FindFirstFile: Das System kann den angegebenen Pfad nicht finden. (0x3)
+[0121/165936.701:ERROR:directory_reader_win.cc(43)] FindFirstFile: Das System kann den angegebenen Pfad nicht finden. (0x3)
+[0121/171242.513:ERROR:directory_reader_win.cc(43)] FindFirstFile: Das System kann den angegebenen Pfad nicht finden. (0x3)
+[0121/172532.152:ERROR:directory_reader_win.cc(43)] FindFirstFile: Das System kann den angegebenen Pfad nicht finden. (0x3)
+[0121/203804.287:ERROR:directory_reader_win.cc(43)] FindFirstFile: Das System kann den angegebenen Pfad nicht finden. (0x3)
+[0122/104824.977:ERROR:directory_reader_win.cc(43)] FindFirstFile: Das System kann den angegebenen Pfad nicht finden. (0x3)
+[0122/111633.764:ERROR:directory_reader_win.cc(43)] FindFirstFile: Das System kann den angegebenen Pfad nicht finden. (0x3)
+[0122/175759.322:ERROR:directory_reader_win.cc(43)] FindFirstFile: Das System kann den angegebenen Pfad nicht finden. (0x3)
+[0122/180608.812:ERROR:directory_reader_win.cc(43)] FindFirstFile: Das System kann den angegebenen Pfad nicht finden. (0x3)
+[0122/180742.548:ERROR:directory_reader_win.cc(43)] FindFirstFile: Das System kann den angegebenen Pfad nicht finden. (0x3)
+[0122/180930.925:ERROR:directory_reader_win.cc(43)] FindFirstFile: Das System kann den angegebenen Pfad nicht finden. (0x3)
+[0122/181057.780:ERROR:directory_reader_win.cc(43)] FindFirstFile: Das System kann den angegebenen Pfad nicht finden. (0x3)
+[0122/181209.794:ERROR:directory_reader_win.cc(43)] FindFirstFile: Das System kann den angegebenen Pfad nicht finden. (0x3)
+[0124/120909.054:ERROR:directory_reader_win.cc(43)] FindFirstFile: Das System kann den angegebenen Pfad nicht finden. (0x3)
+[0124/121142.103:ERROR:directory_reader_win.cc(43)] FindFirstFile: Das System kann den angegebenen Pfad nicht finden. (0x3)
+[0124/121320.958:ERROR:directory_reader_win.cc(43)] FindFirstFile: Das System kann den angegebenen Pfad nicht finden. (0x3)
+[0124/121958.841:ERROR:directory_reader_win.cc(43)] FindFirstFile: Das System kann den angegebenen Pfad nicht finden. (0x3)
+[0124/123852.537:ERROR:directory_reader_win.cc(43)] FindFirstFile: Das System kann den angegebenen Pfad nicht finden. (0x3)
+[0124/140723.682:ERROR:directory_reader_win.cc(43)] FindFirstFile: Das System kann den angegebenen Pfad nicht finden. (0x3)
+[0124/142448.563:ERROR:directory_reader_win.cc(43)] FindFirstFile: Das System kann den angegebenen Pfad nicht finden. (0x3)
+[0124/143214.154:ERROR:directory_reader_win.cc(43)] FindFirstFile: Das System kann den angegebenen Pfad nicht finden. (0x3)
diff --git a/src/main/java/CPCImporter.java b/src/main/java/CPCImporter.java
index bb2c245..effc32d 100644
--- a/src/main/java/CPCImporter.java
+++ b/src/main/java/CPCImporter.java
@@ -17,6 +17,6 @@ public class CPCImporter {
}
public void doImport(String kurz, String lang) {
- collection.insert(new BasicDBObject().append(kurz, lang));
+ collection.insert(new BasicDBObject().append("key", kurz).append("value", lang));
}
}
diff --git a/src/main/java/Classification.java b/src/main/java/Classification.java
new file mode 100644
index 0000000..30d5093
--- /dev/null
+++ b/src/main/java/Classification.java
@@ -0,0 +1,69 @@
+import com.mongodb.*;
+
+public class Classification {
+
+ private DBCollection collectionUSPC, collectionCPC, collectionIPC, collectionCPCFrom;
+
+
+ Classification() {
+
+ MongoClient mongo = new MongoClient(new MongoClientURI(Settings.MONGOURL.getContent()));
+ DB mongoDB = mongo.getDB(Settings.DBCLASSIFICATION.getContent());
+ collectionCPC = mongoDB.getCollection(Settings.COLLECTIONCPC.getContent());
+ collectionUSPC = mongoDB.getCollection(Settings.COLLECTIONUSPC.getContent());
+ collectionIPC = mongoDB.getCollection(Settings.COLLECTIONIPC.getContent());
+ collectionCPCFrom = collectionCPC = mongoDB.getCollection(Settings.COLLECTIONCPCFROM.getContent());
+ }
+
+ public String getUSPC(String key) {
+ if (key.length() == 3) {
+ BasicDBObject obj = (BasicDBObject) collectionUSPC.findOne(new BasicDBObject("key", key));
+ if (obj != null) {
+ return obj.getString("value");
+ }
+ return "";
+ }
+ if (key.length() < 3) return "";
+ String value = "";
+ String upper = key.substring(0, 3);
+ String lower = key.substring(4);
+ BasicDBObject obj = (BasicDBObject) collectionUSPC.findOne(new BasicDBObject("key", upper));
+ if (obj == null) {
+ return "";
+ }
+ value = obj.getString("value");
+ obj = (BasicDBObject) collectionUSPC.findOne(new BasicDBObject("key", upper + " " + lower));
+ if (obj != null) {
+ //return value + ":" + obj.getString("value");
+ return obj.getString("value");
+ }
+ return "";
+
+ }
+
+ public int getCPCFrom(String key) {
+ BasicDBObject obj = (BasicDBObject) collectionCPCFrom.findOne(new BasicDBObject("key", key));
+ if (obj == null) {
+ return 2015;
+ }
+ return obj.getInt("value");
+ }
+
+ public void setCPCFrom(String key, int value) {
+ BasicDBObject obj = new BasicDBObject().append("key", key).append("value", value);
+ collectionCPCFrom.insert(obj);
+ }
+
+
+ public String getIPC(String key) {
+ return key;
+ }
+
+ public String getCPC(String key) {
+ BasicDBObject obj = (BasicDBObject) collectionCPC.findOne(new BasicDBObject("key", key));
+ if (obj == null) {
+ return "";
+ }
+ return obj.getString("value").replace("{", "").replace("}", "");
+ }
+}
diff --git a/src/main/java/CorporatePatentClassificationCrawler.java b/src/main/java/CorporatePatentClassificationCrawler.java
index 165e6fa..5ab8ac3 100644
--- a/src/main/java/CorporatePatentClassificationCrawler.java
+++ b/src/main/java/CorporatePatentClassificationCrawler.java
@@ -47,6 +47,10 @@ public class CorporatePatentClassificationCrawler {
String line;
while ((line = br.readLine()) != null) {
String classification = line.substring(0, line.indexOf("\t"));
+ if (classification.length() > 4) {
+ classification = classification.substring(0, 4) + " " + classification.substring(4);
+ }
+
String text = line.substring(line.indexOf("\t") + 1);
importer.doImport(classification, text);
}
@@ -68,6 +72,7 @@ public class CorporatePatentClassificationCrawler {
ChromeOptions options = new ChromeOptions();
options.setExperimentalOption("prefs", preferences);
+ options.addArguments("--disable-notifications");
DesiredCapabilities capabilities = DesiredCapabilities.chrome();
capabilities.setCapability(CapabilityType.ACCEPT_SSL_CERTS, true);
@@ -86,7 +91,7 @@ public class CorporatePatentClassificationCrawler {
e.click();
}
}
- wait(10000);
+ wait(30000);
}
diff --git a/src/main/java/DocumentQueries.java b/src/main/java/DocumentQueries.java
index 7870d47..8d2835f 100644
--- a/src/main/java/DocumentQueries.java
+++ b/src/main/java/DocumentQueries.java
@@ -84,17 +84,25 @@ public class DocumentQueries {
int currentYear = Calendar.getInstance().get(Calendar.YEAR);
for (int i = 2002; i < currentYear; i++) {
int count = 0;
- JsonObject keys = getKeywords(document.withYear(i), false, false, false);
- Map attributes = new HashMap();
- Set> entrySet = keys.entrySet();
- for (Map.Entry entry : entrySet) {
- attributes.put(entry.getKey(), keys.get(entry.getKey()));
+ for (int k = 0; k < 2; k++) {
+ String field = "";
+ if (k == 0) field = "Keywords";
+ if (k == 1) field = "AuthorKeyword";
+ if (k == 2) field = "WosCategory";
+ if (k == 3) field = "ResearchAreas";
+ JsonObject keys = getKeywords(document.withYear(i), false, false, field);
+ Map attributes = new HashMap();
+ Set> entrySet = keys.entrySet();
+ for (Map.Entry entry : entrySet) {
+ attributes.put(entry.getKey(), keys.get(entry.getKey()));
+ }
+
+ for (Map.Entry att : attributes.entrySet()) {
+ count++;
+ }
}
- for (Map.Entry att : attributes.entrySet()) {
- count++;
- }
- jsonObject.addProperty(String.valueOf(i), count);
+ jsonObject.addProperty(String.valueOf(i), count - 2);
}
@@ -105,9 +113,35 @@ public class DocumentQueries {
return jsonObject;
}
- public JsonObject getKeywords(FilterBuilderDocument document, boolean removeOnes, boolean first50, boolean sort) {
+ public JsonObject getAllKeywords(FilterBuilderDocument document) {
+ JsonObject obj = getKeywords(document, false, false, "AuthorKeyword");
+ JsonObject two = getKeywords(document, false, false, "Keywords");
+ Set> entrySet = obj.entrySet();
+ Map attributes = new HashMap();
+ for (Map.Entry entry : entrySet) {
+ attributes.put(entry.getKey(), obj.get(entry.getKey()));
+ }
+
+ for (Map.Entry att : attributes.entrySet()) {
+ Object valueObj = att.getValue();
+ String number = valueObj.toString().replace('"', ' ').trim();
+ String key = att.getKey();
+ if (two.get(key) != null) {
+ int a = Integer.valueOf(two.get(key).getAsString());
+ int b = Integer.valueOf(obj.get(key).getAsString());
+ two.remove(key);
+ two.addProperty(key, a + b);
+ } else {
+ two.addProperty(key, number);
+ }
+ }
+ return two;
+ }
+
+ public JsonObject getKeywords(FilterBuilderDocument document, boolean removeOnes, boolean first50, String field) {
String search;
+ document.withField(field);
if (removeOnes) {
search = "KeywordsRemoved";
} else {
@@ -122,48 +156,61 @@ public class DocumentQueries {
return (JsonObject) parserJson.parse(a);
}
}
+ try {
+ System.out.println("[INFO] Starte Keywordsuche Dokument");
+ DBCursor cursor = getDocuments(document);
+ JsonObject jsonObject = new JsonObject();
+ int count = 0;
+ while (cursor.hasNext()) {
+ BasicDBObject obj = (BasicDBObject) cursor.next();
+ String classification;
+ if (obj.get(field) == null) {
+ System.out.println("Keyword = 0 : " + obj.get("_id").toString());
+ classification = "";
+ } else {
+ classification = obj.getString(field).trim();
+ }
+ if (!classification.equals("; ;")) {
+ ArrayList keywords = new ArrayList<>();
+ while (classification.indexOf(';', 1) != -1) {
- System.out.println("[INFO] Starte Keywordsuche Dokument");
- DBCursor cursor = getDocuments(document);
- JsonObject jsonObject = new JsonObject();
- int count = 0;
- while (cursor.hasNext()) {
- BasicDBObject obj = (BasicDBObject) cursor.next();
- String classification;
- if (obj.get("Keywords") == null) {
- System.out.println("Keyword = 0 : " + obj.get("_id").toString());
- classification = "";
- } else {
- classification = obj.getString("Keywords").trim();
+ String toRemove = document.obj.getString(field);
+ String toAdd = classification.substring(1, classification.indexOf(';', 1)).trim();
+ if (toRemove == null) {
+ keywords.add(toAdd);
+ }
+ if (toRemove != null && !toRemove.equalsIgnoreCase(toAdd)) {
+ keywords.add(toAdd);
+ }
+ classification = classification.substring(classification.indexOf(';', 1));
+ }
+ if (!classification.equals(";")) {
+ keywords.add(classification.trim());
+ }
+ QuerySupport.addToJson(jsonObject, keywords);
+ count = count + keywords.size();
+ }
}
- ArrayList keywords = new ArrayList<>();
- while (classification.indexOf(';', 1) != -1) {
- String toAdd = classification.substring(0, classification.indexOf(';', 1)).trim();
- keywords.add(toAdd);
- classification = classification.substring(classification.indexOf(';', 1) + 2);
+ jsonObject.addProperty("Count", count);
+ analyzes.addDocumentAnalyze(document, search, jsonObject.toString());
+ jsonObject.remove("Count");
+ if (removeOnes) {
+ QuerySupport.removeEverythingUnder(jsonObject, 1);
}
- if (!classification.equals("")) {
- keywords.add(classification.trim());
- }
- QuerySupport.addToJson(jsonObject, keywords);
- count = count + keywords.size();
- }
- jsonObject.addProperty("Count", count);
- analyzes.addDocumentAnalyze(document, search, jsonObject.toString());
- jsonObject.remove("Count");
- if (removeOnes) {
- QuerySupport.removeEverythingUnder(jsonObject, 500);
- }
- if (first50) {
- jsonObject = QuerySupport.getFirst(jsonObject, 50);
+ if (first50) {
+ jsonObject = QuerySupport.getFirst(jsonObject, 50);
+ }
+ jsonObject.addProperty("Count", count);
+ return jsonObject;
+ } catch (Exception e) {
+ e.printStackTrace();
}
- jsonObject.addProperty("Count", count);
- return jsonObject;
+ return null;
+
}
public JsonObject getKeywordsPerYearRelative(FilterBuilderDocument document) {
-
if (analyzes.isAnalyzed(document, null)) {
JsonElement element = analyzes.getAnalyzeDocument(document).get("YearsKeywordsRelative");
if (element != null) {
@@ -229,4 +276,243 @@ public class DocumentQueries {
return toReturn;
}
+ public JsonObject getAuthorsPerYearRelative(FilterBuilderDocument document) {
+ if (analyzes.isAnalyzed(document, null)) {
+ JsonElement element = analyzes.getAnalyzeDocument(document).get("AuthorsPerYear");
+ if (element != null) {
+ String a = element.getAsString();
+ JsonParser parserJson = new JsonParser();
+ return (JsonObject) parserJson.parse(a);
+ }
+ }
+
+
+ int year = 0;
+ if (document.build().containsKey("Year")) {
+ year = document.build().getInt("Year");
+ }
+ JsonObject json = getAuthorsPerYear(document);
+ JsonObject toReturn = new JsonObject();
+ int thisYear = Calendar.getInstance().get(Calendar.YEAR);
+ for (int i = 2003; i <= thisYear; i++) {
+ double lastYear = 0;
+ if (json.get(String.valueOf(i - 1)) != null) {
+ lastYear = json.get(String.valueOf(i - 1)).getAsInt();
+ }
+ double currentYear = 0;
+ if (json.get(String.valueOf(i)) != null) {
+ currentYear = json.get(String.valueOf(i)).getAsInt();
+ }
+ if (lastYear == 0) {
+ toReturn.addProperty(String.valueOf(i), String.valueOf(0));
+ } else {
+ double value = currentYear / lastYear;
+ toReturn.addProperty(String.valueOf(i), String.valueOf(value));
+ }
+ }
+
+
+ if (year != 0) {
+ document.withYear(year);
+ }
+ analyzes.addDocumentAnalyze(document, "AuthorsPerYearRelative", toReturn.toString());
+ return toReturn;
+ }
+
+ public JsonObject getAuthorsPerYear(FilterBuilderDocument document) {
+ if (analyzes.isAnalyzed(document, null)) {
+ JsonElement element = analyzes.getAnalyzeDocument(document).get("AuthorsPerYear");
+ if (element != null) {
+ String a = element.getAsString();
+ JsonParser parserJson = new JsonParser();
+ return (JsonObject) parserJson.parse(a);
+ }
+ }
+
+ JsonObject jsonObject = new JsonObject();
+
+ int year = 0;
+ if (document.build().containsKey("Year")) {
+ year = document.build().getInt("Year");
+ }
+ int currentYear = Calendar.getInstance().get(Calendar.YEAR);
+ for (int i = 2002; i < currentYear; i++) {
+ int count = 0;
+ JsonObject keys = getAuthors(document.withYear(i), false, false);
+ Map attributes = new HashMap();
+ Set> entrySet = keys.entrySet();
+ for (Map.Entry entry : entrySet) {
+ attributes.put(entry.getKey(), keys.get(entry.getKey()));
+ }
+
+ for (Map.Entry att : attributes.entrySet()) {
+ count++;
+ }
+ jsonObject.addProperty(String.valueOf(i), count - 1);
+ }
+
+
+ if (year != 0) {
+ document.withYear(year);
+ }
+ analyzes.addDocumentAnalyze(document, "AuthorsPerYear", jsonObject.toString());
+ return jsonObject;
+ }
+
+ public JsonObject getAuthors(FilterBuilderDocument document, boolean removeOnes, boolean getFirst50) {
+ document.removeField();
+ if (analyzes.isAnalyzed(document, null)) {
+ JsonElement element = analyzes.getAnalyzeDocument(document).get("Author");
+ if (element != null) {
+ System.out.println("[INFO] Laden der Dokument Autoren");
+ String a = element.getAsString();
+ JsonParser parserJson = new JsonParser();
+ JsonObject obj = (JsonObject) parserJson.parse(a);
+ int count = obj.get("Count").getAsInt();
+ obj.remove("Count");
+ if (removeOnes) {
+ obj = QuerySupport.removeEverythingUnder(obj, 1);
+ }
+ if (getFirst50) {
+ obj = QuerySupport.getFirst(obj, 50);
+ }
+ obj.addProperty("Count", count);
+ return obj;
+ }
+ }
+
+
+ System.out.println("[INFO] Starte Author Document");
+ DBCursor cursor = getDocuments(document);
+ JsonObject jsonObject = new JsonObject();
+ int count = 0;
+ while (cursor.hasNext()) {
+ BasicDBObject obj = (BasicDBObject) cursor.next();
+ ArrayList keywords = new ArrayList<>();
+
+ if (obj.get("Author") != null) {
+ String inventors = obj.getString("Author").substring(1);
+ String address = obj.getString("FullAddress");
+ if (!address.equals("; ;") && !address.equals(";")) {
+ while (inventors.indexOf(";") != -1 && !inventors.equals(";")) {
+ try {
+ String inventor = inventors.substring(0, inventors.indexOf(';', 1)).replace(";", "").trim();
+ inventors = inventors.substring(inventors.indexOf(';', 1)).trim();
+ int start = address.indexOf(inventor);
+ if (start != -1) {
+ start = address.indexOf("]", start) + 1;
+ String a = address.substring(start, address.indexOf(",", start)).trim();
+ keywords.add(inventor + "{ " + a + " }");
+ } else {
+ String a = address.substring(1, address.indexOf(",")).trim();
+ keywords.add(inventor + "{ " + a + " }");
+ }
+
+
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+
+ }
+ } else {
+ while (inventors.indexOf(";") != -1) {
+ String inventor = inventors.substring(0, inventors.indexOf(';', 1)).trim();
+ inventors = inventors.substring(inventors.indexOf(';', 1) + 1).trim();
+ keywords.add(inventor);
+ }
+ }
+
+ }
+
+ QuerySupport.addToJson(jsonObject, keywords);
+ count = count + keywords.size();
+ keywords.clear();
+ }
+ jsonObject.addProperty("Count", count);
+ analyzes.addDocumentAnalyze(document, "Author", jsonObject.toString());
+ jsonObject.remove("Count");
+ if (removeOnes) {
+ QuerySupport.removeEverythingUnder(jsonObject, 1);
+ }
+
+ if (getFirst50) {
+ jsonObject = QuerySupport.getFirst(jsonObject, 50);
+ }
+ jsonObject.addProperty("Count", count);
+ System.out.println("[INFO] Beende Author Document");
+ return jsonObject;
+ }
+
+ public JsonObject getCountrysAdress(FilterBuilderDocument document) {
+ if (analyzes.isAnalyzed(document, null)) {
+ JsonElement element = analyzes.getAnalyzeDocument(document).get("Address");
+ if (element != null) {
+ System.out.println("[INFO] Laden der Patent Laneder");
+ String a = element.getAsString();
+ JsonParser parserJson = new JsonParser();
+ JsonObject obj = (JsonObject) parserJson.parse(a);
+ return obj;
+ }
+ }
+
+
+ System.out.println("[INFO] Starte Laender Dokument");
+ DBCursor cursor = getDocuments(document);
+ JsonObject jsonObject = new JsonObject();
+ int count = 0;
+ while (cursor.hasNext()) {
+ BasicDBObject obj = (BasicDBObject) cursor.next();
+ ArrayList keywords = new ArrayList<>();
+
+ if (obj.get("Address") != null) {
+ String countries = obj.getString("Address");
+ keywords.add(countries);
+ }
+
+ QuerySupport.addToJson(jsonObject, keywords);
+ count = count + keywords.size();
+ keywords.clear();
+ }
+ jsonObject.addProperty("Count", count);
+ analyzes.addDocumentAnalyze(document, "Address", jsonObject.toString());
+ System.out.println("[INFO] Beende Laender Dokument");
+ return jsonObject;
+ }
+
+ public JsonObject getCountrys(FilterBuilderDocument document) {
+ if (analyzes.isAnalyzed(document, null)) {
+ JsonElement element = analyzes.getAnalyzeDocument(document).get("Country");
+ if (element != null) {
+ System.out.println("[INFO] Laden der Patent Laneder");
+ String a = element.getAsString();
+ JsonParser parserJson = new JsonParser();
+ JsonObject obj = (JsonObject) parserJson.parse(a);
+ return obj;
+ }
+ }
+
+
+ System.out.println("[INFO] Starte Laender Dokument");
+ DBCursor cursor = getDocuments(document);
+ JsonObject jsonObject = new JsonObject();
+ int count = 0;
+ while (cursor.hasNext()) {
+ BasicDBObject obj = (BasicDBObject) cursor.next();
+ ArrayList keywords = new ArrayList<>();
+
+ if (obj.get("Country") != null) {
+ String countries = obj.getString("Country");
+ keywords.add(countries);
+ }
+
+ QuerySupport.addToJson(jsonObject, keywords);
+ count = count + keywords.size();
+ keywords.clear();
+ }
+ jsonObject.addProperty("Count", count);
+ analyzes.addDocumentAnalyze(document, "Country", jsonObject.toString());
+ System.out.println("[INFO] Beende Laender Dokument");
+ return jsonObject;
+ }
+
}
diff --git a/src/main/java/DoneAnalyzes.java b/src/main/java/DoneAnalyzes.java
index 539c2b7..d30363e 100644
--- a/src/main/java/DoneAnalyzes.java
+++ b/src/main/java/DoneAnalyzes.java
@@ -5,13 +5,14 @@ import com.mongodb.*;
public class DoneAnalyzes {
DBCollection collectionPatent;
- DBCollection collectionDocument;
+ DBCollection collectionDocument, collectionIsAll;
DoneAnalyzes() {
MongoClient mongo = new MongoClient(new MongoClientURI(Settings.MONGOURL.getContent()));
DB mongoDB = mongo.getDB(Settings.DBANALYZES.getContent());
collectionPatent = mongoDB.getCollection(Settings.COLLECTIONANALYZEPATENT.getContent());
collectionDocument = mongoDB.getCollection(Settings.COLLECTIONANALYZEDOCUMENT.getContent());
+ collectionIsAll = mongoDB.getCollection(Settings.COLLECTIONISALL.getContent());
}
public boolean isAnalyzed(FilterBuilderDocument doc, FilterBuilderPatent pat) {
@@ -29,7 +30,21 @@ public class DoneAnalyzes {
}
}
return doc != null || pat != null;
+ }
+ public boolean isGetAll(FilterBuilderPatent patent) {
+ BasicDBObject search = new BasicDBObject().append("Search", patent.build().toString());
+ DBCursor cursor = collectionIsAll.find(search);
+ if (cursor == null) {
+ return false;
+ }
+ return cursor.hasNext();
+ }
+
+ public void setGetAll(FilterBuilderPatent patent) {
+ patent.removeYear();
+ BasicDBObject search = new BasicDBObject().append("Search", patent.build().toString());
+ collectionIsAll.insert(search);
}
public JsonObject getAnalyzePatent(FilterBuilderPatent pat) {
@@ -118,7 +133,6 @@ public class DoneAnalyzes {
}
collectionDocument.insert(toAdd);
}
-
}
public void deleteDocumentCollection() {
diff --git a/src/main/java/FilterBuilderDocument.java b/src/main/java/FilterBuilderDocument.java
index e1b7785..c12ddf2 100644
--- a/src/main/java/FilterBuilderDocument.java
+++ b/src/main/java/FilterBuilderDocument.java
@@ -7,6 +7,8 @@ import java.util.Set;
public class FilterBuilderDocument {
BasicDBObject obj;
int count = 0;
+ BasicDBObject rObj = null;
+ boolean isBuild = false;
FilterBuilderDocument() {
obj = new BasicDBObject();
@@ -19,18 +21,21 @@ public class FilterBuilderDocument {
public FilterBuilderDocument withWosCategory(String var) {
obj.put("WosCategories", var);
count++;
+ isBuild = false;
return this;
}
public FilterBuilderDocument withDocumentType(String var) {
obj.put("DocumentType", var);
count++;
+ isBuild = false;
return this;
}
public FilterBuilderDocument withKeywords(String var) {
obj.put("Keywords", var);
count++;
+ isBuild = false;
return this;
}
@@ -43,17 +48,44 @@ public class FilterBuilderDocument {
public FilterBuilderDocument withYear(int var) {
if (!obj.containsKey("PublicationYear")) count++;
obj.put("PublicationYear", var);
+ isBuild = false;
return this;
}
public FilterBuilderDocument withResearchArea(String var) {
obj.put("ResearchAreas", var);
count++;
+ isBuild = false;
+ return this;
+ }
+
+ public FilterBuilderDocument withField(String var) {
+ isBuild = false;
+ obj.put("Whatever", var);
+ return this;
+ }
+
+ public FilterBuilderDocument removeField() {
+ isBuild = false;
+ obj.remove("Whatever");
return this;
}
public FilterBuilderDocument bySearchString(String var) {
+
+
+ if (var.contains("{Field: ")) {
+ int start = var.indexOf("{Field: ") + 8;
+ String field = var.substring(start, var.indexOf("}", start));
+ this.withField(field);
+ }
+ if (var.contains("Year:")) {
+ int start = var.indexOf("Year:") + 5;
+ String year = var.substring(start, var.indexOf("}", start)).trim();
+ this.withYear(Integer.valueOf(year));
+ }
+
if (var.contains("TS=('")) {
String topic = var.substring(var.indexOf("TS=('") + 5);
topic = topic.substring(0, topic.indexOf(')') - 1);
@@ -96,22 +128,43 @@ public class FilterBuilderDocument {
}
public BasicDBObject build() {
- if (count <= 1) {
- return this.obj;
- } else {
- List list = new ArrayList<>();
- Set keys = obj.keySet();
- for (String a : keys) {
- BasicDBObject query = new BasicDBObject();
- if (obj.get(a) instanceof Integer) {
- query.append(a, obj.getInt(a));
- } else {
- query.append(a, new BasicDBObject("$regex", "" + ".*" + obj.getString(a) + ".*" + "").append("$options", "i"));
- }
- list.add(query);
+ if (isBuild) {
+ return rObj;
+ }
+ isBuild = true;
+ List list = new ArrayList<>();
+ Set keys = obj.keySet();
+ for (String a : keys) {
+ if (a.equalsIgnoreCase("PublicationYear")) {
+ continue;
}
- BasicDBObject obj = new BasicDBObject("$or", list);
- return obj;
+ BasicDBObject query = new BasicDBObject();
+ if (obj.get(a) instanceof Integer) {
+ query.append(a, obj.getInt(a));
+ } else {
+ query.append(a, new BasicDBObject("$regex", "" + ".*; " + obj.getString(a) + ";.*" + "").append("$options", "i"));
+ }
+ list.add(query);
+ }
+ BasicDBObject first = new BasicDBObject("$or", list);
+ if (!this.obj.containsKey("PublicationYear")) {
+ if (list.size() == 0) {
+ rObj = new BasicDBObject();
+ return rObj;
+ }
+ rObj = first;
+ return rObj;
+ }
+ BasicDBObject second = new BasicDBObject("PublicationYear", this.obj.getInt("PublicationYear"));
+ List secondList = new ArrayList<>();
+ if (list.size() > 0) {
+ secondList.add(first);
+ secondList.add(second);
+ rObj = new BasicDBObject("$and", secondList);
+ return rObj;
+ } else {
+ rObj = second;
+ return rObj;
}
}
diff --git a/src/main/java/FilterBuilderPatent.java b/src/main/java/FilterBuilderPatent.java
index 1676df8..0b20fae 100644
--- a/src/main/java/FilterBuilderPatent.java
+++ b/src/main/java/FilterBuilderPatent.java
@@ -5,9 +5,11 @@ import java.util.List;
import java.util.Set;
public class FilterBuilderPatent {
- BasicDBObject obj;
+ BasicDBObject obj, rObj;
int count = 0;
boolean hasCpc = false;
+ boolean isBuild = false;
+
FilterBuilderPatent() {
obj = new BasicDBObject();
}
@@ -18,12 +20,14 @@ public class FilterBuilderPatent {
public FilterBuilderPatent withCountry(String var) {
obj.put("Country", var);
+ isBuild = false;
count++;
return this;
}
public FilterBuilderPatent withText(String var) {
obj.put("Text", var);
+ isBuild = false;
count++;
return this;
}
@@ -31,17 +35,24 @@ public class FilterBuilderPatent {
public FilterBuilderPatent withClassification(String var) {
obj.put("Classification", var);
count++;
+ isBuild = false;
return this;
}
public FilterBuilderPatent withYear(int var) {
+ isBuild = false;
if (!obj.containsKey("Year")) count++;
obj.put("Year", var);
return this;
}
+ public int getYear() {
+ return obj.getInt("Year");
+ }
+
public FilterBuilderPatent withCPC(String var) {
obj.put("CPC", var);
+ isBuild = false;
count++;
hasCpc = true;
return this;
@@ -55,10 +66,19 @@ public class FilterBuilderPatent {
return obj.getString("CPC");
}
+ public String getClassificationString() {
+ return obj.getString("Classification").replace(";", "").trim();
+ }
+
+ public String getCPCString() {
+ return obj.getString("CPC").replace(";", "").trim();
+ }
+
+
public FilterBuilderPatent bySearchString(String var) {
if (var.contains("Classification=('")) {
- String search = var.substring(var.indexOf("Classification=('") + 17);
- search = search.substring(0, search.indexOf(')') - 1);
+ int start = var.indexOf("Classification=('") + 17;
+ String search = var.substring(start, var.indexOf(')', start) - 1);
if (search.equalsIgnoreCase("None") || search.equalsIgnoreCase("")) {
} else {
@@ -79,17 +99,18 @@ public class FilterBuilderPatent {
if (var.contains("Classification=('None') ; CPC=('None') ;")) {
Mapper mapper = new Mapper();
String documentQuery = var.substring(0, var.indexOf("$")).trim();
- if (mapper.getClassification(documentQuery) != null) {
- this.withClassification(mapper.getClassification(documentQuery));
- }
if (mapper.getCPC(documentQuery) != null) {
- this.withCPC(mapper.getCPC(documentQuery));
+ this.withCPC("; " + mapper.getCPC(documentQuery) + " ;");
+ }
+ if (mapper.getClassification(documentQuery) != null) {
+ this.withClassification("; " + mapper.getClassification(documentQuery) + " ;");
}
}
- if (var.contains("Year=")) {
- int start = var.indexOf("Year=(") + "Year=(".length();
- int year = Integer.valueOf(var.substring(start, var.indexOf(")", start)));
+ if (var.contains("Year: ")) {
+ int start = var.indexOf("Year: ") + "Year: ".length();
+ int ende = var.indexOf('}', start);
+ int year = Integer.valueOf(var.substring(start, ende));
this.withYear(year);
}
return this;
@@ -97,10 +118,14 @@ public class FilterBuilderPatent {
public void removeYear() {
obj.remove("Year");
+ isBuild = false;
}
public BasicDBObject build() {
-
+ if (isBuild) {
+ return rObj;
+ }
+ isBuild = true;
List list = new ArrayList<>();
Set keys = obj.keySet();
for (String a : keys) {
@@ -118,19 +143,22 @@ public class FilterBuilderPatent {
BasicDBObject first = new BasicDBObject("$or", list);
if (!this.obj.containsKey("Year")) {
if (list.size() == 0) {
- return new BasicDBObject();
+ rObj = new BasicDBObject();
+ return rObj;
}
- return first;
+ rObj = first;
+ return rObj;
}
BasicDBObject second = new BasicDBObject("Year", this.obj.getInt("Year"));
List secondList = new ArrayList<>();
if (list.size() > 0) {
secondList.add(first);
secondList.add(second);
- BasicDBObject obj = new BasicDBObject("$and", secondList);
- return obj;
+ rObj = new BasicDBObject("$and", secondList);
+ return rObj;
} else {
- return second;
+ rObj = second;
+ return rObj;
}
diff --git a/src/main/java/Main.java b/src/main/java/Main.java
index 4bde2a4..085a465 100644
--- a/src/main/java/Main.java
+++ b/src/main/java/Main.java
@@ -7,13 +7,19 @@ public class Main {
//Crawler
//startUSPTOCrawler();
//startWOSCrawler();
- //getCPC();
- //getUSPTO();
+ //PatentImporter importer = new PatentImporter(false);
+ //importer.modifyEntries();
+
+ //Classification classification = new Classification();
+ //classification.setCPCFrom("G06N 20/00",2019);
//Importer
- startUSPTOImport();
- //startWOSImport();
+
+ //startUSPTOImport();
+ startWOSImport();
+ //getCPC();
+ //getUSPTO();
}
private static void getCPC() {
diff --git a/src/main/java/Mapper.java b/src/main/java/Mapper.java
index bb9037c..87355e6 100644
--- a/src/main/java/Mapper.java
+++ b/src/main/java/Mapper.java
@@ -7,11 +7,11 @@ class Mapper {
Mapper() {
MongoClient mongo = new MongoClient(new MongoClientURI(Settings.MONGOURL.getContent()));
- DB mongoDB = mongo.getDB(Settings.DBPATENT.getContent());
- if (mongoDB.getCollectionNames().contains(Settings.COLLECTIONPATENT.getContent())) {
- collection = mongoDB.getCollection(Settings.COLLECTIONPATENT.getContent());
+ DB mongoDB = mongo.getDB(Settings.DBMAPPING.getContent());
+ if (mongoDB.getCollectionNames().contains(Settings.COLLECTIONMAPPING.getContent())) {
+ collection = mongoDB.getCollection(Settings.COLLECTIONMAPPING.getContent());
} else {
- collection = mongoDB.getCollection(Settings.COLLECTIONPATENT.getContent());
+ collection = mongoDB.getCollection(Settings.COLLECTIONMAPPING.getContent());
}
}
diff --git a/src/main/java/PatentImporter.java b/src/main/java/PatentImporter.java
index e172aa7..f40e0dd 100644
--- a/src/main/java/PatentImporter.java
+++ b/src/main/java/PatentImporter.java
@@ -100,6 +100,61 @@ class PatentImporter {
wrong = 0;
}
+ public static String getRealUSPTC(String value) {
+ if (value.length() <= 3) {
+ return "";
+ }
+
+ String upper = value.substring(0, 3);
+ if (upper.contains("D")) {
+ upper = upper.trim().replace(" ", "0");
+ if (upper.length() == 2) {
+ upper = upper.substring(0, 1) + "0" + upper.substring(1, 2);
+ }
+ } else {
+ if (upper.trim().length() == 2) {
+ upper = "0" + upper.trim();
+ }
+ if (upper.trim().length() == 1) {
+ upper = "00" + upper.trim();
+ }
+ }
+
+ String lower = value.substring(3);
+ if (lower.length() < 3) {
+ return "";
+ }
+ String rest = lower.substring(3).replace("X", "").replace(" ", "0").trim();
+ lower = lower.substring(0, 3).replace(" ", "0").trim();
+
+ if (lower.contains("DIG") || lower.contains("FOR")) {
+ char[] w = rest.toCharArray();
+ if (w[0] == '0') {
+ w[0] = Character.MIN_VALUE;
+ }
+ rest = String.valueOf(w).trim();
+ }
+ if (lower.contains("DIG") || lower.contains("FOR")) {
+ lower = lower + rest;
+ } else {
+ if (rest.length() >= 1) {
+ if (rest.indexOf("-") == 0) {
+ rest = "";
+ } else {
+ rest = rest.replace(" ", "");
+ if (rest.substring(0, 1).matches("[0-9]+")) {
+ lower = lower + "." + rest;
+ } else {
+ lower = lower + rest;
+ }
+ }
+ }
+
+ }
+
+ return upper + " " + lower;
+ }
+
private void saveOlderXML(File file, int yearInt) {
BasicDBObject patent = null;
try (BufferedReader br = new BufferedReader(new FileReader(file))) {
@@ -107,6 +162,9 @@ class PatentImporter {
boolean claimId = false;
boolean b520 = false;
boolean isWrong = false;
+ boolean b721 = false;
+ String name = "";
+ boolean b731 = false;
while ((line = br.readLine()) != null) {
if (line.contains("")) {
int start = line.indexOf("") + "".length();
int ende = line.indexOf("");
- String classification = line.substring(start, ende).trim();
+ String classification = line.substring(start, ende);
if (classification.contains("D")) {
- classification = classification.trim().replace(' ', '0');
+ classification = classification.replace(' ', '0');
}
add(patent, "Classification", classification);
continue;
@@ -173,11 +235,7 @@ class PatentImporter {
if (b520) {
int start = line.indexOf("") + "".length();
int ende = line.indexOf("");
-
-
- String classification = line.substring(start, ende).trim();
-
-
+ String classification = line.substring(start, ende);
add(patent, "Classification", classification);
continue;
@@ -189,14 +247,64 @@ class PatentImporter {
int start = line.indexOf("") + "".length();
int ende = line.indexOf("");
- String classification = line.substring(start, ende).trim();
-
-
+ String classification = line.substring(start, ende);
add(patent, "Classification", classification);
continue;
}
+ if (line.contains("")) {
+ b731 = true;
+ continue;
+ }
+
+ if (line.contains("")) {
+ b731 = false;
+ continue;
+ }
+
+ if (b731) {
+ if (line.contains("")) {
+ int start = line.indexOf("") + "".length();
+ int ende = line.indexOf("", start);
+ String org = line.substring(start, ende);
+ add(patent, "Org", org);
+ continue;
+ }
+ }
+
+ if (line.contains("")) {
+ b721 = true;
+ continue;
+ }
+
+ if (line.contains("")) {
+ b721 = false;
+ continue;
+ }
+
+ if (b721) {
+ if (line.contains("")) {
+ int start = line.indexOf("") + "".length();
+ int end = line.indexOf("", start);
+ name = line.substring(start, end);
+ }
+
+ if (line.contains("")) {
+ int start = line.indexOf("") + "".length();
+ int end = line.indexOf("", start);
+ name = name + " " + line.substring(start, end);
+ }
+
+ if (line.contains("")) {
+ name = name + " {CITY: " + line.substring(line.indexOf("") + "".length(), line.indexOf("")) + "}";
+ add(patent, "Inventor", name);
+ name = "";
+ }
+ }
+
+
+
if (withText) {
if (line.contains("RE043000")) {
- System.out.println("Hier");
+ if (line.contains("")) {
@@ -258,6 +451,7 @@ class PatentImporter {
if (line.contains("")) {
int start = line.indexOf("") + "".length();
int ende = line.indexOf("");
+ String key = line.substring(start, ende);
add(patent, "CPC", line.substring(start, ende));
continue;
}
@@ -266,41 +460,54 @@ class PatentImporter {
if (line.contains("")) {
int start = line.indexOf("") + "".length();
int ende = line.indexOf("");
+ String key = line.substring(start, ende);
add(patent, "CPC", line.substring(start, ende));
continue;
}
if (line.contains("")) {
int start = line.indexOf("") + "".length();
int ende = line.indexOf("");
- String newClassification = line.substring(start, ende).trim();
+ String newClassification = line.substring(start, ende);
if (newClassification.equalsIgnoreCase("None") || newClassification.equalsIgnoreCase("one")) {
continue;
}
- add(patent, "Classification", newClassification);
+ add(patent, "Classification", line.substring(start, ende));
continue;
}
+ if (line.contains("")) {
+ int start = line.indexOf("") + "".length();
+ int ende = line.indexOf("");
+ String newClassification = line.substring(start, ende);
+ if (newClassification.equalsIgnoreCase("None") || newClassification.equalsIgnoreCase("one")) {
+ continue;
+ }
+ add(patent, "Classification", line.substring(start, ende));
+ continue;
+ }
+
+
+ if (line.contains("") || line.contains("") || line.contains("")) {
+ inventor = false;
+ }
+
+ if (inventor) {
+ if (line.contains("")) {
+ org = true;
+ name = line.substring(line.indexOf("") + "".length(), line.indexOf(""));
+ }
+
+ if (line.contains("")) {
+ int start = line.indexOf("") + "".length();
+ int end = line.indexOf("");
+ name = line.substring(start, end);
+ }
+
+ if (line.contains("")) {
+ int start = line.indexOf("") + "".length();
+ int end = line.indexOf("");
+ String country = line.substring(start, end);
+ add(patent, "Country", country);
+ }
+
+ if (line.contains("")) {
+ int start = line.indexOf("") + "".length();
+ int end = line.indexOf("");
+ name = line.substring(start, end) + " " + name;
+ }
+
+ if (line.contains("")) {
+ int start = line.indexOf("") + "".length();
+ int end = line.indexOf("");
+ if (start != -1 && end != -1) {
+ if (org) {
+ add(patent, "Org", name + " {CITY: " + line.substring(start, end) + "}");
+ org = false;
+ } else {
+ add(patent, "Inventor", name + " {CITY: " + line.substring(start, end) + "}");
+ }
+
+ }
+ name = "";
+ }
+ }
+
if (line.contains("")) {
int start = line.indexOf("") + "".length();
int ende = line.indexOf("");
- String newClassification = line.substring(start, ende).trim();
- add(patent, "CPC", newClassification);
+ String key = line.substring(start, ende);
+ add(patent, "CPC", line.substring(start, ende));
continue;
}
@@ -455,98 +724,47 @@ class PatentImporter {
}
}
-
- private void saveOlderTTX(File file, int yearInt) {
- BasicDBObject patent = null;
- try (BufferedReader br = new BufferedReader(new FileReader(file))) {
- String line;
-
- while ((line = br.readLine()) != null) {
-
- //Neues Patent
- if (line.contains("PATN")) {
- if (patent != null) {
- count++;
- collection.insert(patent);
- }
- patent = new BasicDBObject();
- }
-
- //Titel
- if (line.contains("TTL")) {
- String title = line.substring(5);
- patent.put("Text", title);
- }
-
- //City
- if (line.contains("CTY")) {
- String city = line.substring(5);
- patent.put("City", city);
- }
-
- //Country
- if (line.contains("CNT")) {
- String city = line.substring(5);
- patent.put("Country", city);
- }
-
- //Classification
- if (line.contains("OCL")) {
- String classification = line.substring(5);
- //patent.put("Classification", classification);
- }
-
- //Application Filing Year
- if (line.contains("APD")) {
- try {
- if (line.contains("*") || line.contains("\\0")) {
- patent.put("Year", "*");
- } else {
- String year = line.substring(5, 9);
- patent.put("Year", year);
- }
- } catch (Exception e) {
- System.out.println(line);
- e.printStackTrace();
- }
-
- }
- }
- if (!patent.containsKey("Year")) {
- System.out.println("Year missing:" + file.getName() + ";" + yearInt);
- }
- /*if(!patent.containsKey("Classification"))
- {
- System.out.println("Text missing:" + file.getName() + ";" + yearInt);
- }*/
- if (!patent.containsKey("Text")) {
- System.out.println("Text missing:" + file.getName() + ";" + yearInt);
- }
- count++;
- collection.insert(patent);
- } catch (IOException e) {
- e.printStackTrace();
- }
- if (Settings.DELETEFILEAFTEIMPORT.getContent().equals("YES")) {
- file.delete();
- }
- }
-
-
- private void unzip(int year) {
- UnzipUtility.unzipYear(year);
- }
-
private void add(BasicDBObject obj, String key, String value) {
- String text = obj.getString(key);
- if (text == null) {
- obj.put(key, "; " + value);
- return;
+
+ if (key.equals("Classification")) {
+ value = getRealUSPTC(value);
+ if (value.equals("")) {
+ return;
+ }
}
- if (text.contains(value)) {
- return;
+
+ if (obj.get(key) != null) {
+ String text = obj.getString(key);
+ if (text.contains(value)) {
+ return;
+ }
+ obj.put(key, text + "; " + value + " ;");
} else {
- obj.put(key, text + " ; " + value);
+ obj.put(key, "; " + value + " ;");
+ }
+
+ }
+
+ public void modifyEntries() {
+ DBCursor cursor = collection.find();
+ Classification classificationHelper = new Classification();
+ while (cursor.hasNext()) {
+ BasicDBObject obj = (BasicDBObject) cursor.next();
+ if (obj.get("Classification") != null) {
+ String newClassification = "";
+ String classification = obj.getString("Classification");
+ while (classification.indexOf(';') != -1) {
+ String a = classification.substring(1, classification.indexOf(';', 1));
+ if (!classificationHelper.getUSPC(a).equals(a)) {
+ newClassification = newClassification + "; " + a + " ;";
+ }
+ classification = classification.substring(classification.indexOf(';', 1));
+ }
+ BasicDBObject query = (BasicDBObject) obj.copy();
+ obj.remove("Classification");
+ obj.append("Classification", newClassification);
+ collection.update(query, obj);
+ }
}
}
diff --git a/src/main/java/PatentQueries.java b/src/main/java/PatentQueries.java
index bf55e7f..9e9e8cf 100644
--- a/src/main/java/PatentQueries.java
+++ b/src/main/java/PatentQueries.java
@@ -37,14 +37,18 @@ public class PatentQueries {
DBCursor cursor = getPatents(patent);
JsonObject toReturn = new JsonObject();
+ Classification classification = new Classification();
+ int abJahr = classification.getCPCFrom(patent.getCPCString());
while (cursor.hasNext()) {
BasicDBObject obj = (BasicDBObject) cursor.next();
- if (obj.containsKey("CPC")) {
- if (patent.hasCpc) {
- String cpcToMatch = obj.getString("CPC");
- String matcher = patent.getCPC();
- if (!cpcToMatch.contains(matcher)) {
- continue;
+ if (obj.getInt("Year") > abJahr) {
+ if (obj.containsKey("CPC")) {
+ if (patent.hasCpc) {
+ String cpcToMatch = obj.getString("CPC");
+ String matcher = patent.getCPC();
+ if (!cpcToMatch.contains(matcher)) {
+ continue;
+ }
}
}
}
@@ -108,11 +112,11 @@ public class PatentQueries {
return toReturn;
}
- public JsonObject getKeywords(FilterBuilderPatent patent, boolean removeOnes, boolean getFirst50, boolean sort) {
+ public JsonObject getAuthors(FilterBuilderPatent patent, boolean removeOnes, boolean getFirst50) {
if (analyzes.isAnalyzed(null, patent)) {
- JsonElement element = analyzes.getAnalyzePatent(patent).get("Keywords");
+ JsonElement element = analyzes.getAnalyzePatent(patent).get("Author");
if (element != null) {
- System.out.println("[INFO] Laden der PatentKeywoerter");
+ System.out.println("[INFO] Laden der PatentAutoren");
String a = element.getAsString();
JsonParser parserJson = new JsonParser();
JsonObject obj = (JsonObject) parserJson.parse(a);
@@ -129,56 +133,258 @@ public class PatentQueries {
}
}
- System.out.println("[INFO] Starte Keywordsuche Patent");
+
+ System.out.println("[INFO] Starte Author Patent");
DBCursor cursor = getPatents(patent);
JsonObject jsonObject = new JsonObject();
int count = 0;
while (cursor.hasNext()) {
BasicDBObject obj = (BasicDBObject) cursor.next();
ArrayList keywords = new ArrayList<>();
- if (obj.containsKey("CPC")) {
- if (patent.hasCpc) {
- String cpcToMatch = obj.getString("CPC");
- String matcher = patent.getCPC();
- if (cpcToMatch.contains(matcher)) {
- String classification;
- if (obj.get("CPC") == null) {
- System.out.println("Keyword = null :" + obj.get("_id").toString());
- classification = "";
- } else {
- classification = obj.getString("CPC").trim();
- }
- while (classification.indexOf(';', 1) != -1) {
- String toAdd = classification.substring(1, classification.indexOf(';', 1)).trim();
- keywords.add(toAdd);
- classification = classification.substring(classification.indexOf(';', 1));
- }
- if (!classification.equals("")) {
- keywords.add(classification.substring(1).trim());
- }
- }
- }
- } else {
- String classification;
- if (obj.get("Classification") == null) {
- System.out.println("Keyword = null :" + obj.get("_id").toString());
- classification = "";
- } else {
- classification = obj.getString("Classification").trim();
- }
- while (classification.indexOf(';', 1) != -1) {
- String toAdd = classification.substring(1, classification.indexOf(';', 1)).trim();
- keywords.add(toAdd);
- classification = classification.substring(classification.indexOf(';', 1));
- }
- if (!classification.equals("")) {
- keywords.add(classification.substring(1).trim());
+ if (obj.get("Inventor") != null) {
+ String inventors = obj.getString("Inventor");
+ while (inventors.indexOf(";") != -1) {
+ String inventor = inventors.substring(1, inventors.indexOf(';', 1));
+ inventors = inventors.substring(inventors.indexOf(';', 1) + 1);
+ keywords.add(inventor);
}
}
QuerySupport.addToJson(jsonObject, keywords);
count = count + keywords.size();
+ keywords.clear();
+ }
+ jsonObject.addProperty("Count", count);
+ analyzes.addPatentAnalyze(patent, "Author", jsonObject.toString());
+ jsonObject.remove("Count");
+ if (removeOnes) {
+ QuerySupport.removeEverythingUnder(jsonObject, 1);
+ }
+
+ if (getFirst50) {
+ jsonObject = QuerySupport.getFirst(jsonObject, 50);
+ }
+ jsonObject.addProperty("Count", count);
+ System.out.println("[INFO] Beende Author Patent");
+ return jsonObject;
+ }
+
+ public JsonObject getAuthorsPerYear(FilterBuilderPatent patent) {
+ if (analyzes.isAnalyzed(null, patent)) {
+ JsonElement element = analyzes.getAnalyzePatent(patent).get("AuthorsPerYear");
+ if (element != null) {
+ String a = element.getAsString();
+ JsonParser parserJson = new JsonParser();
+ return (JsonObject) parserJson.parse(a);
+ }
+ }
+
+ JsonObject jsonObject = new JsonObject();
+
+ int year = 0;
+ if (patent.build().containsKey("Year")) {
+ year = patent.build().getInt("Year");
+ }
+ int currentYear = Calendar.getInstance().get(Calendar.YEAR);
+ for (int i = 2002; i < currentYear; i++) {
+ int count = 0;
+ JsonObject keys = getAuthors(patent.withYear(i), false, false);
+ Map attributes = new HashMap();
+ Set> entrySet = keys.entrySet();
+ for (Map.Entry entry : entrySet) {
+ attributes.put(entry.getKey(), keys.get(entry.getKey()));
+ }
+
+ for (Map.Entry att : attributes.entrySet()) {
+ count++;
+ }
+ jsonObject.addProperty(String.valueOf(i), count);
+ }
+
+
+ if (year != 0) {
+ patent.withYear(year);
+ } else {
+ patent.removeYear();
+ }
+ analyzes.addPatentAnalyze(patent, "AuthorsPerYear", jsonObject.toString());
+ return jsonObject;
+ }
+
+ public JsonObject getAuthorsPerYearRelative(FilterBuilderPatent patent) {
+ if (analyzes.isAnalyzed(null, patent)) {
+ JsonElement element = analyzes.getAnalyzePatent(patent).get("AuthorsPerYearRelative");
+ if (element != null) {
+ String a = element.getAsString();
+ JsonParser parserJson = new JsonParser();
+ return (JsonObject) parserJson.parse(a);
+ }
+ }
+
+
+ int year = 0;
+ if (patent.build().containsKey("Year")) {
+ year = patent.build().getInt("Year");
+ }
+ JsonObject json = getAuthorsPerYear(patent);
+ JsonObject toReturn = new JsonObject();
+ int thisYear = Calendar.getInstance().get(Calendar.YEAR);
+ for (int i = 2003; i <= thisYear; i++) {
+ double lastYear = 0;
+ if (json.get(String.valueOf(i - 1)) != null) {
+ lastYear = json.get(String.valueOf(i - 1)).getAsInt();
+ }
+ double currentYear = 0;
+ if (json.get(String.valueOf(i)) != null) {
+ currentYear = json.get(String.valueOf(i)).getAsInt();
+ }
+ if (lastYear == 0) {
+ toReturn.addProperty(String.valueOf(i), String.valueOf(0));
+ } else {
+ double value = currentYear / lastYear;
+ toReturn.addProperty(String.valueOf(i), String.valueOf(value));
+ }
+ }
+
+
+ if (year != 0) {
+ patent.withYear(year);
+ }
+ analyzes.addPatentAnalyze(patent, "AuthorsPerYearRelative", toReturn.toString());
+ return toReturn;
+ }
+
+ public JsonObject getCountrys(FilterBuilderPatent patent) {
+ if (analyzes.isAnalyzed(null, patent)) {
+ JsonElement element = analyzes.getAnalyzePatent(patent).get("Country");
+ if (element != null) {
+ System.out.println("[INFO] Laden der Patent Laneder");
+ String a = element.getAsString();
+ JsonParser parserJson = new JsonParser();
+ JsonObject obj = (JsonObject) parserJson.parse(a);
+ return obj;
+ }
+ }
+
+
+ System.out.println("[INFO] Starte Laender Patent");
+ DBCursor cursor = getPatents(patent);
+ JsonObject jsonObject = new JsonObject();
+ int count = 0;
+ while (cursor.hasNext()) {
+ BasicDBObject obj = (BasicDBObject) cursor.next();
+ ArrayList keywords = new ArrayList<>();
+
+ if (obj.get("Country") != null) {
+ String countries = obj.getString("Country");
+ while (countries.indexOf(";") != -1) {
+ String country = countries.substring(1, countries.indexOf(';', 1)).trim();
+ countries = countries.substring(countries.indexOf(';', 1) + 1);
+ if (country.equals("unknown")) {
+ continue;
+ }
+ keywords.add(country);
+ }
+ }
+
+ QuerySupport.addToJson(jsonObject, keywords);
+ count = count + keywords.size();
+ keywords.clear();
+ }
+ jsonObject.addProperty("Count", count);
+ analyzes.addPatentAnalyze(patent, "Country", jsonObject.toString());
+ System.out.println("[INFO] Beende Laender Patent");
+ return jsonObject;
+ }
+
+
+ private ArrayList getList(String full, boolean cpc) {
+ ArrayList list = new ArrayList<>();
+ while (full.indexOf(";") != -1) {
+ String toReturn = full.substring(1, full.indexOf(";", 1)).trim();
+ if (cpc) {
+ list.add("CPC: " + toReturn);
+ } else {
+ list.add(toReturn);
+ }
+
+ full = full.substring(full.indexOf(";", 1) + 1);
+ }
+ return list;
+ }
+
+ public JsonObject getTranslatedKeywords(FilterBuilderPatent patent) {
+ if (analyzes.isAnalyzed(null, patent)) {
+ JsonElement element = analyzes.getAnalyzePatent(patent).get("KeywordsTranslated");
+ if (element != null) {
+ System.out.println("[INFO] Laden der PatentKeywoerter");
+ String a = element.getAsString();
+ JsonParser parserJson = new JsonParser();
+ JsonObject obj = (JsonObject) parserJson.parse(a);
+ return obj;
+ }
+ }
+
+ JsonObject jsonObject = getKeywords(patent, true, false, false);
+ jsonObject = QuerySupport.getFirst(jsonObject, 100);
+ jsonObject = QuerySupport.changeToKeywords(jsonObject);
+ jsonObject = QuerySupport.getFirst(jsonObject, 50);
+ analyzes.addPatentAnalyze(patent, "KeywordsTranslated", jsonObject.toString());
+ return jsonObject;
+ }
+
+ public JsonObject getKeywords(FilterBuilderPatent patent, boolean removeOnes, boolean getFirst50, boolean translate) {
+ if (translate) {
+ return getTranslatedKeywords(patent);
+ }
+ if (analyzes.isAnalyzed(null, patent)) {
+ JsonElement element = analyzes.getAnalyzePatent(patent).get("Keywords");
+ if (element != null) {
+ System.out.println("[INFO] Laden der PatentKeywoerter");
+ String a = element.getAsString();
+ JsonParser parserJson = new JsonParser();
+ JsonObject obj = (JsonObject) parserJson.parse(a);
+ int count = obj.get("Count").getAsInt();
+ obj.remove("Count");
+ if (removeOnes) {
+ obj = QuerySupport.removeEverythingUnder(obj, 1);
+ }
+ if (getFirst50) {
+ obj = QuerySupport.getFirst(obj, 50);
+ }
+ obj.addProperty("Count", count);
+
+ return obj;
+ }
+ }
+
+ System.out.println("[INFO] Starte Keywordsuche Patent");
+ DBCursor cursor = getPatents(patent);
+ JsonObject jsonObject = new JsonObject();
+ int count = 0;
+ boolean checkCPC = true;
+ Classification classification = new Classification();
+ if (classification.getCPCFrom(patent.getCPCString()) > patent.getYear()) {
+ checkCPC = false;
+ }
+ while (cursor.hasNext()) {
+ BasicDBObject obj = (BasicDBObject) cursor.next();
+ ArrayList keywords = new ArrayList<>();
+ ArrayList cpcKeywords = new ArrayList<>();
+
+ if (checkCPC && obj.containsKey("CPC") && obj.getString("CPC").contains(patent.getCPC())) {
+ cpcKeywords = getList(obj.getString("CPC"), true);
+ cpcKeywords.remove(patent.getCPCString());
+ QuerySupport.addToJson(jsonObject, cpcKeywords);
+ } else {
+ keywords = getList(obj.getString("Classification"), false);
+ keywords.remove(patent.getClassificationString());
+ QuerySupport.addToJson(jsonObject, keywords);
+ }
+ count = count + keywords.size() + cpcKeywords.size();
+ cpcKeywords.clear();
+ keywords.clear();
}
jsonObject.addProperty("Count", count);
analyzes.addPatentAnalyze(patent, "Keywords", jsonObject.toString());
@@ -214,7 +420,9 @@ public class PatentQueries {
}
int currentYear = Calendar.getInstance().get(Calendar.YEAR);
for (int i = 2002; i < currentYear; i++) {
+ List doubles = new ArrayList<>();
int count = 0;
+ boolean isCPC = false;
JsonObject keys = getKeywords(patent.withYear(i), false, false, false);
Map attributes = new HashMap();
Set> entrySet = keys.entrySet();
@@ -223,7 +431,25 @@ public class PatentQueries {
}
for (Map.Entry att : attributes.entrySet()) {
- count++;
+ if (doubles.contains(att.getKey())) {
+ System.out.println("Doppelter Key? " + att.getKey());
+ } else {
+ if (!isCPC) {
+ if (att.getKey().contains("CPC:")) {
+ count = 0;
+ isCPC = true;
+ } else {
+ doubles.add(att.getKey());
+ count++;
+ }
+ } else {
+ if (att.getKey().contains("CPC:")) {
+ doubles.add(att.getKey());
+ count++;
+ }
+ }
+
+ }
}
jsonObject.addProperty(String.valueOf(i), count);
}
@@ -270,6 +496,26 @@ public class PatentQueries {
return toReturn;
}
+ public JsonObject getAllKeywords(FilterBuilderPatent pat) {
+ if (analyzes.isAnalyzed(null, pat)) {
+ JsonElement element = analyzes.getAnalyzePatent(pat).get("AllKeywords");
+ if (element != null) {
+ String a = element.getAsString();
+ JsonParser parserJson = new JsonParser();
+ return (JsonObject) parserJson.parse(a);
+ }
+ }
+ int currentYear = Calendar.getInstance().get(Calendar.YEAR);
+ JsonObject obj = getKeywords(pat.withYear(2003), true, true, false);
+ for (int i = 2003; i < currentYear; i++) {
+ obj = QuerySupport.add(obj, getKeywords(pat.withYear(i), true, true, false));
+ }
+ pat.removeYear();
+ obj = QuerySupport.changeToKeywords(obj);
+ analyzes.addPatentAnalyze(pat, "AllKeywords", obj.toString());
+ return obj;
+ }
+
private DBCursor getPatents(FilterBuilderPatent filter) {
return collection.find(filter.build());
}
diff --git a/src/main/java/Queries.java b/src/main/java/Queries.java
deleted file mode 100644
index 8210428..0000000
--- a/src/main/java/Queries.java
+++ /dev/null
@@ -1,452 +0,0 @@
-import com.mongodb.DB;
-import com.mongodb.DBCollection;
-import com.mongodb.MongoClient;
-
-public class Queries {
-
- DBCollection collectionPatent;
- DBCollection collectionDocuments;
- private MongoClient mongo;
- private DB mongoDB;
- DoneAnalyzes analyzes;
-
-
- /*Queries() {
- analyzes = new DoneAnalyzes();
- mongo = new MongoClient(new MongoClientURI(Settings.MONGOURL.getContent()));
- mongoDB = mongo.getDB(Settings.DBPATENT.getContent());
-
- if (mongoDB.getCollectionNames().contains(Settings.COLLECTIONPATENT.getContent())) {
- collectionPatent = mongoDB.getCollection(Settings.COLLECTIONPATENT.getContent());
- } else {
- collectionPatent = mongoDB.getCollection(Settings.COLLECTIONPATENT.getContent());
- }
-
- mongoDB = mongo.getDB(Settings.DBDOCUMENT.getContent());
-
- if (mongoDB.getCollectionNames().contains(Settings.COLLECTIONDOCUMENT.getContent())) {
- collectionDocuments = mongoDB.getCollection(Settings.COLLECTIONDOCUMENT.getContent());
- } else {
- collectionDocuments = mongoDB.getCollection(Settings.COLLECTIONDOCUMENT.getContent());
- collectionDocuments.createIndex(new BasicDBObject("DOI", 1), "DOI", true);
- }
- }
-
- public long getCountDocuments(FilterBuilderDocument filter) {
- return collectionDocuments.count(filter.build());
- }
-
- public DBCursor getDocuments(FilterBuilderDocument filter) {
- return collectionDocuments.find(filter.build());
- }
-
- public JsonObject countSortedByYearDocuments(FilterBuilderDocument document) {
- if (analyzes.isAnalyzed(document, null)) {
- JsonElement element = analyzes.getAnalyzeDocument(document).get("Years");
- if (element != null) {
- String a = element.getAsString();
- JsonParser parserJson = new JsonParser();
- return (JsonObject) parserJson.parse(a);
- }
- }
-
- JsonObject json = new JsonObject();
-
- DBCursor curr = getDocuments(document);
- while(curr.hasNext())
- {
- BasicDBObject obj = (BasicDBObject) curr.next();
- if(obj.get("PublicationYear")!=null)
- {
- String year = String.valueOf((int)obj.getDouble("PublicationYear"));
- int count = 1;
- if(json.get(year)!=null)
- {
- count = json.get(year).getAsInt() + 1;
- }
- json.addProperty(year,count);
- if(count%1000==0)
- {
- System.out.println("[INFO] Analyzing Document per Year:" + json.toString());
- }
- }
- else
- {
- if(obj.get("DOI")!=null)
- {
- System.out.println("Failed to analyze Document with DOI of:" + obj.getString("DOI"));
- }
- else
- {
- System.out.println("Failed to analyze Document with DB ID of:" + obj.getString("_id"));
- }
- }
- }
- analyzes.addDocumentAnalyze(document, "Years", json.toString());
- return json;
- }
-
- public long getCountPatents(FilterBuilderPatent filter) {
- BasicDBObject obj = filter.build();
- return collectionPatent.count(obj);
- }
-
- public DBCursor getPatents(FilterBuilderPatent filter) {
- return collectionPatent.find(filter.build());
- }
-
- public JsonObject countSortedByYearPatents(FilterBuilderPatent patent) {
- if (analyzes.isAnalyzed(null, patent)) {
- JsonElement element = analyzes.getAnalyzePatent(patent).get("Years");
- if (element != null) {
- String a = element.getAsString();
- JsonParser parserJson = new JsonParser();
- return (JsonObject) parserJson.parse(a);
- }
- }
-
- DBCursor cursor = getPatents(patent);
- JsonObject toReturn = new JsonObject();
-
- while(cursor.hasNext())
- {
- BasicDBObject obj = (BasicDBObject) cursor.next();
- if(obj.containsKey("CPC"))
- {
- if(patent.hasCpc)
- {
- String cpcToMatch = obj.getString("CPC");
- String matcher = patent.getCPC();
- if(!cpcToMatch.contains(matcher))
- {
- continue;
- }
- }
- }
- else
- {
- continue;
- }
- if(obj.get("Year")!=null)
- {
- String year = obj.getString("Year");
- int count = 1;
- if(toReturn.get(year)!=null)
- {
- count = toReturn.get(year).getAsInt() + 1;
- }
- toReturn.addProperty(year,count);
- if(count%100==0)
- {
- System.out.println("[INFO] Analyzing Patent per Year:" + toReturn.toString());
- }
- }
- else
- {
- System.out.print("Failed to analyze Patent with DB ID of:" + obj.getString("_id"));
- }
- }
- analyzes.addPatentAnalyze(patent, "Years", toReturn.toString());
- return toReturn;
- }
-
- public JsonObject countSortedByYearRelativePatents(FilterBuilderPatent patent) {
- if (analyzes.isAnalyzed(null, patent)) {
- JsonElement element = analyzes.getAnalyzePatent(patent).get("YearsRelative");
- if (element != null) {
- String a = element.getAsString();
- JsonParser parserJson = new JsonParser();
- return (JsonObject) parserJson.parse(a);
- }
- }
-
- JsonObject json = countSortedByYearPatents(patent);
- JsonObject toReturn = new JsonObject();
- int thisYear = Calendar.getInstance().get(Calendar.YEAR);
- for (int i = 2003; i <= thisYear; i++) {
- double lastYear = 0;
- if(json.get(String.valueOf(i - 1))!=null)
- {
- lastYear = json.get(String.valueOf(i - 1)).getAsInt();
- }
- double currentYear = 0;
- if(json.get(String.valueOf(i))!=null)
- {
- currentYear = json.get(String.valueOf(i)).getAsInt();
- }
- if (lastYear == 0) {
- toReturn.addProperty(String.valueOf(i), String.valueOf(0));
- } else {
- double value = currentYear / lastYear;
- toReturn.addProperty(String.valueOf(i), String.valueOf(value));
- }
- }
- analyzes.addPatentAnalyze(patent, "YearsRelative", toReturn.toString());
- return toReturn;
- }
-
- public JsonObject countSortedByYearRelativeDocuments(FilterBuilderDocument document) {
-
- if (analyzes.isAnalyzed(document, null)) {
- JsonElement element = analyzes.getAnalyzeDocument(document).get("YearsRelative");
- if (element != null) {
- String a = element.getAsString();
- JsonParser parserJson = new JsonParser();
- return (JsonObject) parserJson.parse(a);
- }
- }
- JsonObject json = countSortedByYearDocuments(document);
- JsonObject toReturn = new JsonObject();
- int thisYear = Calendar.getInstance().get(Calendar.YEAR);
- for (int i = 2003; i <= thisYear; i++) {
- double lastYear = 0;
- if(json.get(String.valueOf(i - 1))!=null)
- {
- lastYear = json.get(String.valueOf(i - 1)).getAsInt();
- }
- double currentYear = 0;
- if(json.get(String.valueOf(i))!=null)
- {
- currentYear = json.get(String.valueOf(i)).getAsInt();
- }
- if (lastYear == 0) {
- toReturn.addProperty(String.valueOf(i), String.valueOf(0));
- } else {
- double value = currentYear / lastYear;
- toReturn.addProperty(String.valueOf(i), String.valueOf(value));
- }
- }
- analyzes.addDocumentAnalyze(document, "YearsRelative", toReturn.toString());
- return toReturn;
- }
-
-
-
-
-
-
-
-
-
-
-
- public JsonObject getKeywordsDocument(FilterBuilderDocument document, boolean removeOnes,boolean first50,boolean sort) {
-
- String search;
- if (removeOnes) {
- search = "KeywordsRemoved";
- } else {
- search = "Keywords";
- }
- if (analyzes.isAnalyzed(document, null)) {
- JsonElement element = analyzes.getAnalyzeDocument(document).get(search);
- if (element != null) {
- String a = element.getAsString();
- JsonParser parserJson = new JsonParser();
- if(first50) return getFirst50((JsonObject) parserJson.parse(a));
- return (JsonObject) parserJson.parse(a);
- }
- }
-
- System.out.println("[INFO] Starte Keywordsuche Dokument");
- DBCursor cursor = getDocuments(document);
- JsonObject jsonObject = new JsonObject();
- int count = 0;
- while (cursor.hasNext()){
- BasicDBObject obj = (BasicDBObject) cursor.next();
- String classification;
- if (obj.get("Keywords") == null) {
- System.out.println("Keyword = 0 : " + obj.get("_id").toString());
- classification = "";
- } else {
- classification = obj.getString("Keywords").trim();
- }
- ArrayList keywords = new ArrayList<>();
- while (classification.indexOf(';', 1) != -1) {
- String toAdd = classification.substring(0, classification.indexOf(';', 1)).trim();
- keywords.add(toAdd);
- classification = classification.substring(classification.indexOf(';', 1) + 2);
- }
- if (!classification.equals("")) {
- keywords.add(classification.trim());
- }
- addToJson(jsonObject, keywords);
- count = count + keywords.size();
- }
- if (removeOnes) {
- removeOne(jsonObject);
- }
- if(sort)
- {
- jsonObject = sortJson(jsonObject);
- }
-
- jsonObject = asPercentile(jsonObject, count);
- jsonObject.addProperty("Count", count);
- analyzes.addDocumentAnalyze(document, search, jsonObject.toString());
- if(first50)
- {
- return getFirst50(jsonObject);
- }
- else {
- return jsonObject;
- }
-
- }
-
-
- public JsonObject getKeywordsPatentPerYear(FilterBuilderPatent patent) {
- if (analyzes.isAnalyzed(null, patent)) {
- JsonElement element = analyzes.getAnalyzePatent(patent).get("KeywordsPerYear");
- if (element != null) {
- String a = element.getAsString();
- JsonParser parserJson = new JsonParser();
- return (JsonObject) parserJson.parse(a);
- }
- }
-
- JsonObject jsonObject = new JsonObject();
-
- int year = 0;
- if (patent.build().containsKey("Year")) {
- year = patent.build().getInt("Year");
- }
- int currentYear = Calendar.getInstance().get(Calendar.YEAR);
- for (int i = 2002; i < currentYear; i++) {
- int count = 0;
- JsonObject keys = getKeywordsPatent(patent.withYear(i), false,false,false);
- Map attributes = new HashMap();
- Set> entrySet = keys.entrySet();
- for (Map.Entry entry : entrySet) {
- attributes.put(entry.getKey(), keys.get(entry.getKey()));
- }
-
- for (Map.Entry att : attributes.entrySet()) {
- count++;
- }
- jsonObject.addProperty(String.valueOf(i), count);
- }
-
-
- if (year != 0) {
- patent.withYear(year);
- }
- else
- {
- patent.removeYear();
- }
- analyzes.addPatentAnalyze(patent, "KeywordsPerYear", jsonObject.toString());
- return jsonObject;
- }
-
- public JsonObject getKeywordsDocumentPerYear(FilterBuilderDocument document) {
- if (analyzes.isAnalyzed(document, null)) {
- JsonElement element = analyzes.getAnalyzeDocument(document).get("KeywordsPerYear");
- if (element != null) {
- String a = element.getAsString();
- JsonParser parserJson = new JsonParser();
- return (JsonObject) parserJson.parse(a);
- }
- }
-
- JsonObject jsonObject = new JsonObject();
-
- int year = 0;
- if (document.build().containsKey("Year")) {
- year = document.build().getInt("Year");
- }
- int currentYear = Calendar.getInstance().get(Calendar.YEAR);
- for (int i = 2002; i < currentYear; i++) {
- int count = 0;
- JsonObject keys = getKeywordsDocument(document.withYear(i), false,false,false);
- Map attributes = new HashMap();
- Set> entrySet = keys.entrySet();
- for (Map.Entry entry : entrySet) {
- attributes.put(entry.getKey(), keys.get(entry.getKey()));
- }
-
- for (Map.Entry att : attributes.entrySet()) {
- count++;
- }
- jsonObject.addProperty(String.valueOf(i), count);
- }
-
-
- if (year != 0) {
- document.withYear(year);
- }
- analyzes.addDocumentAnalyze(document, "KeywordsPerYear", jsonObject.toString());
- return jsonObject;
- }
-
- public JsonObject countSortedByYearRelativeKeywordsDocuments(FilterBuilderDocument document) {
-
- if (analyzes.isAnalyzed(document, null)) {
- JsonElement element = analyzes.getAnalyzeDocument(document).get("YearsKeywordsRelative");
- if (element != null) {
- String a = element.getAsString();
- JsonParser parserJson = new JsonParser();
- return (JsonObject) parserJson.parse(a);
- }
- }
- JsonObject json = getKeywordsDocumentPerYear(document);
- JsonObject toReturn = new JsonObject();
- int thisYear = Calendar.getInstance().get(Calendar.YEAR);
- for (int i = 2003; i <= thisYear; i++) {
- double lastYear = 0;
- if(json.get(String.valueOf(i - 1))!=null)
- {
- lastYear = json.get(String.valueOf(i - 1)).getAsInt();
- }
- double currentYear = 0;
- if(json.get(String.valueOf(i))!=null)
- {
- currentYear = json.get(String.valueOf(i)).getAsInt();
- }
- if (lastYear == 0) {
- toReturn.addProperty(String.valueOf(i), String.valueOf(0));
- } else {
- double value = currentYear / lastYear;
- toReturn.addProperty(String.valueOf(i), String.valueOf(value));
- }
- }
- analyzes.addDocumentAnalyze(document, "YearsKeywordsRelative", toReturn.toString());
- return toReturn;
- }
-
- public JsonObject countSortedByYearRelativeKeywordsPatents(FilterBuilderPatent patent) {
- if (analyzes.isAnalyzed(null, patent)) {
- JsonElement element = analyzes.getAnalyzePatent(patent).get("YearsKeywordsRelative");
- if (element != null) {
- String a = element.getAsString();
- JsonParser parserJson = new JsonParser();
- return (JsonObject) parserJson.parse(a);
- }
- }
- JsonObject json = getKeywordsPatentPerYear(patent);
- JsonObject toReturn = new JsonObject();
- int thisYear = Calendar.getInstance().get(Calendar.YEAR);
- for (int i = 2003; i <= thisYear; i++) {
- double lastYear = 0;
- if(json.get(String.valueOf(i - 1))!=null)
- {
- lastYear = json.get(String.valueOf(i - 1)).getAsInt();
- }
- double currentYear = 0;
- if(json.get(String.valueOf(i))!=null)
- {
- currentYear = json.get(String.valueOf(i)).getAsInt();
- }
- if (lastYear == 0) {
- toReturn.addProperty(String.valueOf(i), String.valueOf(0));
- } else {
- double value = currentYear / lastYear;
- toReturn.addProperty(String.valueOf(i), String.valueOf(value));
- }
- }
- analyzes.addPatentAnalyze(patent, "YearsKeywordsRelative", toReturn.toString());
- return toReturn;
- }*/
-
-
-}
diff --git a/src/main/java/QuerySupport.java b/src/main/java/QuerySupport.java
index 9fd92bf..5ae0b43 100644
--- a/src/main/java/QuerySupport.java
+++ b/src/main/java/QuerySupport.java
@@ -33,7 +33,7 @@ public class QuerySupport {
for (Map.Entry att : attributes.entrySet()) {
Object value = att.getValue();
- int i = Integer.valueOf(value.toString());
+ int i = Integer.valueOf(value.toString().replace("\"", ""));
if (highestValues.size() < limit) {
highestValues.add(i);
} else {
@@ -60,6 +60,57 @@ public class QuerySupport {
return toReturn;
}
+ static public JsonObject changeToKeywords(JsonObject obj) {
+ Classification classification = new Classification();
+ JsonObject toReturn = new JsonObject();
+ Map attributes = new HashMap();
+ Set> entrySet = obj.entrySet();
+ for (Map.Entry entry : entrySet) {
+ attributes.put(entry.getKey(), obj.get(entry.getKey()));
+ }
+
+ for (Map.Entry att : attributes.entrySet()) {
+ String key = att.getKey();
+ if (key.contains("CPC: ")) {
+ key = key.substring(key.indexOf("CPC: ") + "CPC: ".length());
+ key = classification.getCPC(key);
+ } else {
+ key = classification.getUSPC(key);
+ }
+ if (!key.equals(att.getKey())) {
+ int value = Integer.valueOf(att.getValue().toString().replace("\"", ""));
+ if (!key.equalsIgnoreCase("")) {
+ toReturn.addProperty(key, value);
+ }
+ }
+ }
+ return toReturn;
+
+ }
+
+ static public JsonObject add(JsonObject obj, JsonObject two) {
+ Set> entrySet = obj.entrySet();
+ Map attributes = new HashMap();
+ for (Map.Entry entry : entrySet) {
+ attributes.put(entry.getKey(), obj.get(entry.getKey()));
+ }
+
+ for (Map.Entry att : attributes.entrySet()) {
+ Object valueObj = att.getValue();
+ String number = valueObj.toString().replace('"', ' ').trim();
+ String key = att.getKey();
+ if (two.get(key) != null) {
+ int a = Integer.valueOf(two.get(key).getAsString());
+ int b = Integer.valueOf(obj.get(key).getAsString());
+ two.remove(key);
+ two.addProperty(key, a + b);
+ } else {
+ two.addProperty(key, number);
+ }
+ }
+ return two;
+ }
+
static public JsonObject asPercentile(JsonObject obj, double count) {
JsonObject toReturn = new JsonObject();
Map attributes = new HashMap();
diff --git a/src/main/java/Server.java b/src/main/java/Server.java
index f17f8ef..2bd8d26 100644
--- a/src/main/java/Server.java
+++ b/src/main/java/Server.java
@@ -79,7 +79,22 @@ public class Server {
} else {
filter = "None";
}
- if (type.equals("Document")) {
+ if (search.contains("AddParameter")) {
+ Mapper mapper = new Mapper();
+ String documentQuery = filter.substring(0, filter.indexOf("$")).trim();
+ int start = filter.indexOf("Classification=('") + "Classification=('".length();
+ String classification = filter.substring(start, filter.indexOf("')", start));
+ start = filter.indexOf("CPC=('") + "CPC=('".length();
+ String cpc = filter.substring(start, filter.indexOf("')", start));
+ if (cpc.equals("None") || classification.equals("None") || documentQuery.equals("None")) {
+
+ } else {
+ mapper.addMapping(documentQuery, classification, cpc);
+ }
+ resultJson = new JsonObject();
+ }
+
+ if (type.equals("Document") || type.equals("Dokument")) {
DocumentQueries query = new DocumentQueries(mongo);
if (search.equals("Years")) {
@@ -95,10 +110,15 @@ public class Server {
if (search.equals("Keywords")) {
if (filter.equals("None")) {
FilterBuilderDocument doc = new FilterBuilderDocument();
- resultJson = query.getKeywords(doc, true, true, false);
+ resultJson = query.getKeywords(doc, true, true, "Keywords");
} else {
FilterBuilderDocument doc = new FilterBuilderDocument().bySearchString(filter);
- resultJson = query.getKeywords(doc, true, true, false);
+ if (filter.contains("{Field: ")) {
+ int start = filter.indexOf("{Field: ") + 8;
+ String field = filter.substring(start, filter.indexOf("}", start));
+ resultJson = query.getKeywords(doc, true, true, field);
+ }
+
}
}
@@ -112,6 +132,11 @@ public class Server {
}
}
+ if (search.equals("AllKeywords")) {
+ FilterBuilderDocument doc = new FilterBuilderDocument().bySearchString(filter);
+ resultJson = query.getAllKeywords(doc);
+ }
+
if (search.equals("KeywordsPerYear")) {
if (filter.equals("None")) {
FilterBuilderDocument doc = new FilterBuilderDocument();
@@ -132,6 +157,31 @@ public class Server {
}
}
+ if (search.equals("Author")) {
+ FilterBuilderDocument doc = new FilterBuilderDocument().bySearchString(filter);
+ resultJson = query.getAuthors(doc, true, true);
+ }
+
+ if (search.equals("AuthorsPerYear")) {
+ FilterBuilderDocument doc = new FilterBuilderDocument().bySearchString(filter);
+ resultJson = query.getAuthorsPerYear(doc);
+ }
+
+ if (search.equals("AuthorsPerYearRelative")) {
+ FilterBuilderDocument doc = new FilterBuilderDocument().bySearchString(filter);
+ resultJson = query.getAuthorsPerYearRelative(doc);
+ }
+
+ if (search.equals("Countries")) {
+ FilterBuilderDocument doc = new FilterBuilderDocument().bySearchString(filter);
+ resultJson = query.getCountrys(doc);
+ }
+
+ if (search.equals("Addresses")) {
+ FilterBuilderDocument doc = new FilterBuilderDocument().bySearchString(filter);
+ resultJson = query.getCountrysAdress(doc);
+ }
+
}
if (type.equals("Patent")) {
@@ -141,9 +191,55 @@ public class Server {
resultJson = query.getAmountPerYear(pat);
}
- if (search.equals("Keywords")) {
+ /*if (search.equals("GetAll")) {
+ DoneAnalyzes analyzes = new DoneAnalyzes();
+ int currentYear = Calendar.getInstance().get(Calendar.YEAR);
FilterBuilderPatent pat = new FilterBuilderPatent().bySearchString(filter);
- resultJson = query.getKeywords(pat, true, true, true);
+
+ if(analyzes.isGetAll(pat)==false)
+ {
+ DocumentQueries documentQuery = new DocumentQueries(mongo);
+ for(int i = 2002;i classes = driver.findElements(By.cssSelector("tr[bgcolor*=ffffff]"));
classes.addAll(driver.findElements(By.cssSelector("tr[bgcolor*=eeeeee]")));
for (WebElement e : classes) {
@@ -48,33 +57,31 @@ public class USPCCrawler {
}
private void getClasses(String className) {
-
-
List summaries = driver.findElements(By.tagName("table"));
for (WebElement summary : summaries) {
- WebElement tbody = summary.findElement(By.tagName("tbody"));
- if (tbody != null) {
- WebElement tr = tbody.findElement(By.tagName("tr"));
+ List tbodys = summary.findElements(By.tagName("tbody"));
+ if (tbodys.size() != 0) {
+ WebElement tr = tbodys.get(0).findElement(By.tagName("tr"));
if (tr != null) {
List tds = tr.findElements(By.tagName("td"));
- if (tds.size() > 1) {
- List as = tds.get(0).findElements(By.tagName("a"));
- String key = "";
- if (as.size() >= 2) {
- key = as.get(1).getText();
- key = key.replace(".", "_");
- if (key.contains("CLASS")) {
- String desc = tds.get(1).findElement(By.tagName("b")).getText().replace(":", "");
- importClass("", className, desc);
- continue;
- }
+ if (tds.size() != 5) {
+ System.out.println("Was falsch");
+ } else {
+ int level;
+ if (tds.get(4).findElements(By.tagName("img")).size() == 0) {
+ level = 0;
} else {
- continue;
+ String src = tds.get(4).findElement(By.tagName("img")).getAttribute("src");
+ String levelString = src.substring(src.lastIndexOf('/') + 1, src.lastIndexOf('/') + 2);
+ level = Integer.valueOf(levelString);
}
- String desc = tds.get(1).findElement(By.tagName("b")).getText().replace(":", "");
- importClass(className, key, desc);
+ String value = tds.get(4).getText();
+ String key = tds.get(3).findElement(By.tagName("a")).getText();
+ if (level == 0) {
+ currentUpperClass = value;
+ }
+ importClass(className, key, value, level, currentUpperClass);
}
-
}
}
}
@@ -82,25 +89,60 @@ public class USPCCrawler {
}
- private void importClass(String className, String key, String description) {
- if (className.contains("D")) {
-
- } else {
- char[] array = className.toCharArray();
- String newClassname = "";
- for (int i = 0; i < array.length; i++) {
- if (array[i] == '0') {
- array[i] = ' ';
- } else {
- newClassname = String.valueOf(array);
- break;
- }
- }
- newClassname = newClassname + " " + key;
- importer.doImport(newClassname.trim(), description.replace(':', ' ').trim());
+ private String getKey(String key) {
+ if (key.contains("DIG")) {
+ return key;
}
+ if (key.contains("FOR")) {
+ return key;
+ }
+ if (key.contains(".")) {
+ String rest = key.substring(key.indexOf('.')).replace("X", "").trim();
+ String lower = key.substring(0, key.indexOf('.'));
+ if (lower.length() == 1) {
+ lower = "00" + lower;
+ }
+ if (lower.length() == 2) {
+ lower = "0" + lower;
+ }
+ return (lower + rest).trim();
+ }
+ if (key.matches("[0-9]+")) {
+ if (key.length() == 1) key = "00" + key;
+ if (key.length() == 2) key = "0" + key;
+ return key;
+ } else {
+ char[] array = key.toCharArray();
+ int index = -1;
+ for (int i = 0; i < array.length; i++) {
+ if (Character.isLetter(array[i])) {
+ index = i;
+ continue;
+ }
+ }
+ if (index != -1) {
+ String lower = key.substring(0, index).trim();
+ String rest = key.substring(index).trim();
+ if (lower.length() == 2) lower = "0" + lower;
+ if (lower.length() == 1) lower = "00" + lower;
+ return lower + rest;
+ } else {
+ if (key.length() == 1) key = "00" + key;
+ if (key.length() == 2) key = "0" + key;
+ return key;
+ }
+
+
+ }
+ }
+
+ private void importClass(String className, String key, String description, int level, String upper) {
+ if (key.equals("")) return;
+ String newClassname = className + " ";
+ newClassname = newClassname + getKey(key);
+ importer.doImport(newClassname.trim(), description.replace(':', ' ').trim(), level, upper);
}
private void getAllClasses() {
@@ -111,6 +153,8 @@ public class USPCCrawler {
int location = 2;
if (tds.size() > location) {
String classification = tds.get(location).getText();
+ String name = tds.get(location + 1).getText();
+ importer.doImport(classification, name, 100, "None");
importer.addUninished(classification);
}
}
@@ -118,7 +162,6 @@ public class USPCCrawler {
private void goToPage() {
driver.navigate().to("https://www.uspto.gov/web/patents/classification/selectnumwithtitle.htm");
- driver.findElements(By.cssSelector("input[name=radio1]")).get(2).click();
}
diff --git a/src/main/java/USPCImporter.java b/src/main/java/USPCImporter.java
index e3ed725..4256667 100644
--- a/src/main/java/USPCImporter.java
+++ b/src/main/java/USPCImporter.java
@@ -25,9 +25,10 @@ public class USPCImporter {
collectionToCrawl = mongoDB.getCollection(Settings.COLLECTIONUNIFNISHEDUSPC.getContent());
}
- public void doImport(String kurz, String lang) {
+ public void doImport(String kurz, String lang, int level, String upperClass) {
BasicDBObject obj = new BasicDBObject();
- obj.append("key", kurz).append("value", lang);
+ obj.append("key", kurz).append("value", lang).append("level", level).append("upper", upperClass);
+ System.out.println("[INFO] Importing Classification" + obj);
collection.insert(obj);
}
diff --git a/src/main/java/WOSImporter.java b/src/main/java/WOSImporter.java
index 7a8ff7f..9c354ca 100644
--- a/src/main/java/WOSImporter.java
+++ b/src/main/java/WOSImporter.java
@@ -7,6 +7,9 @@ import org.apache.poi.poifs.filesystem.POIFSFileSystem;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
+import java.util.HashMap;
+import java.util.Locale;
+import java.util.Map;
public class WOSImporter {
@@ -14,8 +17,10 @@ public class WOSImporter {
DBCollection collection;
private MongoClient mongo;
private DB mongoDB;
+ private Map localeMap;
public WOSImporter() {
+ initCountryCodeMapping();
path = Settings.PATHTOWOSFILES.getContent();
mongo = new MongoClient(new MongoClientURI(Settings.MONGOURL.getContent()));
mongoDB = mongo.getDB(Settings.DBDOCUMENT.getContent());
@@ -25,10 +30,16 @@ public class WOSImporter {
collection = mongoDB.getCollection(Settings.COLLECTIONDOCUMENT.getContent());
collection.createIndex(new BasicDBObject("DOI", 1), "DOI", true);
}
-
createDoneDirectory();
+ }
-
+ private void initCountryCodeMapping() {
+ String[] countries = Locale.getISOCountries();
+ localeMap = new HashMap(countries.length);
+ for (String country : countries) {
+ Locale locale = new Locale("", country);
+ localeMap.put(locale.getISO3Country().toUpperCase(), locale);
+ }
}
private void createDoneDirectory() {
@@ -62,49 +73,112 @@ public class WOSImporter {
BasicDBObject document = new BasicDBObject();
- String author = row.getCell(5).getStringCellValue();
+ String author = "; " + row.getCell(5).getStringCellValue() + ";";
document.put("Author", author);
- String title = row.getCell(8).getStringCellValue();
+ String title = "; " + row.getCell(8).getStringCellValue() + ";";
document.put("Title", title);
- String sourceTitle = row.getCell(9).getStringCellValue();
+ String sourceTitle = "; " + row.getCell(9).getStringCellValue() + ";";
document.put("SourceTitle", sourceTitle);
- String documentType = row.getCell(13).getStringCellValue();
+ String documentType = "; " + row.getCell(13).getStringCellValue() + ";";
document.put("DocumentType", documentType);
if (row.getCell(19).getCellType() == 0) {
- String authorKeywords = String.valueOf(row.getCell(19).getNumericCellValue());
+ String authorKeywords = "; " + String.valueOf(row.getCell(19).getNumericCellValue()) + ";";
document.put("AuthorKeyword", authorKeywords);
} else {
- String authorKeywords = row.getCell(19).getStringCellValue();
+ String authorKeywords = "; " + row.getCell(19).getStringCellValue() + ";";
document.put("AuthorKeyword", authorKeywords);
}
- String keywords = row.getCell(20).getStringCellValue();
+ String keywords = "; " + row.getCell(20).getStringCellValue() + ";";
document.put("Keywords", keywords);
- String abstrac = row.getCell(21).getStringCellValue();
+ String abstrac = "; " + row.getCell(21).getStringCellValue() + ";";
document.put("Abstract", abstrac);
+ String address = row.getCell(22).getStringCellValue();
+ document.put("FullAddress", "; " + address + ";");
+ address = address.substring(address.lastIndexOf(',') + 1).trim();
+ if (address.contains("USA")) {
+ address = "UNITED STATES";
+ }
+
+ String iso = null;
+
+ switch (address) {
+ case ("England"):
+ iso = "GBR";
+ break;
+ case ("Peoples R China"):
+ iso = "CHN";
+ break;
+ case ("U Arab Emirates"):
+ iso = "ARE";
+ break;
+ case ("Scotland"):
+ iso = "GBR";
+ break;
+ case ("Wales"):
+ iso = "GBR";
+ break;
+ case ("Byelarus"):
+ iso = "BLR";
+ break;
+ case ("North Ireland"):
+ iso = "GBR";
+ break;
+ case ("North Macedonia"):
+ iso = "MKD";
+ default:
+ iso = null;
+ }
+ if (iso != null) {
+ document.put("Address", iso3CountryCodeToIso2CountryCode(iso));
+ }
+
+ if (iso == null) {
+ for (String a : Locale.getISOCountries()) {
+ Locale locale = new Locale("en", a);
+ String display = locale.getDisplayCountry(locale);
+ if (locale.getDisplayCountry(locale).equalsIgnoreCase(address)) {
+ iso = locale.getISO3Country();
+ document.put("Address", iso3CountryCodeToIso2CountryCode(iso));
+ break;
+ }
+ }
+ }
+
+ if (iso == null) {
+ boolean a = address.equalsIgnoreCase("YUGOSLAVIA");
+ a = a || address.equalsIgnoreCase("SERBIA MONTENEG");
+ a = a || address.equalsIgnoreCase("BOSNIA & HERCEG ");
+ if (!a) {
+ System.out.println(address);
+ }
+
+ }
+
if (row.getCell(27).getCellType() == 0) {
- String fundingOrg = String.valueOf(row.getCell(27).getNumericCellValue());
+ String fundingOrg = "; " + String.valueOf(row.getCell(27).getNumericCellValue()) + ";";
document.put("FundingOrg", fundingOrg);
} else {
- String fundingOrg = row.getCell(27).getStringCellValue();
+ String fundingOrg = "; " + row.getCell(27).getStringCellValue() + ";";
document.put("FundingOrg", fundingOrg);
}
if (row.getCell(28).getCellType() == 0) {
- String fundingText = String.valueOf(row.getCell(28).getNumericCellValue());
+ String fundingText = "; " + String.valueOf(row.getCell(28).getNumericCellValue()) + ";";
document.put("FundingText", fundingText);
} else {
- String fundingText = row.getCell(28).getStringCellValue();
+ String fundingText = "; " + row.getCell(28).getStringCellValue() + ";";
document.put("FundingText", fundingText);
}
+
double citedReferenceCount = row.getCell(30).getNumericCellValue();
document.put("CitedReferenceCount", citedReferenceCount);
@@ -123,6 +197,65 @@ public class WOSImporter {
String publisherCity = row.getCell(36).getStringCellValue();
document.put("PublisherCity", publisherCity);
+ String publisherCountry = row.getCell(37).getStringCellValue();
+ publisherCountry = publisherCountry.substring(publisherCountry.lastIndexOf(',') + 1).trim();
+ if (publisherCountry.contains("USA")) {
+ publisherCountry = "UNITED STATES";
+ }
+
+ iso = null;
+
+ switch (publisherCountry) {
+ case ("ENGLAND"):
+ iso = "GBR";
+ break;
+ case ("PEOPLES R CHINA"):
+ iso = "CHN";
+ break;
+ case ("U ARAB EMIRATES"):
+ iso = "ARE";
+ break;
+ case ("SCOTLAND"):
+ iso = "GBR";
+ break;
+ case ("WALES"):
+ iso = "GBR";
+ break;
+ case ("BYELARUS"):
+ iso = "BLR";
+ break;
+ case ("NORTH IRELAND"):
+ iso = "GBR";
+ break;
+ default:
+ iso = null;
+ }
+ if (iso != null) {
+ document.put("Country", iso3CountryCodeToIso2CountryCode(iso));
+ }
+
+ if (iso == null) {
+ for (String a : Locale.getISOCountries()) {
+ Locale locale = new Locale("en", a);
+ String display = locale.getDisplayCountry(locale);
+ if (locale.getDisplayCountry(locale).equalsIgnoreCase(publisherCountry)) {
+ iso = locale.getISO3Country();
+ document.put("Country", iso3CountryCodeToIso2CountryCode(iso));
+ break;
+ }
+ }
+ }
+
+ if (iso == null) {
+ boolean a = publisherCountry.equalsIgnoreCase("YUGOSLAVIA");
+ a = a || publisherCountry.equalsIgnoreCase("SERBIA MONTENEG");
+ a = a || publisherCountry.equalsIgnoreCase("BOSNIA & HERCEG ");
+ if (!a) {
+ System.out.println(publisherCountry);
+ }
+
+ }
+
String publicationDate = row.getCell(43).getStringCellValue();
document.put("PublicationDate", publicationDate);
@@ -137,13 +270,13 @@ public class WOSImporter {
double numberOfPages = row.getCell(57).getNumericCellValue();
document.put("NumberOfPages", numberOfPages);
- String wosCategories = row.getCell(58).getStringCellValue();
+ String wosCategories = "; " + row.getCell(58).getStringCellValue() + ";";
document.put("WosCategories", wosCategories);
- String researchAreas = row.getCell(59).getStringCellValue();
+ String researchAreas = "; " + row.getCell(59).getStringCellValue() + ";";
document.put("ResearchAreas", researchAreas);
- String doi = row.getCell(54).getStringCellValue();
+ String doi = row.getCell(61).getStringCellValue();
document.put("DOI", doi);
if (collection.findOne(new BasicDBObject("DOI", doi)) == null) {
@@ -167,5 +300,9 @@ public class WOSImporter {
}
+ private String iso3CountryCodeToIso2CountryCode(String iso3CountryCode) {
+ return localeMap.get(iso3CountryCode).getCountry();
+ }
+
}
diff --git a/src/main/java/WoSCrawler.java b/src/main/java/WoSCrawler.java
index 8d2fd9e..29ed347 100644
--- a/src/main/java/WoSCrawler.java
+++ b/src/main/java/WoSCrawler.java
@@ -50,8 +50,10 @@ public class WoSCrawler {
int thisYear = Calendar.getInstance().get(Calendar.YEAR);
+ thisYear = 2019;
+ int startYear = 2019;
- for (int i = 2002; i <= thisYear; i++) {
+ for (int i = startYear; i <= thisYear; i++) {
System.out.println("[INFO] WOS Crawler, current Year: " + i);
search(mode);
selectYear(i);
@@ -85,7 +87,8 @@ public class WoSCrawler {
}
}
- private synchronized void goToSearchPage2() {
+ private synchronized void goToSearchPage2() throws InterruptedException {
+ wait(5000);
driver.findElement(By.cssSelector("a[title*=Back]")).click();
}
@@ -98,6 +101,7 @@ public class WoSCrawler {
}
private synchronized void searchComplex(String search) throws InterruptedException {
+ if (!Settings.DEBUG.getContent().equals("YES")) wait(6000);
driver.findElement(By.cssSelector("a[title*=Advanced]")).click();
if (!Settings.DEBUG.getContent().equals("YES")) wait(1000);
WebElement box = driver.findElement(By.cssSelector("textarea[class*=Adv_formBoxesSearch]"));
@@ -112,6 +116,7 @@ public class WoSCrawler {
}
private synchronized void selectYear(int year) throws InterruptedException {
+ wait(500);
driver.findElement(By.cssSelector("a[id=PublicationYear]")).click();
if (!Settings.DEBUG.getContent().equals("YES")) wait(1000);
driver.findElement(By.cssSelector("input[value=PublicationYear_" + year + "]")).click();
@@ -120,6 +125,7 @@ public class WoSCrawler {
}
private synchronized void startMain() throws InterruptedException {
+ wait(1000);
int lastPage = Integer.parseInt(driver.findElement(By.id("pageCount.top")).getText().replace(",", ""));
goToPage(lastPage);
List list = driver.findElements(By.cssSelector("div[class=search-results-number-align"));
@@ -178,24 +184,7 @@ public class WoSCrawler {
if (!Settings.DEBUG.getContent().equals("YES")) wait(1000);
driver.findElement(By.id("value(select_All)")).click();
if (!Settings.DEBUG.getContent().equals("YES")) wait(590);
- driver.findElement(By.id("ISSN_fields")).click();
- if (!Settings.DEBUG.getContent().equals("YES")) wait(540);
- driver.findElement(By.id("ACCESSION_NUM_fields")).click();
- if (!Settings.DEBUG.getContent().equals("YES")) wait(513);
- driver.findElement(By.id("ADDRS_fields")).click();
- if (!Settings.DEBUG.getContent().equals("YES")) wait(513);
- driver.findElement(By.id("IDS_fields")).click();
- if (!Settings.DEBUG.getContent().equals("YES")) wait(513);
- driver.findElement(By.id("PMID_fields")).click();
- if (!Settings.DEBUG.getContent().equals("YES")) wait(513);
- driver.findElement(By.id("OPEN_ACCESS_fields")).click();
- if (!Settings.DEBUG.getContent().equals("YES")) wait(513);
- driver.findElement(By.id("SABBR_fields")).click();
- if (!Settings.DEBUG.getContent().equals("YES")) wait(513);
- driver.findElement(By.id("AUTHORSIDENTIFIERS_fields")).click();
- if (!Settings.DEBUG.getContent().equals("YES")) wait(513);
- driver.findElement(By.id("CONFERENCE_SPONSORS_fields")).click();
- if (!Settings.DEBUG.getContent().equals("YES")) wait(513);
+ driver.findElement(By.id("CONFERENCE_INFO_fields")).click();
WebElement amount = driver.findElement(By.cssSelector("span[class=umlProdListText]"));
String text = amount.getText();
@@ -226,16 +215,20 @@ public class WoSCrawler {
driver.findElement(By.cssSelector("button[class*=snowplow-wos-markedlist-clear-click")).click();
if (!Settings.DEBUG.getContent().equals("YES")) wait(500);
driver.switchTo().alert().accept();
+ if (!Settings.DEBUG.getContent().equals("YES")) wait(500);
}
- private void goToSeachPage() {
+ private void goToSeachPage() throws InterruptedException {
driver.findElement(By.cssSelector("a[title*=Results]")).click();
+ wait(500);
}
private void export(int start, int end) throws InterruptedException {
WebElement from = driver.findElement(By.id("markFrom"));
+ if (!Settings.DEBUG.getContent().equals("YES")) wait(1516);
from.clear();
WebElement to = driver.findElement(By.id("markTo"));
+ if (!Settings.DEBUG.getContent().equals("YES")) wait(1516);
to.clear();
WebElement amount = driver.findElement(By.cssSelector("span[class=umlProdListText]"));
@@ -245,9 +238,11 @@ public class WoSCrawler {
if (start + amountInt < end) {
end = start + amountInt - 1;
}
+ if (!Settings.DEBUG.getContent().equals("YES")) wait(516);
from.sendKeys(String.valueOf(start));
if (!Settings.DEBUG.getContent().equals("YES")) wait(512);
to.sendKeys(String.valueOf(end));
+ if (!Settings.DEBUG.getContent().equals("YES")) wait(516);
driver.findElement(By.id("record_select_type_range")).click();
if (!Settings.DEBUG.getContent().equals("YES")) wait(1056);
@@ -273,7 +268,7 @@ public class WoSCrawler {
driver.findElement(By.cssSelector("button[name=saveToExcel")).click();
if (!Settings.DEBUG.getContent().equals("YES"))
- wait((int) (30000 + Math.random() * 10000)); //Hier wartezeit ändern!
+ wait((int) (20000 + Math.random() * 10000)); //Hier wartezeit ändern!
}
@@ -319,10 +314,11 @@ public class WoSCrawler {
}
- private void goToPage(int page) {
+ private void goToPage(int page) throws InterruptedException {
WebElement currentPage = driver.findElement(By.name("page"));
currentPage.clear();
currentPage.sendKeys(Integer.toString(page));
+ wait(530);
currentPage.submit();
}
diff --git a/src/test/resources/chromedriver.exe b/src/test/resources/chromedriver.exe
index 38ea5f5..d51602d 100644
Binary files a/src/test/resources/chromedriver.exe and b/src/test/resources/chromedriver.exe differ