Happy New Year 2010
After a busy December month, the Christmas vacation finally gave me some room to concentrate on what really matters.
Here’s my third blog post on building web apps with Ontopia. A bit late – I had hoped to have it out before Christmas – but at least I made it within January 01 2010 … have a good one!
Getting to the Point
This blog post is part of a series on Web Application Development with Ontopia.
- Part 1: Installation & Requirements
- Part 2: Creating the Database
- Part 3: Creating the JSPs
In Part 2 of this series on building web applications with Ontopia we had a look at how to set up an application’s domain model using Ontopoly.
This post discusses how to go about building a custom web interface to present the data.
Read the full post »
by Trond on January 1, 2010
Intro
This blog post is part of a series on Web Application Development with Ontopia.
- Part 1: Installation & Requirements
- Part 2: Creating the Database
- Part 3: Creating the JSPs
In part 1, we looked at how to set up Ontopia. We also described the application that we intend to build (a blog) and what we need to develop in order to achieve our goal.
This time we’ll look at how to set up the “database schema” and create new blog posts by using Ontopia’s web interface. The resulting topic map can be browsed here.
Read the full post »
by Trond on December 4, 2009
Introduction
Ontopia is an Open Source application that lets you create, manipulate and navigate information represented in topic maps. It’s also a toolbox for building all sorts of applications. Among the advantages of topic maps driven applications are enhanced navigation and search capabilities.
Ever since Ontopia went Open Source earlier this year, I’ve wanted to give an example of how easy it is to build a web application on top of it.
Through the next couple of blog posts, I’ll try to show exactly how easy this is – and I promise to leave out the unnecessary talk (wont discuss Topic Maps, for instance).
First I’ll “reveal” how to set up and start Ontopia. As this requires very little typing on my part, I’ll quickly move on to discuss what our goal is. Then we’ll have a look at the required data model, before pointing out the kinds of views that our application needs to support — and how to lay this out. Afterwards, we create the limited amount of code needed to get everything up and running. Last, we deploy.
All code will be available for download 
Read the full post »
by Trond on November 21, 2009
The other day I needed to “re-invoke”/refresh the current page – i.e. the response HTML – during a <webtest />.
Since neither the manual nor a couple of quick Google searches gave me what I needed, here’s how I solved the problem using a simple <scriptStep> followed by an <invoke>:
<scriptStep description="Get the current HTTP Request URL." language="groovy">
def url = step.getContext()
.getCurrentResponse()
.getWebResponse()
.getRequestSettings()
.getUrl()
.toExternalForm();
step.setWebtestProperty('tmp.currentRequestUrl', url, step.PROPERTY_TYPE_DYNAMIC);
</scriptStep>
<!-- now you can use it like this or pass it to a definition -->
<invoke url="#{tmp.currentRequestUrl}" />
In case it might be of use to you…
by Trond on September 30, 2009
Google Alerts recently notified me of Digital Collection, a German supplier of software for managing and research of digital information
, which has created a topic maps based tool for news monitoring, research, archiving, workflows and now content creation
called DC-X.
From the company’s blog entry:
The benefits of treating thesaurus and list terms as topics in a topic map:
- Built-in support for multiple names, which we’re using to store translations for terms: All lists and thesauri can now be multi-lingual.
- Class/instance relationship between terms; the “City” list is itself a topic, “Hamburg” and “Oslo” are instances of the “City” topic. This way an unlimited number of lists or thesauri can co-exist. Terms can even belong to multiple lists.
- Arbitrary relations between terms: A thesaurus hierarchy is modeled using associations like “broader/narrower” or “synonym/preferred term”. Geographic hierarchies can use “part/whole” associations.
- External identifier URIs can be specified for any term, so metadata can be mapped to metadata of other software using RDF, or anything else that points to the same URI.
- Custom metadata can be attached to any term. We’ll use this for thesaurus “scope notes”, geo coordinates for cities etc.
They also mention that it is implemented based on XTM, why they chose not to use RDF, how the tool can be used, as well as plans for implementing a topic map browser and editor.
Alexander Johannesen’s Event Model Ontology
While blogging I might as well be the first one (?) to link to Alexander Johannesen’s “Missing ontological serinity in the world of software systems architecture” and “What event model ontology?”
by Trond on September 14, 2009
Back when I was in the university I took an undergraduate subject called Web programming. As part of that class, each student had to build a web site presenting the Shakespeare plays in a given format. The source was a bunch of XML documents.
Building the site using PHP and SAX parsing was fun enough at the time, but even though the XTM 1.0 specification mentions #play, #shakespeare and #written-by, I can’t recall ever seeing a topic map enabled site of the Shakespeare plays.
I therefore thought that it’d be fun to transform the Shakespeare XMLs into a topic map and publish it through a web site built on top of Ontopia.
I’m just putting the front end together piece by piece (15 mins here and 15 mins there :/ – currently not very usable).
The current (draft) version of the topic map is available for export (~23 MB LTM, ~133 MB XTM 2.0). This can also be browsed with Omnigator. If you observe any major flaws, feel free to leave a comment below
by Trond on September 2, 2009
Now that you know how to Execute XPress rules from Java I hope that the link to unit testing your XPress code (or perhaps mess?) is clear, and I would of course advise you to do so for every rule you write.
In order to test your XPress rules with jUnit, you can write normal unit tests that utilizes our XpressUtil.executeRule method. In addition, we have to use IdM’s SessionFactory to create a session to work with.
Here’s an example:
package com.mycorp.xpress;
import static org.junit.Assert.*;
import java.util.HashMap;
import java.util.Map;
import org.junit.Test;
import com.mycorp.util.XpressUtil;
import com.waveset.session.Session;
import com.waveset.session.SessionFactory;
import com.waveset.util.EncryptedData;
import com.waveset.util.WavesetException;
public class UserRuleLibraryTest {
private Session session = null;
private static final String username = "Configurator";
private static final String password = "configurator";
private static final String userAttributeRule = "MyCorp-UserRuleLibrary:getUserAttribute";
@Before
public void initializeSession() throws WavesetException {
// You can of course move this somewhere else
// ... and move away from hard coded usr/passwd.
EncryptedData encPassword = new EncryptedData(password);
session = SessionFactory.getSession(username, encPassword);
}
@Test
public void getUserAttributeRuleReturnsCorrectValueForName() throws WavesetException {
Object ruleResult = XpressUtil.executeRule( session, userAttributeRule, makeUserAttributeArgs() );
assertEquals("Received unexpected fullname from rule", "Bushy George", ruleResult);
}
private Map<String, Object> makeUserAttributeArgs() {
Map<String, Object> args = new HashMap<String, Object>();
args.put("context", getSession());
args.put("accountId", "georgeb");
args.put("attrName", "fullname");
return args;
}
}
One thing to remember is that in order to run this test, you have to pass in the waveset.home to be used. If you are like me — and use eclipse, you can set this under e.g. “Run Configurations” → “VM arguments”. Here’s a copy of what arguments I use for most of my jUnit tests:
-Xms128m
-Xmx512m
-Dwaveset.home="C:\\code\\mycorp\\idm\\image\\idm"
Next up: Unit testing Sun IdM web pages.
by Trond on March 11, 2009