Archive for February, 2007

an exercise with math equations…

February 21, 2007 1 comment

I’ve just found out that I can write complex math equations using Latex syntax on WP. Here’s my first try:
(K_{i}\varphi \wedge K_{i}(\varphi \Longrightarrow \psi)) \Longrightarrow K_{i}\psi
Wow! Great! Learned this from this blog post.

Categories: rambling

Representing and Processing Time & Dates

February 20, 2007 Leave a comment

Time Data Types

(Some of the features explained in this post are available in the next Bossam release.)

With Bossam, time data can be represented and processed. The following time types supported.

Date (corresponds to xsd:date)

  • Syntax: yyyy-MM-dd
  • Example: 2004-10-09

Time (corresponds to xsd:time)

  • Syntax: HH:mm:ss
  • Example: 22:10:30

DateTime (corresponds to xsd:dateTime)

  • Syntax: yyyy-MM-dd'T'HH:mm:ss
  • Example: 2004-10-09T22:10:30

Time Duration (corresponds to xsd:duration)

(refer to XSD Duration on how to write time durations)

  • ex1) P10Y9M8DT10H9M8S represents 10 years 9 months 8 days 10 hours 9 minutes 8 seconds.
  • ex2) P10Y8DT10H represents 10 years 8 days 10 hours.
  • ex1) P10Y9M8D represents 10 years 9 months 8 days.
  • ex1) PT10H9S represents 10 hours 9 seconds.

Getting the Current Time/Date

Three builtin functions are available for getting the current time, current date, and current dateTime, as follows.
The namespace URI,, is the reserved namespace for designating Bossam’s builtin functions. Let’s assume func corresponds to

  • func:thisTime(): returns the current time
  • func:thisDate(): returns the current date
  • func:thisDateTime(): returns the current date-time

Builtin Functions for Comparing Date/Time

There are three builtin functions for processing time data.

  • func:after(time-const1,time-const2)
    • returns true if time-const1 follows time-const2
  • func:before(time-const1,time-const2)
    • returns true if time-const1 precedes time-const2
  • func:containedIn(time-const1,time-begin,time-end)
    • returns true if time-const1 is in the duration formed by time-begin and time-end

A sample rulebase utilizing time constants is shown below.

prefix xsd =;
prefix rdfs =;
prefix func =;
namespace is;
rulebase TimeConstants
 class Person;
 property birthdate for Person is xsd:date;
 individual John is Person and birthdate = 1970-10-05;
 individual Sam is Person and birthdate = 1970-05-05;

 rule r1 is
  birthdate(?x,?date1) and birthdate(?y,?date2)
  and [func:after(?date1,?date2) = true]

 rule r2 is
  birthdate(?x,?date1) and birthdate(?y,?date2)
  and [func:before(?date1,?date2) = true]

 fact f01 is beginsAt(MeetingA,2005-10-04T12:00:00);
 fact f02 is endsAt(MeetingA,2005-10-04T15:00:00);
 fact f03 is beginsAt(MeetingB,2005-10-04T14:00:00);
 fact f04 is endsAt(MeetingB,2005-10-04T17:00:00);
 fact f05 is beginsAt(MeetingC,2005-10-04T16:00:00);
 fact f06 is endsAt(MeetingC,2005-10-04T17:00:00);

 rule CompatibleMeetings is
  endsAt(?m1,?t1) and beginsAt(?m2,?t2)
  and [func:after(?t2,?t1) = true]

Expressions on Time Data

Simple addition and subtraction on time and duration can be processed.

Calculating Time Difference

By subtracting a time from another time, it’s possible to calculate the difference between the two time points. Some examples follow:

  • 2005-10-20 - 2005-09-10 gives P0Y0M40DT0H0M0S which is 40 days.
  • 23:10:20 - 10:30:40 gives P0Y0M0DT12H39M40S which is 12 hours 39 minutes 40 seconds.
  • 2007-12-31T24:00:00 - 2007-02-20T10:48:18 gives P0Y0M314DT13H11M42S which is 314 days 13 hours 11 minutes 42 seconds.

As such, it’s possible to get a time difference between two points in time.

Forwarding and Backwarding Times

By adding a duration to a time, we get a forwarded time. By subtracting a duration from a time, we get a bacwarded time. Addition examples follow:

  • 0003-12-10 + P1Y1M1D gives 0005-01-11.
  • 0003-12-10 + P13M9D gives 0005-01-19.
  • 12:10:20 + PT1H1M1S gives 13:11:21.
  • 12:10:20 + PT13H20M30S gives 01:30:50.
  • 0003-12-10T12:10:20 + P1Y1M1DT1H1M1S gives 0005-01-11T13:11:21.
  • 0003-12-10T12:10:20 + P1Y13M2DT13H20M30S gives 0006-01-13T01:30:50.

Subtraction examples follow:

  • 0003-12-10 - P1Y1M1D gives 0002-11-09.
  • 0003-12-10 - P13M9D gives 0002-11-01.
  • 12:10:20 - PT1H1M1S gives 11:09:19.
  • 12:10:20 - PT13H20M30S gives 22:49:50.
  • 0003-12-10T12:10:20 - P1Y1M1DT1H1M1S gives 0002-11-09T11:09:19.
  • 0003-12-10T12:10:20 - P1Y13M2DT13H20M30S gives 0001-11-07T22:49:50.

Some rule examples are as follows.

fact f is time(2002-10-10);
fact g is time(2002-12-31);
rule r is
   if time(?t1) and time(?t2)
   then result([?t1 - ?t2]);

fact f is time(2002-10-10);
fact g is duration(P10Y3M);
rule r is
   if time(?t) and duration(?d)
   then result([?t - ?d]);

fact f is time(12:30:00);
fact g is duration(PT1H30M);
rule r is
   if time(?t) and duration(?d)
   then result([?t + ?d]);

fact f is time(2002-10-10T12:30:00);
fact g is duration(P10DT1H30M);
rule r is
   if time(?t) and duration(?d)
   then result([?t - ?d]);
Categories: bossam, manual

Creating OwlTrMReasoner

February 7, 2007 3 comments

OwlTrMReasoner is a new OWL-DL reasoner added to Bossam. This reasoner is the most recommended OWL reasoner among the reasoners provided by Bossam. The following is the sample codes for creating and utilizing the reasoner.

// Create a reasoner
IReasonerFactory factory = ReasonerFactory.getInstance();
IReasoner r = factory.createOwlDlTrMReasoner();
// Load an ontology
r.load(IReasoner.OWL, "....");
// Perform a silent reasoning session, 
//  which does not return conclusions
Categories: bossam, manual

Rule Generating Rules

February 7, 2007 Leave a comment

Bossam supports asserting rules at the consequent of rules. Here’s a simple example.

rule r is
   if father(?x,?y)
      assert if Man(?x) then hasChild(?x);

The pattern at the consequent part is called the rule template. Instead of deriving facts, RGRs generate rule instances from the rule templates.

I believe that RGR will be very useful for encoding dynamic & complex knowledge. Also, RGR is an essential tool for performance optimization because it’s possible to reduce the number of facts by utilizing RGRs.

Hope RGRs be of a useful toy for Bossam users!

Categories: bossam, manual

Bossam 0.9b45 Released

February 7, 2007 1 comment

This release includes several enhancements and new features. (1) The RETE core of Bossam is redesigned and it shows a significant improvement. (2) A more elaborated and advanced OWL reasoner, OwlDlTrMReasoner, is added. This reasoner performs OWL reasoning based on elaborated translation and meta-rules. It covers a lot more of OWL reasoning than OwlDlTrHReasoner. Performance measures against famous ontologies and LUBM will soon be posted. (3) It’s possible to assert a rule at the head of rules. These rules, called rule-generating rules (RGR), enable writing more complex & dynamic knowledge and optimizing knowledge structure and performance.

Binary download is available at:

Categories: bossam, news

A new Bossam on Feb. 5

February 2, 2007 7 comments

A new Bossam release is planned on Feb. 5, 2007.

The new release will include better OWL DL reasoning supports:

  • Enhanced coverage on classification based on boolean compositions of classes
  • Enhanced coverage on classification based on nominals (owl:oneOf)

Also, a new rule construct is introduced: rule-generating rules (RGR). With RGR, it’s possible to assert a rule at the consequent as shown below.

rule r is
if causality(?cause, ?result)
assert if ?cause then ?result;

RGR will help representing more complex knowledge and optimizing knowledge structure!

Also on performance-side, the RETE core of Bossam is well optimized and it gives a lot better performance than before!

Categories: bossam, news

[BUG] xsd:boolean value reading error

February 2, 2007 2 comments

A bug in reading xsd:boolean value is reported.

Boolean value literals – "true", "false" – which are of type xsd:boolean are misinterpreted by Bossam.

The bug-fix will be included in the next build which will be released on Feb. 05, 2007. Thanks.

(note) Fixed by 0.9b45 release. (2007/02/08)

Categories: bug