Skip to content

Commit

Permalink
hxlm-js (hdp #18, lisp #18): HDPAux started
Browse files Browse the repository at this point in the history
  • Loading branch information
fititnt committed Apr 3, 2021
1 parent 4fcbeab commit a644c08
Show file tree
Hide file tree
Showing 6 changed files with 141 additions and 59 deletions.
14 changes: 14 additions & 0 deletions hxlm-js/bootstrapper/hdp-aux.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
console.log('hdp-aux.js')

class HDPAux {
static dump_to_html(res, selector) {
console.log(document.querySelector(selector).innerHTML)
let out = document.querySelector(selector)
out.innerHTML = JSON.stringify(res, null, 2)
// out.innerHTML = JSON.stringify(res, space = 2)
// https://highlightjs.org/usage/
if (hljs && hljs.highlightAll){
hljs.highlightAll()
}
}
}
1 change: 0 additions & 1 deletion hxlm-js/bootstrapper/hdp-minimam.js

This file was deleted.

83 changes: 71 additions & 12 deletions hxlm-js/bootstrapper/hdp-minimam.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -43,25 +43,41 @@ console.log('bootstrapper/hdp-minimam.mjs')
class HDPMiniman {
FONTEM_LKG = null
FONTEM_VKG = null
ONTOLOGIA_LKG = null
ONTOLOGIA_VKG = null
// constructor(ONTOLOGIA_LKG, ONTOLOGIA_VKG) {
constructor(res) {
console.log(res)
if (res && res.LKG) {
self.FONTEM_LKG = res.LKG
// self.ONTOLOGIA_LKG = await fetch(self.FONTEM_LKG)
// self.ONTOLOGIA_LKG = fetch(self.FONTEM_LKG)
fetch(self.FONTEM_LKG).then(function (response) {
var contentType = response.headers.get("content-type");
if (contentType && contentType.indexOf("application/json") !== -1) {
return response.json().then(function (json) {
self.ONTOLOGIA_LKG = json
console.log(self.ONTOLOGIA_LKG)
});
} else {
console.log("Problem with res.VKG");
}
});
}
if (res && res.VKG) {
self.FONTEM_VKG = res.VKG
fetch(self.FONTEM_VKG).then(function (response) {
var contentType = response.headers.get("content-type");
if (contentType && contentType.indexOf("application/json") !== -1) {
return response.json().then(function (json) {
self.ONTOLOGIA_VKG = json
console.log(self.ONTOLOGIA_VKG)
});
} else {
console.log("Problem with res.VKG");
}
});
}
// if (res && res.LKG) {
// self.HXLM_LKG = res.LKG
// } else if (HXLM_LKG) {
// self.FONTEM_LKG = HXLM_LKG
// }
// if (res && res.VKG) {
// self.HXLM_VKG = res.VKG
// } else if (HXLM_VKG) {
// self.FONTEM_VKG = HXLM_VKG
// }
}

/**
Expand All @@ -75,15 +91,56 @@ class HDPMiniman {
*/
static bootstrapping() {
let resultatum = new Object({
LKG: "../hxlm/ontologia/json/core.lkg.json",
VKG: "../hxlm/ontologia/json/core.vkg.json"
LKG: "../hxlm/ontologia/json/core.lkg.json",
VKG: "../hxlm/ontologia/json/core.vkg.json"
})
// resultatum.FONTEM_LKG = self.FONTEM_LKG
// resultatum.FONTEM_VKG = self.FONTEM_VKG
// resultatum.push('FONTEM_ONTOLOGIA_VKG', self.FONTEM_ONTOLOGIA_VKG)
return resultatum
}

// async _fetch(url, checksum) {
// async _fetch(url, checksum) {
async _get(url, checksum) {
return await fetch(url);
// const response = await fetch(url);
// // waits until the request completes...
// console.log(response);
// fetch(url).then(function (response) {
// let contentType = response.headers.get("content-type");
// if (contentType && contentType.indexOf("application/json") !== -1) {
// return response.json().then(function (json) {
// // process your JSON further
// console.log(json)
// });
// } else {
// console.log("Oops, we haven't got JSON!");
// }
// });
}

/**
* Linguam recōnstrūctiōnem
*
* @TODO check if hashes match, preferable with user confirmation if is not
* running on localhost
*
* Trivia:
* - "linguam"
* - https://en.wiktionary.org/wiki/lingua#Latin
* - "cōnstrūctiōnem"
* - https://en.wiktionary.org/wiki/constructio#Latin
*/
linguam_constructionem() {
// self._get(self.FONTEM_LKG)
// self._get(self.FONTEM_VKG)
// console.log(await self._fetch(self.FONTEM_LKG))
// console.log(await self._fetch(self.FONTEM_VKG))
}
/**
* Explanare HDP
*
* Trivia
* - "explanare":
* - explano: https://en.wiktionary.org/wiki/explano#Latin
Expand All @@ -93,6 +150,8 @@ class HDPMiniman {
let resultatum = new Object()
resultatum.FONTEM_LKG = self.FONTEM_LKG
resultatum.FONTEM_VKG = self.FONTEM_VKG
resultatum.ONTOLOGIA_LKG = self.ONTOLOGIA_LKG
resultatum.ONTOLOGIA_VKG = self.ONTOLOGIA_VKG
// resultatum.push('FONTEM_ONTOLOGIA_VKG', self.FONTEM_ONTOLOGIA_VKG)
return resultatum
}
Expand Down
3 changes: 2 additions & 1 deletion hxlm-js/hxlm-js.sum
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
SHA384 (bootstrapper/hdp-minimam.mjs) = 3f952a050951e84a3ddfb85eb54f78dc102591ece51bb3e476ffecaaf0d1677feb49a1d91c67eb7449c8d35e1242dbe3
SHA384 (bootstrapper/hdp-aux.js) = d33d92c769b1fa0467f38f797c99406d47182400782f5c0744b37c9e53486d8a331b8d2319990920a250b90523786809
SHA384 (bootstrapper/hdp-minimam.mjs) = 11cff20de3a0e05067be0b32fc28dd70e7e278c0d1ccb25bc32627566056a48b9898d79f004fb7600a2b21bf7881216d
SHA384 (bootstrapper/hdplisp.js) = cd118e73f7ea84b780cc4ebb4e7e99cbf2bf41eecac7ca7b43be6ad5ac22b39189bd01a8fa380b237734030c205228cf
90 changes: 48 additions & 42 deletions hxlm-js/index.html
Original file line number Diff line number Diff line change
@@ -1,57 +1,63 @@
<!doctype html>
<html lang="la"> <!-- Lingua Latina -->
<head>
<html lang="la">
<!-- Lingua Latina -->

<head>
<!-- Required meta tags -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">

<!-- Bootstrap CSS -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" integrity="sha384-B0vP5xmATw1+K9KRQjQERJvTumQW0nPEzvF6L/Z6nronJ3oUOFUFpCjEUQouq2+l" crossorigin="anonymous">

<title>EticaAI/HXL-Data-Science-file-formats/hxlm-js</title>
</head>
<body>
<h1>EticaAI/HXL-Data-Science-file-formats/hxlm-js</h1>

<!-- Optional JavaScript; choose one of the two! -->

<!-- Option 1: jQuery and Bootstrap Bundle (includes Popper) -->
<script src="https://code.jquery.com/jquery-3.5.1.slim.min.js" integrity="sha384-DfXdz2htPH0lsSSs5nCTpuj/zy4C+OGpamoFVy38MVBnE+IbbVYUew+OrCXaRkfj" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js" integrity="sha384-Piv4xVNRyMGpqkS2by6br4gNJ7DXjqk09RmUpJ8jgGtD7zP9yug3goQfGII0yAns" crossorigin="anonymous"></script>

<!--
<script>
const HXLM_LKG="../hxlm/ontologia/json/core.lkg.json"
const HXLM_VKG="../hxlm/ontologia/json/core.vkg.json"
</script>
-->

<script src="./bootstrapper/hdp-minimam.mjs"></script>
<script src="./bootstrapper/hdp-minimam.js"></script>
<!-- Bootstrap CSS -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css"
integrity="sha384-B0vP5xmATw1+K9KRQjQERJvTumQW0nPEzvF6L/Z6nronJ3oUOFUFpCjEUQouq2+l" crossorigin="anonymous">
<!-- https://highlightjs.org/ -->
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/highlight.js/10.7.1/styles/default.min.css">
</head>

<body>
<h1>hxlm-js</h1>
<p><mark>(qdp->ENG "Open the console log of your browser!")</mark></p>

<h2>HDPMiniman</h2>
<div>
<h3>JavaScript</h3>
<pre><code class="lang-javascript">
bootstrapping = HDPMiniman.bootstrapping()
hdp = new HDPMiniman(bootstrapping)
console.log(hdp.explanare())
</code>
</pre>
<h3>console.log</h3>
<pre><code class="lang-json" id="hdp-explanare">

</code>
</pre>
</div>

<!-- JQuery, Boostrap -->
<script src="https://code.jquery.com/jquery-3.5.1.slim.min.js"
integrity="sha384-DfXdz2htPH0lsSSs5nCTpuj/zy4C+OGpamoFVy38MVBnE+IbbVYUew+OrCXaRkfj"
crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js"
integrity="sha384-Piv4xVNRyMGpqkS2by6br4gNJ7DXjqk09RmUpJ8jgGtD7zP9yug3goQfGII0yAns"
crossorigin="anonymous"></script>

<!-- https://highlightjs.org/ -->
<script src="//cdnjs.cloudflare.com/ajax/libs/highlight.js/10.7.1/highlight.min.js"></script>

<!-- HDP starts here -->
<script src="./bootstrapper/hdplisp.js"></script>
<script src="./bootstrapper/hdp-aux.js"></script>
<script src="./bootstrapper/hdp-minimam.mjs"></script>

<script>
// const HXLM_LKG="../hxlm/ontologia/json/core.lkg.json"
// const HXLM_VKG="../hxlm/ontologia/json/core.vkg.json"
// let hdp = new HDPMiniman({
// LKG: "../hxlm/ontologia/json/core.lkg.json",
// VKG: "../hxlm/ontologia/json/core.vkg.json"
// })

bootstrapping = HDPMiniman.bootstrapping()
hdp = new HDPMiniman(bootstrapping)

console.log(hdp)
console.log(hdp.explanare())
// console.log(HDPMiniman.explanare())
// console.log(HDPMiniman.explanare())
HDPAux.dump_to_html(hdp.explanare(), '#hdp-explanare')
</script>

<!-- Option 2: Separate Popper and Bootstrap JS -->
<!--
<script src="https://code.jquery.com/jquery-3.5.1.slim.min.js" integrity="sha384-DfXdz2htPH0lsSSs5nCTpuj/zy4C+OGpamoFVy38MVBnE+IbbVYUew+OrCXaRkfj" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/umd/popper.min.js" integrity="sha384-9/reFTGAW83EW2RDu2S0VKaIzap3H66lZH81PoYlFhbGU+6BZp6G7niu735Sk7lN" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.min.js" integrity="sha384-+YQ4JLhjyBLPDQt//I+STsc9iw4uQqACwlvpslubQzn4u2UU2UFM80nGisd026JF" crossorigin="anonymous"></script>
-->
</body>
</body>

</html>
9 changes: 6 additions & 3 deletions prepare-hxlm-relsease.sh
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,13 @@ cd "$ROOTDIR" || exit

cd hxlm-js/ || exit

# First file, >
sha384sum --tag bootstrapper/hdp-minimam.mjs > hxlm-js.sum
# First file, clean old checksums
rm hxlm-js.sum

# The rest, append, >>
# The rest, append
sha384sum --tag bootstrapper/hdp-aux.js > hxlm-js.sum

sha384sum --tag bootstrapper/hdp-minimam.mjs >> hxlm-js.sum
sha384sum --tag bootstrapper/hdplisp.js >> hxlm-js.sum

## Check the hashes
Expand Down

0 comments on commit a644c08

Please sign in to comment.