Skip to content
Permalink
Browse files

This is the v1.6.0 release on the way to v2.0.

  • Loading branch information...
Orbifold committed May 30, 2017
1 parent 4b50ee2 commit ae9bf9fc284161a5c375ab980e4063036e2fd9c2
Showing with 33,296 additions and 3 deletions.
  1. +80 −0 .gitignore
  2. +7 −0 .istanbul.yml
  3. +194 −0 Apps/HTTP/index.html
  4. +52 −0 Apps/HTTP/index.js
  5. +6 −0 Apps/REPL/index.js
  6. +6 −0 Apps/REPO/index.js
  7. +5 −3 LICENSE
  8. +11 −0 PackageServer/Content/README.md
  9. +13 −0 PackageServer/Content/about.md
  10. +23 −0 PackageServer/Content/badUrl.md
  11. +1 −0 PackageServer/Content/notPackage.md
  12. +1 −0 PackageServer/Content/notPackageVersion.md
  13. BIN PackageServer/Packages/base/1.0/Images/Weather.png
  14. +63 −0 PackageServer/Packages/base/1.0/Oracle/BasicKnowledge.json
  15. +40 −0 PackageServer/Packages/base/1.0/Oracle/Deductions.json
  16. +18 −0 PackageServer/Packages/base/1.0/Oracle/MathsTalk.json
  17. +126 −0 PackageServer/Packages/base/1.0/Oracle/Personalization.json
  18. +134 −0 PackageServer/Packages/base/1.0/Oracle/SmallTalk.json
  19. +94 −0 PackageServer/Packages/base/1.0/Oracle/UnitTests.json
  20. +3 −0 PackageServer/Packages/base/1.0/README.md
  21. +32 −0 PackageServer/Packages/base/1.0/Services/Maths/index.js
  22. +97 −0 PackageServer/Packages/base/1.0/States/Weather/index.js
  23. +18 −0 PackageServer/Packages/base/1.0/package.json
  24. +49 −0 PackageServer/Packages/calculator/1.0/Interpreters/Calculator/index.js
  25. +3 −0 PackageServer/Packages/calculator/1.0/README.md
  26. +18 −0 PackageServer/Packages/calculator/1.0/package.json
  27. +3 −0 PackageServer/Packages/tester/1.0/README.md
  28. +3 −0 PackageServer/Packages/tester/1.1/README.md
  29. +22 −0 PackageServer/Packages/tutorial/1.0/Interpreters/UnknownNouns/index.js
  30. +3 −0 PackageServer/Packages/tutorial/1.0/README.md
  31. +74 −0 PackageServer/Packages/tutorial/1.0/Services/Unknowns/index.js
  32. +360 −0 PackageServer/index.js
  33. +27 −0 PackageServer/template.html
  34. +52 −0 README.md
  35. +41 −0 SampleData/Anonymous.json
  36. +142 −0 SampleData/People.json
  37. BIN SampleData/QwieryDB.gz
  38. +505 −0 SampleData/Sharon.json
  39. +13 −0 artillery.yml
  40. +340 −0 doc/QTLSchema.json
  41. +18 −0 doc/README.md
  42. +124 −0 doc/WorkflowSchema.json
  43. +596 −0 doc/jsdoc-default.css
  44. +29 −0 doc/notes/Alias.md
  45. +95 −0 doc/notes/Apps.md
  46. +30 −0 doc/notes/Ask.md
  47. +135 −0 doc/notes/Commands.md
  48. +206 −0 doc/notes/Configuration.md
  49. +2 −0 doc/notes/Features.md
  50. +28 −0 doc/notes/GettingStarted.md
  51. +150 −0 doc/notes/GraphDBFormat.md
  52. +87 −0 doc/notes/How_AskConfirmation.md
  53. +68 −0 doc/notes/How_CustomState.md
  54. +157 −0 doc/notes/How_StoreThings.md
  55. +27 −0 doc/notes/MongoDatabase.md
  56. +62 −0 doc/notes/Personalization.md
  57. +118 −0 doc/notes/Plugins.md
  58. +64 −0 doc/notes/Pods.md
  59. +27 −0 doc/notes/Qwiery.md
  60. +34 −0 doc/notes/Requirements.md
  61. +13 −0 doc/notes/Session.md
  62. +68 −0 doc/notes/Storage.md
  63. +147 −0 doc/notes/Templates.md
  64. +23 −0 doc/notes/Terms.md
  65. +39 −0 doc/notes/Topics.md
  66. +65 −0 doc/notes/Trace.md
  67. +8 −0 doc/notes/WorkflowState.md
  68. +20 −0 doc/notes/Workflows.md
  69. BIN doc/notes/images/ConfirmationFlow.png
  70. +42 −0 doc/notes/index
  71. +74 −0 gulpfile.js
  72. +26 −0 jsdoc.json
  73. +367 −0 lib/Configurator.js
  74. +29 −0 lib/Framework/CommandBase.js
  75. +96 −0 lib/Framework/FrameworkBase.js
  76. +20 −0 lib/Framework/InterpreterBase.js
  77. +12 −0 lib/Framework/SecurityContext.js
  78. +15 −0 lib/Framework/ServiceBase.js
  79. +283 −0 lib/Framework/Session.js
  80. +114 −0 lib/Framework/StorageBase.js
  81. +97 −0 lib/Framework/StorageDomainBase.js
  82. +52 −0 lib/Framework/StorageProxy.js
  83. +40 −0 lib/Framework/UnderstandingBase.js
  84. +285 −0 lib/Instantiator.js
  85. +324 −0 lib/Interpreters/Alias/index.js
  86. +97 −0 lib/Interpreters/Commands/Add.js
  87. +66 −0 lib/Interpreters/Commands/Delete.js
  88. +885 −0 lib/Interpreters/Commands/Executors.js
  89. +91 −0 lib/Interpreters/Commands/Get.js
  90. +23 −0 lib/Interpreters/Commands/Help.js
  91. +78 −0 lib/Interpreters/Commands/Language.js
  92. +52 −0 lib/Interpreters/Commands/Load.js
  93. +36 −0 lib/Interpreters/Commands/Search.js
  94. +51 −0 lib/Interpreters/Commands/Set.js
  95. +83 −0 lib/Interpreters/Commands/index.js
  96. +48 −0 lib/Interpreters/Deductions/index.js
  97. +447 −0 lib/Interpreters/Edictor/index.js
  98. +77 −0 lib/Interpreters/Flows/index.js
  99. +47 −0 lib/Interpreters/Historization/index.js
  100. +42 −0 lib/Interpreters/Parallel/index.js
  101. +143 −0 lib/Interpreters/Parsers/index.js
  102. +38 −0 lib/Interpreters/RandomAnswers/index.js
  103. +55 −0 lib/Interpreters/Reminders/index.js
  104. +45 −0 lib/Interpreters/Spam/index.js
  105. +301 −0 lib/Services/Apps/AppStorage.js
  106. +82 −0 lib/Services/Apps/UserApps.js
  107. +416 −0 lib/Services/Apps/index.js
  108. +75 −0 lib/Services/Documents/index.js
  109. +1,749 −0 lib/Services/Graph/GraphStorage.js
  110. +808 −0 lib/Services/Graph/index.js
  111. +95 −0 lib/Services/History/HistoryStorage.js
  112. +175 −0 lib/Services/History/index.js
  113. +222 −0 lib/Services/Identity/IdentityStorage.js
  114. +365 −0 lib/Services/Identity/index.js
  115. +659 −0 lib/Services/Language/index.js
  116. +280 −0 lib/Services/Loader/index.js
  117. +92 −0 lib/Services/Log/LogStorage.js
  118. +62 −0 lib/Services/Log/index.js
  119. +248 −0 lib/Services/MemoryStorage/index.js
  120. +269 −0 lib/Services/MongoStorage/index.js
  121. +555 −0 lib/Services/Oracle/OracleStorage.js
  122. +624 −0 lib/Services/Oracle/index.js
  123. +218 −0 lib/Services/Personalization/PersonalizationStorage.js
  124. +126 −0 lib/Services/Personalization/index.js
  125. +282 −0 lib/Services/Pipeline/index.js
  126. +100 −0 lib/Services/QTL/config.js
  127. +253 −0 lib/Services/QTL/index.js
  128. +411 −0 lib/Services/QTL/mutator.js
  129. +107 −0 lib/Services/QTL/prattParser.js
  130. +93 −0 lib/Services/QTL/tokenizer.js
  131. +42 −0 lib/Services/SampleData/index.js
  132. +302 −0 lib/Services/Statistics/StatisticsStorage.js
  133. +127 −0 lib/Services/Statistics/index.js
  134. +123 −0 lib/Services/System/index.js
  135. +250 −0 lib/Services/Topics/TopicsStorage.js
  136. +155 −0 lib/Services/Topics/index.js
  137. +33 −0 lib/Services/Workflows/StateTransition.js
  138. +110 −0 lib/Services/Workflows/States/CheckAnswer/index.js
  139. +78 −0 lib/Services/Workflows/States/Choice/index.js
  140. +45 −0 lib/Services/Workflows/States/Decision/index.js
  141. +8 −0 lib/Services/Workflows/States/Dummy/index.js
  142. +80 −0 lib/Services/Workflows/States/PersonalizationCheck/index.js
  143. +53 −0 lib/Services/Workflows/States/QA/index.js
  144. +52 −0 lib/Services/Workflows/States/Transient/index.js
  145. +48 −0 lib/Services/Workflows/States/YesNo/index.js
  146. +613 −0 lib/Services/Workflows/Workflow.js
  147. +202 −0 lib/Services/Workflows/WorkflowLoader.js
  148. +340 −0 lib/Services/Workflows/WorkflowSpy.js
  149. +349 −0 lib/Services/Workflows/WorkflowState.js
  150. +180 −0 lib/Services/Workflows/WorkflowStorage.js
  151. +308 −0 lib/Services/Workflows/WorkflowValidation.js
  152. +311 −0 lib/Services/Workflows/index.js
  153. +83 −0 lib/Understanding/Datetime/index.js
  154. +276 −0 lib/Understanding/Entities/index.js
  155. +150 −0 lib/config.default.js
  156. +150 −0 lib/config.npm.js
  157. +67 −0 lib/constants.js
  158. +101 −0 lib/eventHub.js
  159. +625 −0 lib/index.js
  160. +134 −0 lib/repl.js
  161. +625 −0 lib/texturize.js
  162. +810 −0 lib/utils.js
  163. +79 −0 package.json
  164. +525 −0 test/Apps.js
  165. +270 −0 test/Commands.js
  166. +250 −0 test/Configurator.js
  167. +55 −0 test/Datetime.js
  168. +114 −0 test/Deductions.js
  169. +108 −0 test/Dev.js
  170. +29 −0 test/Documents.js
  171. +46 −0 test/Entities.js
  172. +22 −0 test/EventHub.js
  173. +660 −0 test/Graph.js
  174. +102 −0 test/History.js
  175. +157 −0 test/Identity.js
  176. +104 −0 test/Instantiator.js
  177. +47 −0 test/Language.js
  178. +84 −0 test/Log.js
  179. +142 −0 test/MemoryStorage.js
  180. +101 −0 test/MongoStorage.js
  181. +1,046 −0 test/Mutator.js
  182. +591 −0 test/Oracle.js
  183. +48 −0 test/PackageLoader.js
  184. +152 −0 test/Packages.js
  185. +76 −0 test/Parsers.js
  186. +81 −0 test/Personalization.js
  187. +24 −0 test/Plugins.js
  188. +105 −0 test/QTL.js
  189. +408 −0 test/Questions.js
  190. +573 −0 test/Qwiery.js
  191. +25 −0 test/Spam.js
  192. +134 −0 test/Statistics.js
  193. +117 −0 test/StorageBase.js
  194. +38 −0 test/System.js
  195. +126 −0 test/TestUtils/BasicStorage.js
  196. +91 −0 test/TestUtils/index.js
  197. +169 −0 test/Topics.js
  198. +295 −0 test/Utils.js
  199. +1,328 −0 test/Workflows.js
  200. +17 −0 test/plugins/HelloService/index.js
  201. +48 −0 test/plugins/RandomIntInterpreter/index.js
  202. +13 −0 test/states/Random/index.js
@@ -0,0 +1,80 @@
logs
*.log
npm-debug.log*

pids
*.pid
*.seed

lib-cov

coverage

.grunt
build/Release

### JetBrains template
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio

*.iml

## Directory-based project format:
.idea/
# if you remove the above rule, at least ignore the following:

# User-specific stuff:
# .idea/workspace.xml
# .idea/tasks.xml
# .idea/dictionaries

# Sensitive or high-churn files:
# .idea/dataSources.ids
# .idea/dataSources.xml
# .idea/sqlDataSources.xml
# .idea/dynamic.xml
# .idea/uiDesigner.xml

# Gradle:
# .idea/gradle.xml
# .idea/libraries

# Mongo Explorer plugin:
# .idea/mongoSettings.xml

## File-based project format:
*.ipr
*.iws

## Plugin-specific files:

# IntelliJ
/out/

# mpeltonen/sbt-idea plugin
.idea_modules/

# JIRA plugin
atlassian-ide-plugin.xml

# Crashlytics plugin (for Android Studio and IntelliJ)
com_crashlytics_export_strings.xml
crashlytics.properties
crashlytics-build.properties

.DS_Store
**/.DS_Store


# Only the config.js.template should be checked in
/Server/config.js
/temp/
/Uploads/
/Babble/temp/
/docu/
.vscode
/tests/storage/*.json
/node_modules/
/doc/apidocs/
/loki.db
/lib/QwieryDB.json
*.zip
@@ -0,0 +1,7 @@
instrumentation:
root: .
default-excludes: true
include-all-sources: true
excludes: ['**/Commands.js']
reporting:
dir: "coverage"
@@ -0,0 +1,194 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Qwiery</title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.js" type="text/javascript"></script>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u"
crossorigin="anonymous">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap-theme.min.css" integrity="sha384-rHyoN1iRsVXV4nD0JutlnGaslCJuC7uwjduW9SVrLvRYooPp2bWYgmgJQIXwl/Sp"
crossorigin="anonymous">
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa"
crossorigin="anonymous"></script>
<style type="text/css">
body {
font-family: 'Open Sans', Arial, Helvetica, sans-serif;
}
.ask-container {
margin: 10px 15%;
max-width: 800px;
min-width: 70%;
}
#exchangeContainer {
margin: 10px 15%;
max-width: 800px;
min-width: 70%;
max-height: 800px;
overflow: auto;
}
.user-bubble {
background-color: #4bd34b;
color: whitesmoke;
padding: 7px;
margin: 5px 0 5px 0;
border-radius: 5px;
}
.qwiery-bubble {
background-color: lightgrey;
color: dimgrey;
padding: 7px;
margin: 5px 30% 5px 0;
border-radius: 5px;
min-width: 50%;
}
.time {
color: silver;
font-size: x-small;
}
.space {
border-radius: 5px;
border: 1px solid lightgrey;
padding: 10px 20px;
}
th {
text-align: left;
}
table {
width: 100%;
}
#inputter {
outline: none;
}
</style>
<script type="text/javascript">
function qa() {
var q = $("#inputter").val().trim();
if(q.length > 0) {
addUser(q);
$.ajax({
url: "http://localhost:3000/ask",
method: "POST",
headers: {'Content-Type': 'application/json'},
timeout: 5000,
data: JSON.stringify({question: q})
}).then(function(a) {
answer(a.answer);
});
}
}
function answer(a){
addQwiery(a);
$("#exchangeContainer").animate({scrollTop: $('#exchangeContainer').prop("scrollHeight")}, 1000);
}
function addUser(msg) {
var blob = $("#user-blob").clone();
blob.find(".user-bubble").html(msg);
blob.find(".time").html(new Date().toLocaleString());
$("#exchangeContainer").append(blob);
blob.show();
}
function addQwiery(msg) {
var blob = $("#qwiery-blob").clone();
var bubble = blob.find(".qwiery-bubble");
setBubbleContent(msg, bubble);
if(msg.indexOf("") >= 0) {
bubble.css({"margin": "5px 0 5px 0"});
}
blob.find(".time").html(new Date().toLocaleString());
$("#exchangeContainer").append(blob);
blob.show();
}
function setBubbleContent(msg, bubble) {
if(msg.toLowerCase().indexOf("are you sure") >= 0) {
var prompt = $("#confirmation").clone();
bubble.html(prompt);
prompt.show();
} else {
bubble.html(msg);
}
}
function postConfirmation(a){
$.ajax({
url: "http://localhost:3000/ask",
method: "POST",
headers: {'Content-Type': 'application/json'},
timeout: 5000,
data: JSON.stringify({question: a})
}).then(function(s) {
answer(s.answer);
});
}
$(document).ready(function() {
$("#askButton").click(function() {
qa();
});
$("#inputter").keypress(function(e) {
if(e.which === 13) {
qa();
}
}).focus();
})
</script>
</head>
<body>

<div class="container">
<div class="jumbotron" style="margin-top:20px;">
<h1 class="display-3">Qwiery</h1>
<p>A generic cognitive agent architecture for text-based user interfaces.</p>
<p class="lead">
<a class="btn btn-primary btn-lg" href="http://www.qwiery.com" target="_blank" role="button">Learn more</a>
</p>
</div>
<div class="space">
<div id="exchangeContainer"></div>
<div class="ask-container">
<div class="row">
<div class="col-xs-12">
<div class="input-group input-group-md">
<input id="inputter" type="text" class="form-control"/>
<div class="input-group-btn">
<button id="askButton" type="submit" class="btn">Ask</button>
</div>
</div>
</div>
</div>
</div>
</div>

<div id="user-blob" class="row pull-right" style="display:none;">
<div class="col-xs-12">
<div class="input-group input-group-md">
<div class="time" style="margin:5px 0 5px 0;"></div>
<div class="user-bubble"></div>
</div>
</div>
</div>
<div id="qwiery-blob" class="row" style="display:none;">
<div class="col-xs-12">
<div class="">
<div class="time"></div>
<div class="qwiery-bubble"></div>
</div>
</div>
</div>
<div id="confirmation" style="display:none;">
<p>Are you sure?</p>
<div style="margin:20px 0;">
<button type="button" class="btn btn-primary" onClick="postConfirmation('yes');">Yes</button>
<button type="button" class="btn btn-danger" onClick="postConfirmation('no');">No</button>
</div>
</div>
</div>
</body>
</html>
@@ -0,0 +1,52 @@
/**
* Use 'node ./Apps/HTTP' or 'npm run http' to launch this basic HTTP client.
*
* This is just the basic web interface and a lot more can be done of course,
* but this is a stepping stone if you wish to experiment with Qwiery over HTTP.
*/

function runSingle() {

const http = require("http"),
Qwiery = require("../../lib"),
path = require("path");


const express = require("express");
const bodyParser = require("body-parser");
const app = express();
const qwiery = new Qwiery();

app.use(bodyParser.json());
app.use(bodyParser.urlencoded({extended: true}));
app.get("/", function(req, res) {
res.sendFile(path.join(__dirname, './index.html'));
});


app.post("/ask", function(req, res) {
if(!req.body) return res.sendStatus(400);
const q = req.body.question;
console.log(req.body);
qwiery.ask(q, {return: 'simple', format: "html", req: req}).then(function(answer) {
res.json({answer: answer, worker: cluster.worker.id});
});
});

const server = app.listen(3000, function() {
console.log("Qwiery is listening on port %s...", server.address().port);
});

}

const cluster = require('cluster');

if(cluster.isMaster) {
// go full-scale if you wish
const cpuCount = 1;//require('os').cpus().length;
for(let i = 0; i < cpuCount; i += 1) {
cluster.fork();
}
} else {
runSingle();
}
@@ -0,0 +1,6 @@
/**
* This will run Qwiery in REPL mode with the default configuration.
* Use 'node ./Apps/REPL/repl.js' or 'npm start' to launch this.
*/
require("../../lib").repl();

@@ -0,0 +1,6 @@
/**
* Use 'node ./Apps/REPO/index.js' or 'npm run repo' to launch the package repository.
*/

const repoServer = require("../../PackageServer");
repoServer.listen();
@@ -630,11 +630,11 @@ state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.

<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
Copyright (C) 2017 Orbifold Consulting [http://www.orbifold.net]

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published
by the Free Software Foundation, either version 3 of the License, or
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
@@ -659,3 +659,5 @@ specific requirements.
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU AGPL, see
<http://www.gnu.org/licenses/>.

https://www.gnu.org/licenses/agpl-3.0.html
@@ -0,0 +1,11 @@
# Qwiery package repository

This respository contains diverse Qwiery package which can be loaded inside Qwiery. If using Qwiery in REPL mode you can load a package (e.g. the base package) like so

load base

If you are not using Qwiery in REPL mode you can use the loader service in derived classes like so

this.services.loader.load("base");

Please read the documentation for more details.
Oops, something went wrong.

0 comments on commit ae9bf9f

Please sign in to comment.
You can’t perform that action at this time.