alex-2pwZlty+R/qmg8Ev75riOw@xxxxxxxxxxxxxxxx wrote:
Could you explain a bit more? I would prefer PHP over Javascript though,
but that's just me (I don't know much javascript). :)
Well, JavaScript is right there in almost any browser worth its weight
in silicon, so in addition to write a very simple GUI that can latch
onto a default install of TM4Jscript, you can have an on-the-fly
interpreter (hmm, Tom; maybe this is a good time to work on a query
thing for it, eh? :) to do interesting things. So, if you're writing an
article, tell the user to enter 'new array() ... and the document.write
it' to see the results on the fly. Or edit the HTML page. JavaScript is
under-evaluated as a language. it's got good OO, and often surprisingly
good performance. (Tom can give you the run-down on these things, but I
don't think Tom either has too much negative things to say about JS) And
what's more, it is perfect for learning about new stuff; no compiler, no
extra libraries to install, no development environment to worry about.
Javascript is actually a very nice language - it has many Python-esque
qualities. Here are some examples of writing simple topic map
information with TM4JScript to a web page (the code is installed in the
document head, but we pick it up here at the body) -
<body>
<script type='text/javascript'>
var tm1 = map // The main topic map (loaded in the head)
var topics = tm1.getTopicsFiltered() // a "hash" keyed by topic id
var msg = ''
// List available topic ids
for (var t in topics) {
msg += t + '<br>'
}
msg = '<h1>Topic IDs available</h1>' + msg
document.write(msg) // Written as the document loads
// List names of ten topics
msg = ''
var n = 0
var name
for (var t in topics) {// good idiom
name = topics[t].getNamesFiltered()[0].getNameString()
msg += name + '<br>'
n++;
if (n == 10) {break}
}
msg = '<h1>Names of first ten topics</h1>' + msg
document.write(msg)
// Same thing, but using a list so it can be sorted
var names = [] // Array (list) constructor
for (var t in topics) {
name = topics[t].getNamesFiltered()[0].getNameString();
names.push(name);
}
document.write('<h1>Names Again ...</h1>')
// Sort and select first 10 names
names.sort()
names = names.slice(0,10)// or names.sort().slice(0,10)
document.write(names.join('<br>'))
</script>
</body>
You can see it is very straightforward. The methods with "Filtered" in
their names can optionally accept a list of scoping topic ids.
This system can load the topic map from a file, or it could be supplied
by a server. The system will run in IE or any Mozilla-based browser (I
have verified that the code runs on both Windows and Linux). With
judicious use of css style sheets, javascript, and sometimes the DOM,
you can do an amazing lot in a browser page using this system.
On the other hand, the problem very often is how to visualise a topic
map, and as much as xSiteable, Omnigator, that TM4J/Cocoon thing and
others (AsTMa?) have a rather similar way of presenting stuff, Ceryle,
K42 and other graphical ones are surely an impressive display of
relationships. And topic maps are all about relationships between
things.
Yes, the UI is often the hardest part. But graph displays tend to get
tedious and hard to work with when the number of topics and associations
grows. There is no easy answer, so it would be better if the tutorial
project would not depend on a comprehensive display of the topic map
contents. Providing navigation or creation of new pages would
accomplish this goal.
Hmm, maybe some TinyTIM and thinkGraph merge would prove ideal for a
small and simple environment for people to install and play with? Anyone?
I'd personally spend some time on getting such a package up and running;
evangelising TM can be somewhat hard when all the good TM applications are
big and complex and not always free.
Either the tutorialee will have to create a topic map - preferably with
help from an editor, or the project will have to create them
automatically behind the scenes, as for Wiki pages. The latter makes
the topic map aspect invisible, so we would want to figure out a way to
show how their invisible presence makes the system better somehow.
Cheers,
Tom P
|