My application, HOPE (Higher Order Programming Environment) is, in its simplest definition, a semantic publisher-subscriber application builder. I’ve been wanting to move it to the web, but this is fraught with security concerns, hence my investigations into Docker technology and using a language like Python for the programming of “receptors” — the autonomous computational units that process semantic data. Another stumbling block is my lack of experience with HTML5 canvas and graphics rendering. Regardless though, there was no reason not to put together a proof of concept.
Here’s a quick walkthrough — no, this code is not yet publicly available.
Step 1: create a few receptors.
We’ll do some computations based on inputting a birth date.
Receptor #1: computing the age of a person in terms of years and days:
Notice the class name computeAge
. We’ll talk about this later.
Receptor #2: compute the number of days to the birth day:
Note the class name daysToBirthday
.
Receptor #3: Get the interesting people born on the same month and day:
Again, note the class name personsOfInterest
.
Step 2: Add the Receptors to the Surface Membrane
Step 3: Inject a semantic JSON object
Run the “membrane” and inject:
{"birthday": {"year": 1962, "month": 8, "day": 19}}
And here’s the result:
The full output being:
[
{
"age": {
"years": 37,
"days": 204
}
},
{
"daysToBirthday": 161
},
{
"personsOfInterest": [
"1724 Samuel Hood, 1st Viscount Hood, British admiral in the American Revolutionary War and the French Revolutionary Wars, born in Butleigh, England (d. 1816)",
"1745 John Jay, American statesman, 1st US Chief Justice, born in New York City",
"1863 Edvard Munch, Norwegian painter and print maker (The Scream), born in Ådalsbruk, Løten, Norway (d. 1944)",
"1915 Frank Sinatra, American singer (Strangers in the Night, My Way) and actor (From Here to Eternity) known as 'old blue eyes', born in Hoboken, New Jersey (d. 1998)",
"1932 robert pettit, American NBA star (St Louis Bombers/1959 MVP), born in Baton Rouge, Louisiana"
]
}
]
What’s Going On?
Simply put, a preprocessor creates a mapping between semantic types and receptors (Python classes):
receptorMap =
{
'birthday':[computeAge(), personsOfInterest()],
'age':[daysToBirthday()]
}
and the semantic processor engine routes the JSON semantic types to the Python class receptor’s process
method. When you inject “birthday”, it routes that type’s data to the computeAge
and personOfInterest
receptors. The output of computeAge
, which is of type “age”, is routed to the daysToBirthday
receptor.
In this manner, one can create a library of small computational units (receptors) and build interesting “computational stories” by mixing and matching the desired computations. Creating the receptors in Python makes this approach perfectly suited for running in Docker containers. My ultimate vision is that people would start publishing interesting receptors in the open source community.
There’s still much more to go, but even as such, it’s a fun prototype to play with! Some of the interesting problems that come out of this is, how do we let the end user create a visual interface (a UI, in other words) that facilitates both intuitive input of the semantic data as well as displaying real time output of the semantic computations. Just the kind of challenging stuff I like!