Thursday, October 18, 2007

Moved

I have moved my post from blogger to wordpress...here is the link to my new blog posts http://ragrawal.wordpress.com

Friday, April 06, 2007

Cannot modify header information - headers already sent

how often do you see this message?. I was furious and agitated for last two hours. I knew that I have solved this problem before, but didn't remember either the cause or the solution. Not to reinvent the wheel again, I am documenting it right now, for myself and for others.

There are many possible things that can cause this error. However, the most common thing, atleast in my case, that causes this error is having some spaces after the closing PHP tag i.e. "?>". This often occurs when you copy and paste the code. To solve it make sure there are no other characters after you PHP closing tag. Delete any trailing spaces.

Hopefully you will find this helpful.

Bookmark this blog:
Furl
Netvouz
Simpy
Yahoo MyWeb
Google Bookmark

Saturday, March 17, 2007

Top 4 reasons why your javascript is not working in IE7

JQuery is an awesome javascript library that has made writing ajax application a piece of cake. However, building a perfect working application is still a problem, mainly, due to different standards of different browsers. Espeically, IE7 is notorious. There are no good free javascript debuggers for IE such as firebug for firefox and often IE does not stick with web standards. So here is a list of things/mistake that can screw up ajax your application in IE7.

Top 4 reasons why your javascript is not working in IE7

1. Script tag is on the first line of the page:
If you ajax page has javascript in it and the script tag is the first line (or first character of your page), then it is highly likely that IE7 will fail. To overcome this issue, I generally introduce a div tag (I refer it as fake div, because I set its height to 0px)as the first thing on my ajax page.
Solution to problem 1: < style="height: 0px">&nbsq;< /div >

2. Comma after the last element of an array:
Often jquery plugins can take arguements in the form of an array. However, make sure that you do not introduce a comma after last element. Firefox can handle it, but not IE. I believe the reason is that comma indicate that there is another element that will be following it. Thus IE expects that more elements are still coming and wait for them. So
This is wrongThis is right
{ name: 'Jack', message: 'hello', }{ name: 'Jack', message: 'hello'}

3. using firebug and console command
Many times developers use Firebug, a Firefox addon. I often use "console" command to debug my scripts in firefox. However, if by chance you left any console command within javascript script, it will break your javascript in IE7. Make sure to comment out or remove all "console" command before you test your javascript in IE7.

4. Trying to access non-exisitng key
if the javascript tries to access non-existing element, it will break your web site in IE7. Firefox will work without raising or reporting any error or warning.

Monday, February 19, 2007

Difference between OWL Lite, DL, and Full

For last two years, I have been working on a project involving Web Ontology Langauge (OWL). During this time, I learnt a lot about philosophical ontology, AI ontology, and OWL. However, one question that always kept coming back was about the differences between OWL Lite, DL, and Full. Although, I have scaned W3C OWL reference guide many times, I never got a satisfactory answer, until today. So here is my findings and summary on differences between OWL Lite, DL, and Full.
Note: I have used lot of RDF and OWL jargons while writing this post. I assume that people reading this post have some familarity with RDF and OWL.

Difference between OWL Sublanguages:
First, I introduce basic terminologies that will be used for the discussion. These definitions are adopted from W3C OWL Reference Guide.
Class: A class defines a group of individual that belong together because they share some properties. Two related concepts defined in OWL are “Thing” and “Nothing”

  • Thing: Thing comes as a predefined vocabulary of OWL. It is the superclass of all classes and a default class of all individuals. Thus, every individual in OWL world is a member of class Thing (or owl:Thing)
  • Nothing: Nothing (or owl: Nothing) is a class that has no instances and is a subclass of all classes.

Individuals: Individuals are instances of classes, and properties may be used to relate one individual to another

Property: Property is a binary relation that states relationships between individuals or from an individual to data value. Property can be further distinguished as “ObjectTypeProperty” or “DataTypeProperty”.

  • ObjectTypeProperty (owl:ObjectTypeProperty): It is defined as the relation between instances of two classes
  • DataTypeProperty (owl:DataTypeProperty) : It is defined as the relation between instances of classes and literal values such as string, number, and date.

RDF Resource: RDF resource is described in RDF document as anything that has a valid unique resource identifier (or URI). Hereafter, it is referred as “resource”.

The differences between the three sublanguages are due to differences in the definition of owl:class and owl:ObjectPropertyType in the three sublanguages of OWL

1. Owl:class vs rdfs:class
In OWL full, owl:class is defined as equivalent to rdfs:class. Thus any class that is a subclass of rdfs:class is also a subclass of owl:class. As a result, any valid rdf document can be considered as a valid OWL full document.
In constrast to owl full, owl:class is defined as subclass of rdfs:class in Lite and DL. Thus not all classes of RDF document (that are subclass of rdfs:class) can be an instances or subclasses of owl:class. As a result, a valid rdf document cannot be considered as a valid OWL Lite or DL document.

2. Owl:ObjectTypeProperty and rdf:Property
In OWL full, owl:ObjectTypeProperty is considered equivalent to rdf:Property. As a result, owl:DataTypeProperty, which is a subclass of rdf:property, is also a subclass of owl:ObjectTypeProperty. Thus, any property in OWL that is defined as datatype can also be interpreted as objectype property. This provides much of the expressiveness in OWL full.
Again in constrast to OWL full, owl:DataTypeProperty and owl:ObjectTypeProperty are defined as disjoint subclasses of rdf:property. As a result, built-in relations such as “InverseOf”, “InverseFunctional”, “Symmertric”, and “Transitive” cannot be specified as datatype property. This is because a dataType property defines a relation from one individual to a literal (integer, number, date). Thus, inverse of dataType Property does not hold much meaning.

These differences in the definitons of owl:class, owl:objectypeproperty, owl:datatypeproperty are the main reasons for the differences in OWL Lite, DL, and Full. Table 1 provides a comparison between these three sublanguages. Certain examples are included to show what can/cannot be expressed.


LiteDLFull
Compatibility
with RDF
Theoretically,no rdf document can be assumed to be compatible with OWL LiteTheoretically,no rdf document can be assumed to be compatible with OWL DLAll valid rdf documents are OWL full
Restrictions on class definitionRequires separation of classes, instances, properties, and data valuesRequires separation of classes, instances, properties, and data valuesClasses
can be instances or properties at the same time. For example, it is perfectly legal in OWL Full to have a "Fokker-100" identifier which acts both as a class name
(denoting the set of Fokker-100 airplanes flying around the world) and as an individual name (e.g., an instance of the class AirplaneType).
RDF MixingRestricts
mixing of rdf and owl constructs
Restricts
mixing of RDF and OWL constructs
Freely allows mixing of RDF and OWL constructs
Classes
Descriptions
The only class description available in OWL lite is IntersectionOfClasses
can be described as UnionOf , ComplementOf, IntersectionOf, and enumeration
Eg: class can be exhaustively defined by its instances. For example defining a class DaysOfWeek exhaustively by Sun, Mon, Tue, Wed, Thurs,
Fri, Sat
Classes can be UnionOf, ComplementOf, IntersectionOf, and enumeration Eg:
class can be exhaustively defined by its instances. For example defining a
class DaysOfWeek exhaustively by Sun, Mon, Tue, Wed, Thurs, Fri, Sat
Cardinality ConstraintsCardinality: 0/1 MinCardinality: 0/1 MaxCardinality: 0/1Cardinality>= 0 MaxCardinality >= 0
MinCardinality >= 0
Cardinality>= 0 MaxCardinality >= 0
MinCardinality >= 0
Value Constraintsowl:allValuesFrom Owl:someValuesFrom Object type for owl:valueFrom should be a class name or class identifierOwl:allValuesFrom Owl:someValueFrom Owl:hasValueOwl:allValuesFrom Owl:someValueFrom Owl:hasValue
MetamodelingDoes
not allow metamodeling
Does not allow metamodelingAllows metamodeling. Thus RDF and OWL constructs can be augmented or redefined
ClassOWL:class is subclass of RDFS:classOWL:class is subclass of RDFS:class.RDFS:class and OWL:class are equivalent