1) Added serialization support (ToXml()) to DamlProcess and DamlTypeDefinition and its sub classes

rg2023 [2002-12-09 20:38:56]
1) Added serialization support (ToXml()) to DamlProcess and DamlTypeDefinition and its sub classes
2) Removed DamlProcessModel, this is now the DamlProcessModelReader
3) Added first implementation of WSDL-2-DAML
4) Added classes to represent DAML type definitions and restrictions used in Process Model documents
Filename
csharpsrc/DAML/AssemblyInfo.cs
csharpsrc/DAML/DAML.csproj
csharpsrc/DAML/DAML.suo
csharpsrc/DAML/DAMLConstants.cs
csharpsrc/DAML/DAMLContainer.cs
csharpsrc/DAML/DAMLProcess.cs
csharpsrc/DAML/DAMLProcessModel.cs
csharpsrc/DAML/DAMLProcessModelReader.cs
csharpsrc/DAML/DAMLServiceProfile.cs
csharpsrc/DAML/DamlClass.cs
csharpsrc/DAML/DamlOneOf.cs
csharpsrc/DAML/DamlProcessModelWriter.cs
csharpsrc/DAML/DamlRestriction.cs
csharpsrc/DAML/DamlTypeDefinition.cs
csharpsrc/DAML/DamlUnionOf.cs
csharpsrc/DAML/RdfProperty.cs
csharpsrc/DAML/RdfsSubClassOf.cs
csharpsrc/DAML/Wsdl2Daml.cs
csharpsrc/DAML/XPathExprBuilders.cs
diff --git a/csharpsrc/DAML/AssemblyInfo.cs b/csharpsrc/DAML/AssemblyInfo.cs
index 177a4f0..0607f39 100644
--- a/csharpsrc/DAML/AssemblyInfo.cs
+++ b/csharpsrc/DAML/AssemblyInfo.cs
@@ -26,7 +26,11 @@ using System.Runtime.CompilerServices;
 // You can specify all the values or you can default the Revision and Build Numbers
 // by using the '*' as shown below:

-[assembly: AssemblyVersion("1.0.*")]
+[assembly: AssemblyVersion("1.1.1063.24733")]
+
+// Old version 1.0.1025.42664 Summer 2002 (06/02 - 08/02)
+
+// New Version 1.1.1063.24733 29/11/02

 //
 // In order to sign your assembly you must specify a key to use. Refer to the
diff --git a/csharpsrc/DAML/DAML.csproj b/csharpsrc/DAML/DAML.csproj
index d318992..a1740a4 100644
--- a/csharpsrc/DAML/DAML.csproj
+++ b/csharpsrc/DAML/DAML.csproj
@@ -69,9 +69,19 @@
                 />
                 <Reference
                     Name = "System.XML"
-                    AssemblyName = "System.XML"
+                    AssemblyName = "System.Xml"
                     HintPath = "..\..\..\..\..\WINDOWS\Microsoft.NET\Framework\v1.0.3705\System.XML.dll"
                 />
+                <Reference
+                    Name = "System.Web"
+                    AssemblyName = "System.Web"
+                    HintPath = "..\..\..\..\..\WINDOWS\Microsoft.NET\Framework\v1.0.3705\System.Web.dll"
+                />
+                <Reference
+                    Name = "System.Web.Services"
+                    AssemblyName = "System.Web.Services"
+                    HintPath = "..\..\..\..\..\WINDOWS\Microsoft.NET\Framework\v1.0.3705\System.Web.Services.dll"
+                />
             </References>
         </Build>
         <Files>
@@ -82,6 +92,11 @@
                     BuildAction = "Compile"
                 />
                 <File
+                    RelPath = "DamlClass.cs"
+                    SubType = "Code"
+                    BuildAction = "Compile"
+                />
+                <File
                     RelPath = "DAMLConstants.cs"
                     SubType = "Code"
                     BuildAction = "Compile"
@@ -92,12 +107,27 @@
                     BuildAction = "Compile"
                 />
                 <File
+                    RelPath = "DamlOneOf.cs"
+                    SubType = "Code"
+                    BuildAction = "Compile"
+                />
+                <File
                     RelPath = "DAMLProcess.cs"
                     SubType = "Code"
                     BuildAction = "Compile"
                 />
                 <File
-                    RelPath = "DAMLProcessModel.cs"
+                    RelPath = "DAMLProcessModelReader.cs"
+                    SubType = "Code"
+                    BuildAction = "Compile"
+                />
+                <File
+                    RelPath = "DamlProcessModelWriter.cs"
+                    SubType = "Code"
+                    BuildAction = "Compile"
+                />
+                <File
+                    RelPath = "DamlRestriction.cs"
                     SubType = "Code"
                     BuildAction = "Compile"
                 />
@@ -107,6 +137,16 @@
                     BuildAction = "Compile"
                 />
                 <File
+                    RelPath = "DamlTypeDefinition.cs"
+                    SubType = "Code"
+                    BuildAction = "Compile"
+                />
+                <File
+                    RelPath = "DamlUnionOf.cs"
+                    SubType = "Code"
+                    BuildAction = "Compile"
+                />
+                <File
                     RelPath = "IIOPEXPathExprBuilder.cs"
                     SubType = "Code"
                     BuildAction = "Compile"
@@ -117,6 +157,21 @@
                     BuildAction = "Compile"
                 />
                 <File
+                    RelPath = "RdfProperty.cs"
+                    SubType = "Code"
+                    BuildAction = "Compile"
+                />
+                <File
+                    RelPath = "RdfsSubClassOf.cs"
+                    SubType = "Code"
+                    BuildAction = "Compile"
+                />
+                <File
+                    RelPath = "Wsdl2Daml.cs"
+                    SubType = "Code"
+                    BuildAction = "Compile"
+                />
+                <File
                     RelPath = "XPathExprBuilders.cs"
                     SubType = "Code"
                     BuildAction = "Compile"
diff --git a/csharpsrc/DAML/DAML.suo b/csharpsrc/DAML/DAML.suo
index 74c3051..0991ad1 100644
Binary files a/csharpsrc/DAML/DAML.suo and b/csharpsrc/DAML/DAML.suo differ
diff --git a/csharpsrc/DAML/DAMLConstants.cs b/csharpsrc/DAML/DAMLConstants.cs
index 995523a..971e4e3 100644
--- a/csharpsrc/DAML/DAMLConstants.cs
+++ b/csharpsrc/DAML/DAMLConstants.cs
@@ -1,9 +1,17 @@
 using System;
+using System.Text;
+using System.Xml;
+using System.Xml.Serialization;
+using System.Collections;

 namespace PSL.DAML
 {
+	/// <summary>
+	/// Enumeration of the various attributes of a process
+	/// </summary>
 	public enum enuIOPEType
 	{
+		None,
 		Input, // ServiceProfile entity
 		Output, // ServiceProfile entity
 		Precondition, // ServiceProfile entity
@@ -12,69 +20,116 @@ namespace PSL.DAML
 		CoCondition, // ProcessModel entity
 		CoOutput, // ProcessModel entity
 		Parameter // ProcessModel entity
-	};
+	}

-	public class RDFProperty
+	/// <summary>
+	/// Enumeration of the various Daml Type Definitions
+	/// </summary>
+	public enum enuDamlType
 	{
-		private string m_strName = "";
-		private string m_strSubPropertyOf = "";
-		private string m_strDomain = "";
-		private string m_strRange = "";
-		private string m_strSameValueAs = "";
+		rdfProperty,
+		damlClass
+	}

-		public RDFProperty()
-		{}
+	/// <summary>
+	/// Enumeration of the various DamlClass types
+	/// </summary>
+	public enum enuDamlClassType
+	{
+		rdfsSubClassOf,
+		damlUnionOf,
+		damlOneOf
+	}
+
+	/// <summary>
+	/// Enumeration of the various ParseTypes
+	/// </summary>
+	public enum enuRdfParseType
+	{
+		damlCollection
+	}
+
+	/// <summary>
+	/// Enumeration of the various types of searches used by the ServiceProfile
+	/// </summary>
+	public enum enuIOPESearchBy
+	{
+		PARAM_DESC,
+		PARAM_NAME,
+		COND_DESC,
+		COND_NAME,
+		REFERS_TO
+	}
+
+	/// <summary>
+	/// Enumeration of the various composite process sub task types/control structures
+	/// </summary>
+ 	public enum enuProcessSubTaskType
+	{
+		Sequence, // process:Sequence attribute
+		Choice	// process:Choice attribute
+	}

-		public string Name
-		{
-			get
-			{ return m_strName; }
-			set
-			{ m_strName = value; }
-		}
-		public string SubPropertyOf
-		{
-			get
-			{ return m_strSubPropertyOf; }
-			set
-			{ m_strSubPropertyOf = value; }
-		}
-
-		public string Domain
-		{
-			get
-			{ return m_strDomain; }
-			set
-			{ m_strDomain = value; }
-		}
-
-		public string Range
-		{
-			get
-			{ return m_strRange; }
-			set
-			{ m_strRange = value; }
-		}
-
-		public string SameValueAs
-		{
-			get
-			{ return m_strSameValueAs; }
-			set
-			{ m_strSameValueAs = value; }
-		}
+	/// <summary>
+	/// Enumeration of the various kinds of Daml Processes
+	/// </summary>
+	public enum enuProcessType
+	{
+		AtomicProcess,
+		CompositeProcess,
+		SimpleProcess
 	}

-	public abstract class DAMLConstants
+	/// <summary>
+	/// Abstract class of constant definitions
+	/// </summary>
+	public abstract class DamlConstants
 	{
 		//*********************************************************************//

+		// Namespace Uri constants usually present in DAML docs
+
+		//*********************************************************************//
+		public const string PROCESS_BASE_URI			= "http://www.daml.org/services/daml-s/2001/10/Process.daml";
+
+		public const string PROCESS_CONDITION_URI			= PROCESS_BASE_URI + "#" + "Condition";
+		public const string PROCESS_PRECONDITION_URI		= PROCESS_BASE_URI + "#" + "precondition";
+		public const string PROCESS_EFFECT_URI				= PROCESS_BASE_URI + "#" + "effect";
+		public const string PROCESS_INPUT_URI				= PROCESS_BASE_URI + "#" + "input";
+		public const string PROCESS_OUTPUT_URI				= PROCESS_BASE_URI + "#" + "output";
+		public const string PROCESS_CO_CONDITION_URI		= PROCESS_BASE_URI + "#" + "coCondition";
+		public const string PROCESS_CO_OUTPUT_URI			= PROCESS_BASE_URI + "#" + "coOutput";
+		public const string PROCESS_CONDITIONAL_OUTPUT_URI	= PROCESS_BASE_URI + "#" + "conditionalOutput";
+		public const string PROCESS_PARAMETER_URI			= PROCESS_BASE_URI + "#" + "parameter";
+		public const string PROCESS_COMPOSED_OF_URI			= PROCESS_BASE_URI + "#" + "composedOf";
+		public const string PROCESS_COMPONENTS_URI			= PROCESS_BASE_URI + "#" + "components";
+
+		// Process types
+		public const string SIMPLE_PROCESS_URI				= PROCESS_BASE_URI + "#" + "SimpleProcess";
+		public const string ATOMIC_PROCESS_URI				= PROCESS_BASE_URI + "#" + "AtomicProcess";
+		public const string COMPOSITE_PROCESS_URI			= PROCESS_BASE_URI + "#" + "CompositeProcess";
+
+		public const string RDF_ROOT = RDF_NS + ":RDF";
+
+		public const string RDF_NS_URI = "http://www/w3.org/1999/02/22-rdf-syntax-ns#";
+		public const string RDFS_NS_URI = "http://www/w3.org/2000/01/rdf-schema#";
+		public const string XSD_NS_URI = "http://www.w3.org/2000/10/XMLSchema#";
+		public const string DAML_NS_URI = "http://www.daml.org/2001/03/daml+oil#";
+		public const string DEX_NS_URI = "http://www.daml.org/2001/03/daml+oil-ex#";
+		public const string EXD_NS_URI = "http://www.daml.org/2001/03/daml+oil-ex-dt#";
+		public const string PROCESS_NS_URI = PROCESS_BASE_URI + "#";
+		public const string TIME_NS_URI = "http://www.ai.sri.com/~daml/ontologies/sri-basic/1-0Time.daml#";
+		public const string SERVICE_NS_URI = "http://daml.org/services/daml-s/2001/10/Service.daml#";
+
+		//*********************************************************************//
+
 		// Namespace constants usually present in DAML docs

 		//*********************************************************************//

 		public const string XMLNS = "xmlns";
-		// Known namespaces expected in Profile
+		public const string EXD_NS = "exd";
+		public const string DEX_NS = "dex";
 		public const string RDFS_NS = "rdfs";
 		public const string RDF_NS = "rdf";
 		public const string DAML_NS = "daml";
@@ -96,6 +151,9 @@ namespace PSL.DAML
 		public const string DAML_COLLECTION = DAML_NS + ":collection";
 		public const string DAML_INTERSECTION_OF = DAML_NS + ":intersectionOf";
 		public const string DAML_LIST_OF_INSTANCES_OF = DAML_NS + ":listOfInstancesOf";
+		public const string DAML_HAS_VALUE = DAML_NS + ":hasValue";
+		public const string DAML_ONE_OF = DAML_NS + ":oneOf";
+		public const string DAML_UNION_OF = DAML_NS + ":unionOf";
 		// RDF Constants (attributes)
 		public const string RDF_RESOURCE = RDF_NS + ":resource";
 		public const string RDF_COMMENT = RDF_NS + ":comment";
@@ -108,7 +166,7 @@ namespace PSL.DAML
 		public const string RDFS_SUBPROPERTYOF = RDFS_NS + ":subPropertyOf";
 		public const string RDFS_DOMAIN = RDFS_NS + ":domain";
 		public const string RDFS_RANGE = RDFS_NS + ":range";
-
+
 		//*********************************************************************//

 		// DAML-S Service Profile constants
@@ -166,11 +224,12 @@ namespace PSL.DAML
 		//*********************************************************************//

 		public const string DAML_CLASS = DAML_NS + ":Class";
+		public const string DAML_TO_CLASS = DAML_NS + ":toClass";
 		public const string DAML_SIMPLE_PROCESS = "SimpleProcess";
 		public const string DAML_COMPOSITE_PROCESS = "CompositeProcess";
 		public const string DAML_ATOMIC_PROCESS = "AtomicProcess";

-		public DAMLConstants()
+		public DamlConstants()
 		{}
 	}
 }
diff --git a/csharpsrc/DAML/DAMLContainer.cs b/csharpsrc/DAML/DAMLContainer.cs
index a37a720..9f408e6 100644
--- a/csharpsrc/DAML/DAMLContainer.cs
+++ b/csharpsrc/DAML/DAMLContainer.cs
@@ -1,4 +1,5 @@
 using System;
+using System.Text;
 using System.Xml;
 using System.Xml.XPath;
 using System.Collections;
@@ -8,119 +9,212 @@ using System.Xml.Serialization;
 namespace PSL.DAML
 {
 	/// <summary>
-	/// Basic base class for all DAML Document containers e.g DAMLProcessModel
+	/// Abstract base class for all DAML Document containers e.g DAMLProcessModelReader
 	/// and DAMLServiceProfile
 	/// </summary>
-	public abstract class DAMLContainer
+	public abstract class DamlContainer
 	{
 		// Member variables
-		protected XmlDocument m_doc;
-		protected XmlNamespaceManager m_mgr;
-		protected EventLog m_EvtLog;
-
-		public DAMLContainer()
-		{}
+		protected XmlDocument m_doc = null;
+		protected XmlNamespaceManager m_mgr = null;
+
+		/// <summary>
+		/// Ctor.
+		/// </summary>
+		/// <param name="strDaml">Daml string to load the DamlContainer with</param>
+		public DamlContainer( string strDaml )
+		{
+			// Load the daml string
+			LoadXml( strDaml );

+			// If the documentElement is null, there was some error loading the document
+			// so throw an exception
+			if( m_doc.DocumentElement == null )
+				throw new Exception( "Invalid document. Cannot get document root." );
+		}

-		// Need virtual methods to load from:
-		// file/unc path
-		// url/uri
-		// stream
-		// xml string - already implemented
+		/// <summary>
+		/// Method builds a basic Daml Root Tag string
+		/// </summary>
+		/// <returns>The basic Daml root tag</returns>
+		public static string BuildDamlDocRoot()
+		{
+			StringBuilder strXmlBuilder = new StringBuilder();

-		/* Function loads an Xml Document from a (possibly large) string
-		 * Inputs: strXml - string containing document text
-		 * Return value: true on successful load
-		 *				 false otherwise
-		 */
-		public virtual bool LoadXml( string strXml )
+			// Build root tag
+			strXmlBuilder.Append( "<" + DamlConstants.RDF_ROOT );
+			// Add namespace attributes
+			strXmlBuilder.Append( " " + DamlConstants.XMLNS + ":" + DamlConstants.RDF_NS + "=" + "\"" +  DamlConstants.RDF_NS_URI + "\"" );
+			strXmlBuilder.Append( " " + DamlConstants.XMLNS + ":" + DamlConstants.RDFS_NS + "=" + "\"" +  DamlConstants.RDFS_NS_URI + "\"" );
+			strXmlBuilder.Append( " " + DamlConstants.XMLNS + ":" + DamlConstants.XSD_NS + "=" + "\"" +  DamlConstants.XSD_NS_URI + "\"" );
+			strXmlBuilder.Append( " " + DamlConstants.XMLNS + ":" + DamlConstants.DAML_NS + "=" + "\"" +  DamlConstants.DAML_NS_URI + "\"" );
+			strXmlBuilder.Append( " " + DamlConstants.XMLNS + ":" + DamlConstants.DEX_NS + "=" + "\"" +  DamlConstants.DEX_NS_URI + "\"" );
+			strXmlBuilder.Append( " " + DamlConstants.XMLNS + ":" + DamlConstants.EXD_NS + "=" + "\"" +  DamlConstants.EXD_NS_URI + "\"" );
+			strXmlBuilder.Append( " " + DamlConstants.XMLNS + ":" + DamlConstants.SERVICE_NS + "=" + "\"" +  DamlConstants.SERVICE_NS_URI + "\"" );
+			strXmlBuilder.Append( " " + DamlConstants.XMLNS + ":" + DamlConstants.PROCESS_NS + "=" + "\"" +  DamlConstants.PROCESS_NS_URI + "\"" );
+			strXmlBuilder.Append( " " + DamlConstants.XMLNS + ":" + DamlConstants.TIME_NS + "=" + "\"" +  DamlConstants.TIME_NS_URI + "\"" );
+			strXmlBuilder.Append( ">\n" );
+			// Close root tag
+			strXmlBuilder.Append( "</" + DamlConstants.RDF_ROOT + ">" );
+
+			// Return the root tag
+			return strXmlBuilder.ToString();
+		}
+
+		/// <summary>
+		/// Function builds a basic Daml Document Template
+		/// </summary>
+		/// <param name="bAddOntologyImports">Indicates whether to include the ontology imports</param>
+		/// <returns>The basoc Daml Document Template</returns>
+		public static XmlDocument BuildDamlDocumentTemplate( bool bAddOntologyImports )
 		{
-			bool bStatus = false;
+			// Build the basic root tag
+			string strDamlDocRoot = DamlContainer.BuildDamlDocRoot();

-			try
-			{
-				m_doc.LoadXml( strXml );
-				// Move to root element
-				XmlNode root = m_doc.DocumentElement;
-				// Get attributes of root element
-				XmlAttributeCollection attColl = root.Attributes;
-				// TODO: Should use PopScope instead??
-				if( m_mgr != null )
-				{
-					//m_mgr.PopScope();
-					m_mgr = null;
-				}
+			// Create an XmlDocument and set the Document Element
+			XmlDocument doc = new XmlDocument();

-				m_mgr = new XmlNamespaceManager( m_doc.NameTable );
-				//m_mgr.PushScope();
+			// Load Xml into XmlDocument
+			doc.LoadXml( strDamlDocRoot );
+			// Get Document Element, this is our document root node
+			XmlNode root = doc.DocumentElement;
+
+			// If asked to add ontology imports...
+			if( bAddOntologyImports )
+			{
+				// Create a new node for the ontologies
+				XmlNode ontologyNode = doc.CreateNode( XmlNodeType.Element, DamlConstants.DAML_ONTOLOGY, DamlConstants.DAML_NS_URI );
+
+				// Add attribute to Ontology node
+				XmlAttribute ontologyAttribute = doc.CreateAttribute( DamlConstants.RDF_ABOUT, DamlConstants.RDF_NS_URI );
+				// Add ontology attribute
+				ontologyNode.Attributes.Append( ontologyAttribute );
+
+				// Add daml imports to ontology node

-				for( int i = 0; i < attColl.Count; i++ )
-				{
-					// Extract all namespaces we can find in document root
-					// and add to namespace manager
-
-					string strValue = attColl[i].InnerText;
-
-					if( attColl[i].Prefix == DAMLConstants.XMLNS )
-						m_mgr.AddNamespace( attColl[i].LocalName, strValue );
-
-					// Add default namespace (if any) and add to namespace manager
-					if( attColl[i].Prefix == "" )
-						m_mgr.AddNamespace( DAMLConstants.DEFAULT_NS, strValue );
-				}
+				// Import daml+oil
+				XmlNode damlImport = doc.CreateNode( XmlNodeType.Element, DamlConstants.DAML_IMPORTS, DamlConstants.DAML_NS_URI );
+				XmlAttribute damlImportAtt = doc.CreateAttribute( DamlConstants.RDF_RESOURCE, DamlConstants.RDF_NS_URI );
+				damlImportAtt.Value = DamlConstants.DAML_NS_URI;
+				damlImport.Attributes.Append( damlImportAtt );

-				bStatus = true;
+				// Import time
+				XmlNode timeImport = doc.CreateNode( XmlNodeType.Element, DamlConstants.DAML_IMPORTS, DamlConstants.DAML_NS_URI );
+				XmlAttribute timeImportAtt = doc.CreateAttribute( DamlConstants.RDF_RESOURCE, DamlConstants.RDF_NS_URI );
+				timeImportAtt.Value = DamlConstants.TIME_NS_URI;
+				timeImport.Attributes.Append( timeImportAtt );
+
+				// Import Service
+				XmlNode serviceImport = doc.CreateNode( XmlNodeType.Element, DamlConstants.DAML_IMPORTS, DamlConstants.DAML_NS_URI );
+				XmlAttribute serviceImportAtt = doc.CreateAttribute( DamlConstants.RDF_RESOURCE, DamlConstants.RDF_NS_URI );
+				serviceImportAtt.Value = DamlConstants.SERVICE_NS_URI;
+				serviceImport.Attributes.Append( serviceImportAtt );
+
+				// Import Process
+				XmlNode processImport = doc.CreateNode( XmlNodeType.Element, DamlConstants.DAML_IMPORTS, DamlConstants.DAML_NS_URI );
+				XmlAttribute processImportAtt = doc.CreateAttribute( DamlConstants.RDF_RESOURCE, DamlConstants.RDF_NS_URI );
+				processImportAtt.Value = DamlConstants.PROCESS_NS_URI;
+				processImport.Attributes.Append( processImportAtt );
+
+				// Add Imports to ontology node
+				ontologyNode.AppendChild( damlImport );
+				ontologyNode.AppendChild( timeImport );
+				ontologyNode.AppendChild( serviceImport );
+				ontologyNode.AppendChild( processImport );
+
+				// Add the ontology node to our document
+				root.AppendChild( ontologyNode );
 			}
-			catch( Exception e )
+
+			// Return the basic daml document template creates
+			return doc;
+		}
+
+		/// <summary>
+		/// Function loads an Xml Document from a (possibly large) string
+		/// </summary>
+		/// <param name="strXml">String containing document text</param>
+		/// <returns>true on successful load
+		/// false otherwise</returns>
+		public virtual bool LoadXml( string strXml )
+		{
+			// Quick check for valid input
+			if( strXml == null || strXml.Length == 0 )
+				throw new ArgumentException( "Parameter is null or empty string", strXml );
+
+			bool bStatus = false;
+
+			m_doc.LoadXml( strXml );
+			// Move to root element
+			XmlNode root = m_doc.DocumentElement;
+			// Get attributes of root element
+			XmlAttributeCollection attColl = root.Attributes;
+
+			// Reset namespace manager, since we will be reloading the namespaces
+			if( m_mgr != null )
+				m_mgr = null;
+
+			m_mgr = new XmlNamespaceManager( m_doc.NameTable );
+
+			// Extract all namespaces we can find in document root
+			// and add to namespace manager
+			for( int i = 0; i < attColl.Count; i++ )
 			{
-				m_EvtLog.WriteEntry( e.Message, EventLogEntryType.Error );
-			}
+				string strValue = attColl[i].InnerText;

+				if( attColl[i].Prefix == DamlConstants.XMLNS )
+					m_mgr.AddNamespace( attColl[i].LocalName, strValue );
+
+				// Add default namespace (if any) and add to namespace manager
+				if( attColl[i].Prefix == "" )
+					m_mgr.AddNamespace( DamlConstants.DEFAULT_NS, strValue );
+			}
+
+			bStatus = true;
+
+			// Return the operation status
 			return bStatus;
 		}

-		/* Function returns an array of all the ontology imports defined in a
-		 * DAML document.
-		 *
-		 * Inputs: none
-		 * Return value: an array of Ontology imports defined in the document
-		 */
+		/// <summary>
+		/// Function returns an array of all the ontology imports defined in a
+		/// DAML document.
+		/// </summary>
+		/// <returns>A string array of Ontology imports
+		/// (possibly empty if no ontologies have been imported)</returns>
 		protected virtual string[] GetOntologyImports()
 		{
-			ArrayList arrImports = new ArrayList();
+			// Create array list to store imports
+			ArrayList lstImports = new ArrayList();
+			// Get document element
+			XmlNode root = m_doc.DocumentElement;
+			// Get the ontology node
+			XmlNode node = root.SelectSingleNode( DamlConstants.DAML_ONTOLOGY, m_mgr );
+
+			// If none exists return an empty list
+			if( node == null )
+				return (string[]) lstImports.ToArray( typeof( System.String ) );
+
+			// Get the import nodes
+			XmlNodeList lstImportNodes = node.SelectNodes( DamlConstants.DAML_IMPORTS, m_mgr );
+			// If none exist return an empty list
+			if( lstImportNodes.Count == 0 )
+				return (string[]) lstImports.ToArray( typeof( System.String ) );

-			try
+			// Go thru list of imports and get all rdf:resource attribute values
+			// these are the imports
+			for( int i = 0; i < lstImportNodes.Count; i++ )
 			{
-				XmlNode root = m_doc.DocumentElement;
-				XmlNode node = root.SelectSingleNode( DAMLConstants.DAML_ONTOLOGY, m_mgr );
-
-				if( node == null )
-					return null;
-
-				XmlNodeList lstImports = node.SelectNodes( DAMLConstants.DAML_IMPORTS, m_mgr );
-
-				if( lstImports.Count == 0 )
-					return null;
-
-				// Go thru list of imports and get all rdf:resource attribute values
-				// these are the imports
-				for( int i = 0; i < lstImports.Count; i++ )
+				XmlAttributeCollection attColl = lstImportNodes[i].Attributes;
+				foreach( XmlAttribute att in attColl )
 				{
-					XmlAttributeCollection attColl = lstImports[i].Attributes;
-					foreach( XmlAttribute att in attColl )
-					{
-						if( att.Name == DAMLConstants.RDF_RESOURCE )
-							arrImports.Add( att.Value );
-					}
+					if( att.Name == DamlConstants.RDF_RESOURCE )
+						lstImports.Add( att.Value );
 				}
 			}
-			catch( Exception e )
-			{
-				m_EvtLog.WriteEntry( e.Message, EventLogEntryType.Error );
-			}

-			return (string[]) arrImports.ToArray( typeof( System.String ) );
+			// Return list of imports found
+			return (string[]) lstImports.ToArray( typeof( System.String ) );
 		}// End GetOntologyImports
-
 	}
 }
diff --git a/csharpsrc/DAML/DAMLProcess.cs b/csharpsrc/DAML/DAMLProcess.cs
index 4e5aea0..b1a5f24 100644
--- a/csharpsrc/DAML/DAMLProcess.cs
+++ b/csharpsrc/DAML/DAMLProcess.cs
@@ -1,48 +1,460 @@
 using System;
+using System.IO;
 using System.Collections;
+using System.Text;
+using System.Xml;
+using System.Xml.Serialization;

 namespace PSL.DAML
 {
-	//
-	public enum enuProcessSubTaskType
-	{
-		Sequence, // process:Sequence attribute
-		Choice	// process:Choice attribute
-	};
-
-	public class DAMLProcess
+	public sealed class DamlProcess
 	{
 		// All Processes have...
-		protected enuProcessType m_Type = enuProcessType.AtomicProcess;
-		protected string m_strName = "";
-		// Map input names to number of restrictions
-		protected Hashtable m_InputRestrictionMap = new Hashtable();
+		private enuProcessType m_Type = enuProcessType.AtomicProcess;
+		private string m_strName = "";
 		// Composite processes only have...
-		protected enuProcessSubTaskType m_SubTaskType;
-
-		// Each of these types represented as an RDFProperty
+		private enuProcessSubTaskType m_SubTaskType;
+		// Restriction Map - Hashtable of Hashtables
+		// Outer hashtable keyed on restriction types Inputs, outputs etc.
+		// Inner hashtable keyed on type names e.g. input name, output name etc.
+		Hashtable m_restrictionMap = new Hashtable();
+		// DataTypeMap keyed on type names
+		Hashtable m_dataTypeDefinitionMap = new Hashtable();
+
+		// Each of these types represented as an RdfProperty
 		// A collection of inputs
-		protected ArrayList m_arrInputs = new ArrayList();
+		private ArrayList m_arrInputs = new ArrayList();
 		// A collection of outputs
-		protected ArrayList m_arrOutputs = new ArrayList();
+		private ArrayList m_arrOutputs = new ArrayList();
 		// A collection of preconditions
-		protected ArrayList m_arrPreconditions = new ArrayList();
+		private ArrayList m_arrPreconditions = new ArrayList();
 		// A collection of effects
-		protected ArrayList m_arrEffects = new ArrayList();
+		private ArrayList m_arrEffects = new ArrayList();
 		// A collection of ConditionalOutputs
-		protected ArrayList m_arrConditionalOutputs = new ArrayList();
+		private ArrayList m_arrConditionalOutputs = new ArrayList();
 		// A collection of CoConditions
-		protected ArrayList m_arrCoConditions = new ArrayList();
+		private ArrayList m_arrCoConditions = new ArrayList();
 		// A collection of CoOutputs
-		protected ArrayList m_arrCoOutputs = new ArrayList();
+		private ArrayList m_arrCoOutputs = new ArrayList();
 		// A collection of Parameters
-		protected ArrayList m_arrParameters = new ArrayList();
+		private ArrayList m_arrParameters = new ArrayList();
 		// A collection of sub-steps (applicable for composite processes only)
-		protected ArrayList m_arrSubProcesses = new ArrayList();
+		private ArrayList m_arrSubProcesses = new ArrayList();

 		/* Constructor */
-		public DAMLProcess()
+		public DamlProcess()
+		{
+		}
+
+		public DamlTypeDefinition[] TypeDefinitions
+		{
+			get
+			{
+				ArrayList lstDefinitions = new ArrayList();
+
+				IDictionaryEnumerator it = this.m_dataTypeDefinitionMap.GetEnumerator();
+
+				while( it.MoveNext() )
+				{
+					lstDefinitions.Add( it.Value );
+				}
+
+				return (DamlTypeDefinition[]) lstDefinitions.ToArray( typeof( DamlTypeDefinition ) );
+			}
+		}
+
+		public void AddDataTypeDefinition( DamlTypeDefinition[] arrDefinitions )
+		{
+			if( arrDefinitions == null || arrDefinitions.Length == 0 )
+				return;
+
+			for( int i = 0; i < arrDefinitions.Length; i++ )
+				AddDataTypeDefinition( arrDefinitions[i] );
+		}
+
+		public void AddDataTypeDefinition( DamlTypeDefinition definition )
+		{
+			if( definition == null || definition.Name.Length == 0 )
+				throw new ArgumentException( "Invalid DamlTypeDefintion passed, definition either null or has empty name", "definition" );
+
+			if( !this.m_dataTypeDefinitionMap.Contains( definition.Name ) )
+				this.m_dataTypeDefinitionMap.Add( definition.Name, definition );
+		}
+
+		public void RemoveDataTypeDefinition( string strTypeDefinitionName )
+		{
+			if( strTypeDefinitionName == null || strTypeDefinitionName.Length == 0 )
+				return;
+
+			this.m_dataTypeDefinitionMap.Remove( strTypeDefinitionName );
+		}
+
+		public void AddRestriction( enuIOPEType restrictionType, DamlRestriction[] arrRestrict )
+		{
+			if( arrRestrict == null || arrRestrict.Length == 0 )
+				return;
+
+			// Based on type determine if there is an entry for this type of restriction
+			// first
+
+			if( !this.m_restrictionMap.ContainsKey( restrictionType ) )
+			{
+				Hashtable newInnerMap = new Hashtable();
+
+				for( int i = 0; i < arrRestrict.Length; i++ )
+				{
+					if( !newInnerMap.Contains( arrRestrict[i].OnProperty ) )
+						newInnerMap.Add( arrRestrict[i].OnProperty, arrRestrict[i] );
+				}
+
+				m_restrictionMap.Add( restrictionType, newInnerMap );
+			}
+			else // There is an inner map for this type of restriction
+			{
+				Hashtable innerMap = (Hashtable) m_restrictionMap[restrictionType];
+
+				for( int i = 0; i < arrRestrict.Length; i++ )
+				{
+					if( !innerMap.Contains( arrRestrict[i].OnProperty ) )
+						innerMap.Add( arrRestrict[i].OnProperty, arrRestrict[i] );
+				}
+			}
+		}
+
+		public DamlRestriction[] GetRestrictions( enuIOPEType restrictionType )
+		{
+			ArrayList lstRestrict = new ArrayList();
+
+			Hashtable innerMap = (Hashtable) this.m_restrictionMap[restrictionType];
+
+			if( innerMap != null )
+			{
+				IDictionaryEnumerator it = innerMap.GetEnumerator();
+
+				while( it.MoveNext() )
+				{
+					lstRestrict.Add( it.Value );
+				}
+			}
+
+			return (DamlRestriction[]) lstRestrict.ToArray( typeof(DamlRestriction) );
+		}
+
+		public enuIOPEType[] GetRestrictionTypes()
+		{
+			ArrayList lstRestrictionTypes = new ArrayList();
+
+			IDictionaryEnumerator it = this.m_restrictionMap.GetEnumerator();
+
+			while( it.MoveNext() )
+				lstRestrictionTypes.Add( it.Key );
+
+			return (enuIOPEType[]) lstRestrictionTypes.ToArray( typeof( enuIOPEType ) );
+		}
+
+		public void ClearRestrictionMap()
+		{
+			this.m_restrictionMap.Clear();
+		}
+
+		public void ClearRestrictionMap( enuIOPEType restrictionType )
+		{
+			if( this.m_restrictionMap.Contains( restrictionType ) )
+				this.m_restrictionMap.Remove( restrictionType );
+		}
+
+		public string ToXml( bool bAddTypeDefintions )
+		{
+			XmlDocument doc = DamlContainer.BuildDamlDocumentTemplate( true );
+			XmlNode root = doc.DocumentElement;
+
+			// Add DAML Process body
+
+			// Add this process' details name etc., if this process is complex
+			// there is additional data we must add
+
+			// Given a document (by ref) and an array of RDF properties
+			// we repeat the same basic steps
+
+			// Add Inputs (if any)
+			if( this.m_arrInputs.Count > 0 )
+				AddRdfProperties( ref doc, (RdfProperty[]) this.m_arrInputs.ToArray( typeof(RdfProperty) ), enuIOPEType.Input );
+
+			// Add Outputs (if any)
+			if( this.m_arrOutputs.Count > 0 )
+				AddRdfProperties( ref doc, (RdfProperty[]) this.m_arrOutputs.ToArray( typeof(RdfProperty) ), enuIOPEType.Output );
+
+			// Add Preconditions (if any)
+			if( this.m_arrPreconditions.Count > 0 )
+				AddRdfProperties( ref doc, (RdfProperty[]) this.m_arrPreconditions.ToArray( typeof(RdfProperty) ), enuIOPEType.Precondition );
+
+			// Add Effects (if any)
+			if( this.m_arrEffects.Count > 0 )
+				AddRdfProperties( ref doc, (RdfProperty[]) this.m_arrEffects.ToArray( typeof(RdfProperty) ), enuIOPEType.Effect );
+
+			// Add CoConditions (if any)
+			if( this.m_arrCoConditions.Count > 0 )
+				AddRdfProperties( ref doc, (RdfProperty[]) this.m_arrCoConditions.ToArray( typeof(RdfProperty) ), enuIOPEType.CoCondition );
+
+			// Add ConditionalOutputs (if any)
+			if( this.m_arrConditionalOutputs.Count > 0 )
+				AddRdfProperties( ref doc, (RdfProperty[]) this.m_arrConditionalOutputs.ToArray( typeof(RdfProperty) ), enuIOPEType.ConditionalOutput );
+
+			// Add CoOutputs (if any)
+			if( this.m_arrCoOutputs.Count > 0 )
+				AddRdfProperties( ref doc, (RdfProperty[]) this.m_arrCoOutputs.ToArray( typeof(RdfProperty) ), enuIOPEType.CoOutput );
+
+			// Add Parameters (if any)
+			if( this.m_arrParameters.Count > 0 )
+				AddRdfProperties( ref doc, (RdfProperty[]) this.m_arrParameters.ToArray( typeof(RdfProperty) ), enuIOPEType.Parameter );
+
+			// Create process node
+			XmlNode processNode = doc.CreateNode( XmlNodeType.Element, DamlConstants.DAML_CLASS, DamlConstants.DAML_NS_URI );
+			// Create process attribute
+			XmlAttribute processAtt = doc.CreateAttribute( DamlConstants.RDF_ID, DamlConstants.RDF_NS_URI );
+			// Set attribute value (process name)
+			processAtt.Value = this.m_strName;
+			// Add attribute to node
+			processNode.Attributes.Append( processAtt );
+
+			// Specify what type of process this is - this will be a child of processNode
+			// Create process type node (rdfs:subClassOf)
+			XmlNode processTypeNode = doc.CreateNode( XmlNodeType.Element, DamlConstants.RDFS_SUBCLASSOF, DamlConstants.RDFS_NS_URI );
+			// Create process type node attribute
+			XmlAttribute processTypeAtt = doc.CreateAttribute( DamlConstants.RDF_RESOURCE, DamlConstants.RDF_NS_URI );
+			// Set the type of process
+			switch( this.ProcessType )
+			{
+				case enuProcessType.AtomicProcess:
+					processTypeAtt.Value = DamlConstants.ATOMIC_PROCESS_URI; break;
+
+				case enuProcessType.SimpleProcess:
+					processTypeAtt.Value = DamlConstants.SIMPLE_PROCESS_URI; break;
+
+				case enuProcessType.CompositeProcess:
+					processTypeAtt.Value = DamlConstants.COMPOSITE_PROCESS_URI; break;
+
+				default: throw new ArgumentException( "Unknown process type" );
+			}
+			// Add attribute to process type node
+			processTypeNode.Attributes.Append( processTypeAtt );
+
+			// Add the processType node as a child of the process node
+			processNode.AppendChild ( processTypeNode );
+
+			// Add restrictions to process node if any
+
+			DamlRestriction[] arrRestrictions = this.GetRestrictions( enuIOPEType.Input );
+
+			for( int j = 0; j < arrRestrictions.Length; j++ )
+			{
+				if( arrRestrictions[j].Owner == this.Name )
+				{
+					// Create subClassOf node
+					XmlNode subClassOfNode = doc.CreateNode( XmlNodeType.Element, DamlConstants.RDFS_SUBCLASSOF, DamlConstants.RDFS_NS_URI );
+					// Create a node for each restriction (child of subClassOfNode)
+					XmlNode restrictionNode = doc.CreateNode( XmlNodeType.Element, DamlConstants.DAML_RESTRICTION, DamlConstants.DAML_NS_URI );
+					// Fill in restrictionNode data
+
+					// Add cardinality attribute if value has been set
+					if( arrRestrictions[j].Cardinality != DamlRestriction.NO_CARDINALITY )
+					{
+						// Create attribute
+						XmlAttribute cardinalityAtt = doc.CreateAttribute( DamlConstants.DAML_CARDINALITY, DamlConstants.DAML_NS_URI );
+						// Set attribute value
+						cardinalityAtt.Value = arrRestrictions[j].Cardinality.ToString();
+						// Add attribute to node
+						restrictionNode.Attributes.Append( cardinalityAtt );
+					}
+
+					// Create onPropertyNode
+					XmlNode onPropertyNode = doc.CreateNode( XmlNodeType.Element, DamlConstants.DAML_ON_PROPERTY, DamlConstants.DAML_NS_URI );
+					// Create onProperty attribute
+					XmlAttribute onPropertyAtt = doc.CreateAttribute( DamlConstants.RDF_RESOURCE, DamlConstants.RDF_NS_URI );
+					// Set attribute value
+					onPropertyAtt.Value = arrRestrictions[j].OnProperty;
+					// Add attribute to node
+					onPropertyNode.Attributes.Append( onPropertyAtt );
+
+					// Add onPropertyNode to restrictionNode
+					restrictionNode.AppendChild( onPropertyNode );
+
+					// If this instance is a composite process add extra nodes
+					// to the (composedOf) restriction node
+					if( this.ProcessType == enuProcessType.CompositeProcess && arrRestrictions[j].OnProperty == DamlConstants.PROCESS_COMPOSED_OF_URI )
+					{
+						XmlNode toClassNode = doc.CreateNode( XmlNodeType.Element, DamlConstants.DAML_TO_CLASS, DamlConstants.DAML_NS_URI );
+						XmlNode classNode = doc.CreateNode( XmlNodeType.Element, DamlConstants.DAML_CLASS, DamlConstants.DAML_NS_URI );
+						// Create intersection of node
+						XmlNode intersectionOfNode = doc.CreateNode( XmlNodeType.Element, DamlConstants.DAML_INTERSECTION_OF, DamlConstants.DAML_NS_URI );
+						// Create intersectionOf node attribute
+						XmlAttribute intersectionOfAtt = doc.CreateAttribute( DamlConstants.RDF_PARSE_TYPE, DamlConstants.RDF_NS_URI );
+						// Set attribute value
+						intersectionOfAtt.Value = DamlConstants.DAML_COLLECTION;
+						// Add attribute to intersecionOfNode
+						intersectionOfNode.Attributes.Append( intersectionOfAtt );
+
+						// Add a Daml class node and another restriction node
+						// to the intersectionOfNode
+						// Create a node to store the type of sub task "list" we have
+						// one of enuProcessSubTaskType
+						XmlNode subTaskTypeNode = doc.CreateNode( XmlNodeType.Element, DamlConstants.DAML_CLASS, DamlConstants.DAML_NS_URI );
+						// Create an attribute for the subTaskType node
+						XmlAttribute subTaskTypeAtt = doc.CreateAttribute( DamlConstants.RDF_ABOUT, DamlConstants.RDF_NS_URI );
+
+						// Set the atribute value
+						switch( this.SubTaskType )
+						{
+							case enuProcessSubTaskType.Choice:
+								subTaskTypeAtt.Value = DamlConstants.PROCESS_CHOICE; break;
+							case enuProcessSubTaskType.Sequence:
+								subTaskTypeAtt.Value = DamlConstants.PROCESS_SEQUENCE; break;
+							default: throw new Exception( "Unknown process sub-task type" );
+						}
+
+						// Add subTaskTypeAtt attribute to subTaskType node
+						subTaskTypeNode.Attributes.Append( subTaskTypeAtt );
+
+						// Add a restriction to the intersectionOf node
+						// this is where we list the names of the subprocesses
+						XmlNode subProcessRestrictionNode = doc.CreateNode( XmlNodeType.Element, DamlConstants.DAML_RESTRICTION, DamlConstants.DAML_NS_URI );
+						XmlNode subProcessRestrictionOnPropertyNode = doc.CreateNode( XmlNodeType.Element, DamlConstants.DAML_ON_PROPERTY, DamlConstants.DAML_NS_URI );
+						// Add attribute
+						XmlAttribute subProcessRestrictionOnPropertyAtt = doc.CreateAttribute( DamlConstants.RDF_RESOURCE, DamlConstants.RDF_NS_URI );
+						// Set attribute value
+						subProcessRestrictionOnPropertyAtt.Value = DamlConstants.PROCESS_COMPONENTS_URI;
+						// Add attribute to node
+						subProcessRestrictionOnPropertyNode.Attributes.Append( subProcessRestrictionOnPropertyAtt );
+
+						// last daml:toClass/daml:Class construct added to the subProcessRestrictionNode
+						XmlNode processListToClassNode = doc.CreateNode( XmlNodeType.Element, DamlConstants.DAML_TO_CLASS, DamlConstants.DAML_NS_URI );
+						XmlNode processListClassNode = doc.CreateNode( XmlNodeType.Element, DamlConstants.DAML_CLASS, DamlConstants.DAML_NS_URI );
+						XmlNode processListOfInstancesNode = doc.CreateNode( XmlNodeType.Element, DamlConstants.DAML_LIST_OF_INSTANCES_OF, DamlConstants.DAML_NS_URI );
+						// Add attribute
+						XmlAttribute processListOfInstancesAtt = doc.CreateAttribute( DamlConstants.RDF_PARSE_TYPE, DamlConstants.RDF_NS_URI );
+						// Set attribute value
+						processListOfInstancesAtt.Value = DamlConstants.DAML_COLLECTION;
+						// Add attribute to node
+						processListOfInstancesNode.Attributes.Append( processListOfInstancesAtt );
+
+						for( int i = 0; i < this.m_arrSubProcesses.Count; i++ )
+						{
+							// Create process name node
+							XmlNode processNameNode = doc.CreateNode( XmlNodeType.Element, DamlConstants.DAML_CLASS, DamlConstants.DAML_NS_URI );
+							// Create process name attribute
+							XmlAttribute processNameAtt = doc.CreateAttribute( DamlConstants.RDF_ABOUT, DamlConstants.RDF_NS_URI );
+							// Set processNameAtt value
+							processNameAtt.Value = "#" + ((DamlProcess) this.m_arrSubProcesses[i]).Name;
+							// Add attribute to node
+							processNameNode.Attributes.Append( processNameAtt );
+							// Add to list of instances node
+							processListOfInstancesNode.AppendChild( processNameNode );
+						}
+
+						processListClassNode.AppendChild( processListOfInstancesNode );
+						processListToClassNode.AppendChild( processListClassNode );
+						subProcessRestrictionNode.AppendChild( subProcessRestrictionOnPropertyNode );
+						subProcessRestrictionNode.AppendChild( processListToClassNode );
+						intersectionOfNode.AppendChild( subTaskTypeNode );
+						intersectionOfNode.AppendChild( subProcessRestrictionNode );
+						classNode.AppendChild( intersectionOfNode );
+						toClassNode.AppendChild( classNode );
+						restrictionNode.AppendChild( toClassNode );
+					}
+
+					// Add restrictionNode to subClassOfNode
+					subClassOfNode.AppendChild( restrictionNode );
+					//Add subClassOfNode to root
+					processNode.AppendChild( subClassOfNode );
+				}
+			}
+
+			// Add process node to root
+			root.AppendChild( processNode );
+
+			if( bAddTypeDefintions )
+			{
+				// Add data type definitions
+				IDictionaryEnumerator it = this.m_dataTypeDefinitionMap.GetEnumerator();
+
+				while( it.MoveNext() )
+				{
+					// Ask each type definition to ToXml() itself
+					// this gives us the nodes to add to our document
+					DamlTypeDefinition definition = (DamlTypeDefinition) it.Value;
+					XmlDocument typeDoc = new XmlDocument();
+					// Load the xml of the type definition
+					typeDoc.LoadXml( definition.ToXml() );
+					// Get the document element
+					XmlNode typeDocRoot = typeDoc.DocumentElement;
+					// Import the first child of the root into the damlProcess xml document
+					// being created
+					XmlNode temp = doc.ImportNode( typeDocRoot.FirstChild, true );
+					// Append that node to our current document root
+					root.AppendChild( temp );
+				}
+			}
+
+			return root.OuterXml;
+		}
+
+		private void AddRdfProperties( ref XmlDocument doc, RdfProperty[] arrData, enuIOPEType restrictionType )
 		{
+			XmlNode root = doc.DocumentElement;
+
+			for( int i = 0; i < arrData.Length; i++ )
+			{
+				RdfProperty prop = (RdfProperty) arrData[i];
+				XmlDocument propDoc = new XmlDocument();
+				propDoc.LoadXml( prop.ToXml() );
+				XmlNode propDocRoot = propDoc.DocumentElement;
+				XmlNode propertyNode = doc.ImportNode( propDocRoot.FirstChild, true );
+
+				// Get restrictions on property (if any)
+				DamlRestriction[] arrRestrictions = this.GetRestrictions( restrictionType );
+
+				for( int j = 0; j < arrRestrictions.Length; j++ )
+				{
+					if( arrRestrictions[j].Owner == prop.Name )
+					{
+						// Create subClassOf node
+						XmlNode subClassOfNode = doc.CreateNode( XmlNodeType.Element, DamlConstants.RDFS_SUBCLASSOF, DamlConstants.RDFS_NS_URI );
+						// Create a node for each restriction (child of subClassOfNode)
+						XmlNode restrictionNode = doc.CreateNode( XmlNodeType.Element, DamlConstants.DAML_RESTRICTION, DamlConstants.DAML_NS_URI );
+						// Fill in restrictionNode data
+
+						// Add cardinality attribute if value has been set
+						if( arrRestrictions[j].Cardinality != DamlRestriction.NO_CARDINALITY )
+						{
+							// Create attribute
+							XmlAttribute cardinalityAtt = doc.CreateAttribute( DamlConstants.DAML_CARDINALITY, DamlConstants.DAML_NS_URI );
+							// Set attribute value
+							cardinalityAtt.Value = arrRestrictions[j].Cardinality.ToString();
+							// Add attribute to node
+							restrictionNode.Attributes.Append( cardinalityAtt );
+						}
+
+						// Create onPropertyNode
+						XmlNode onPropertyNode = doc.CreateNode( XmlNodeType.Element, DamlConstants.DAML_ON_PROPERTY, DamlConstants.DAML_NS_URI );
+						// Create onProperty attribute
+						XmlAttribute onPropertyAtt = doc.CreateAttribute( DamlConstants.RDF_RESOURCE, DamlConstants.RDF_NS_URI );
+						// Set attribute value
+						onPropertyAtt.Value = arrRestrictions[j].OnProperty;
+						// Add attribute to node
+						onPropertyNode.Attributes.Append( onPropertyAtt );
+
+						// Add onPropertyNode to restrictionNode
+						restrictionNode.AppendChild( onPropertyNode );
+						// Add restrictionNode to subClassOfNode
+						subClassOfNode.AppendChild( restrictionNode );
+						//Add subClassOfNode to root
+						propertyNode.AppendChild( subClassOfNode );
+					}
+				}
+
+				// Add rdf:Property to root of document
+				root.AppendChild( propertyNode );
+			}
 		}

 		// Properties
@@ -68,260 +480,170 @@ namespace PSL.DAML
 			get
 			{ return m_strName; }
 			set
-			{ m_strName = value; }
+			{
+				if( value == null || value.Length == 0 )
+					return;
+
+				m_strName = value;
+			}
 		}

-		public RDFProperty[] Inputs
+		public RdfProperty[] Inputs
 		{
 			get
-			{ return (RDFProperty[]) m_arrInputs.ToArray( typeof(RDFProperty) ); }
+			{ return (RdfProperty[]) m_arrInputs.ToArray( typeof(RdfProperty) ); }
 		}

-		public RDFProperty[] Outputs
+		public RdfProperty[] Outputs
 		{
 			get
-			{ return (RDFProperty[]) m_arrOutputs.ToArray( typeof(RDFProperty) ); }
+			{ return (RdfProperty[]) m_arrOutputs.ToArray( typeof(RdfProperty) ); }
 		}

-		public RDFProperty[] Preconditions
+		public RdfProperty[] Preconditions
 		{
 			get
-			{ return (RDFProperty[]) m_arrPreconditions.ToArray( typeof(RDFProperty) ); }
+			{ return (RdfProperty[]) m_arrPreconditions.ToArray( typeof(RdfProperty) ); }
 		}

-		public RDFProperty[] Effects
+		public RdfProperty[] Effects
 		{
 			get
-			{ return (RDFProperty[]) m_arrEffects.ToArray( typeof(RDFProperty) ); }
+			{ return (RdfProperty[]) m_arrEffects.ToArray( typeof(RdfProperty) ); }
 		}

-		public RDFProperty[] ConditionalOutputs
+		public RdfProperty[] ConditionalOutputs
 		{
 			get
-			{ return (RDFProperty[]) m_arrConditionalOutputs.ToArray( typeof(RDFProperty) ); }
+			{ return (RdfProperty[]) m_arrConditionalOutputs.ToArray( typeof(RdfProperty) ); }
 		}

-		public RDFProperty[] CoConditions
+		public RdfProperty[] CoConditions
 		{
 			get
-			{ return (RDFProperty[]) m_arrCoConditions.ToArray( typeof(RDFProperty) ); }
+			{ return (RdfProperty[]) m_arrCoConditions.ToArray( typeof(RdfProperty) ); }
 		}

-		public RDFProperty[] CoOutputs
+		public RdfProperty[] CoOutputs
 		{
 			get
-			{ return (RDFProperty[]) m_arrCoOutputs.ToArray( typeof(RDFProperty) ); }
+			{ return (RdfProperty[]) m_arrCoOutputs.ToArray( typeof(RdfProperty) ); }
 		}

-		public RDFProperty[] Parameters
+		public RdfProperty[] Parameters
 		{
 			get
-			{ return (RDFProperty[]) m_arrParameters.ToArray( typeof(RDFProperty) ); }
+			{ return (RdfProperty[]) m_arrParameters.ToArray( typeof(RdfProperty) ); }
 		}

-		public DAMLProcess[] SubProcesses
+		public DamlProcess[] SubProcesses
 		{
 			get
-			{ return (DAMLProcess[]) m_arrSubProcesses.ToArray( typeof(DAMLProcess) ); }
-		}
-
-		/* Function returns the cardinality restrictions on a given named
-		 * input.
-		 *
-		 * Input: strInputName - named input
-		 * Return value: the cardinality (if the input does not exist 0 returned)
-		 */
-		public int GetInputRestriction( string strInputName )
-		{
-			if( !m_InputRestrictionMap.ContainsKey( strInputName ) )
-				return 0;
-			else return (int) m_InputRestrictionMap[strInputName];
+			{ return (DamlProcess[]) m_arrSubProcesses.ToArray( typeof(DamlProcess) ); }
 		}

-		/* Procedure Adds an input to a DAMLProcess
+		/* Procedure Adds an input to a DamlProcess
 		 *
-		 * Inputs: data - RDFProperty details of the input
+		 * Inputs: data - RdfProperty details of the input
 		 */
-		public void AddInput( RDFProperty data )
+		public void AddInput( RdfProperty data )
 		{
 			m_arrInputs.Add( data );
 		}

-		/* Procedure Adds an array of inputs to a DAMLProcess
-		 *
-		 * Inputs: arrData - RDFProperty details of the inputs
-		 */
-		public void AddInput( RDFProperty[] arrData )
-		{
-			m_arrInputs.AddRange( arrData );
-		}
-
-		/* Procedure Adds an output to a DAMLProcess
+		/* Procedure Adds an output to a DamlProcess
 		 *
-		 * Inputs: data - RDFProperty details of the output
+		 * Inputs: data - RdfProperty details of the output
 		 */
-		public void AddOutput( RDFProperty data )
+		public void AddOutput( RdfProperty data )
 		{
 			m_arrOutputs.Add( data );
 		}

-		/* Procedure Adds an array of outputs to a DAMLProcess
+		/* Procedure Adds a precondition to a DamlProcess
 		 *
-		 * Inputs: arrData - RDFProperty details of the outputs
+		 * Inputs: data - RdfProperty details of the precondition
 		 */
-		public void AddOutput( RDFProperty[] arrData )
-		{
-			m_arrOutputs.AddRange( arrData );
-		}
-
-		/* Procedure Adds a precondition to a DAMLProcess
-		 *
-		 * Inputs: data - RDFProperty details of the precondition
-		 */
-		public void AddPrecondition( RDFProperty data )
+		public void AddPrecondition( RdfProperty data )
 		{
 			m_arrPreconditions.Add( data );
 		}

-		/* Procedure Adds an array of preconditions to a DAMLProcess
+		/* Procedure Adds an effect to a DamlProcess
 		 *
-		 * Inputs: arrData - RDFProperty details of the preconditions
+		 * Inputs: data - RdfProperty details of the effect
 		 */
-		public void AddPrecondition( RDFProperty[] arrData )
-		{
-			m_arrPreconditions.AddRange( arrData );
-		}
-
-		/* Procedure Adds an effect to a DAMLProcess
-		 *
-		 * Inputs: data - RDFProperty details of the effect
-		 */
-		public void AddEffect( RDFProperty data )
+		public void AddEffect( RdfProperty data )
 		{
 			m_arrEffects.Add( data );
 		}

-		/* Procedure Adds an array of effects to a DAMLProcess
-		 *
-		 * Inputs: arrData - RDFProperty details of the effects
-		 */
-		public void AddEffect( RDFProperty[] arrData )
-		{
-			m_arrEffects.AddRange( arrData );
-		}
-
-		/* Procedure Adds a conditional output to a DAMLProcess
+		/* Procedure Adds a conditional output to a DamlProcess
 		 *
-		 * Inputs: data - RDFProperty details of the conditional output
+		 * Inputs: data - RdfProperty details of the conditional output
 		 */
-		public void AddConditionalOutput( RDFProperty data )
+		public void AddConditionalOutput( RdfProperty data )
 		{
 			m_arrConditionalOutputs.Add( data );
 		}

-		/* Procedure Adds an array of conditional outputs to a DAMLProcess
+		/* Procedure Adds a co-condition to a DamlProcess
 		 *
-		 * Inputs: arrData - RDFProperty details of the conditional outputs
+		 * Inputs: data - RdfProperty details of the co-condition
 		 */
-		public void AddConditionalOutput( RDFProperty[] arrData )
-		{
-			m_arrConditionalOutputs.AddRange( arrData );
-		}
-
-		/* Procedure Adds a co-condition to a DAMLProcess
-		 *
-		 * Inputs: data - RDFProperty details of the co-condition
-		 */
-		public void AddCoCondition( RDFProperty data )
+		public void AddCoCondition( RdfProperty data )
 		{
 			m_arrCoConditions.Add( data );
 		}

-		/* Procedure Adds an array of co-conditions to a DAMLProcess
+		/* Procedure Adds a co-output to a DamlProcess
 		 *
-		 * Inputs: arrData - RDFProperty details of the co-conditions
+		 * Inputs: data - RdfProperty details of the co-output
 		 */
-		public void AddCoCondition( RDFProperty[] arrData )
-		{
-			m_arrCoConditions.AddRange( arrData );
-		}
-
-		/* Procedure Adds a co-output to a DAMLProcess
-		 *
-		 * Inputs: data - RDFProperty details of the co-output
-		 */
-		public void AddCoOutput( RDFProperty data )
+		public void AddCoOutput( RdfProperty data )
 		{
 			m_arrCoOutputs.Add( data );
 		}

-		/* Procedure Adds an array of co-outputs to a DAMLProcess
-		 *
-		 * Inputs: arrData - RDFProperty details of the co-outputs
-		 */
-		public void AddCoOutput( RDFProperty[] arrData )
-		{
-			m_arrCoOutputs.AddRange( arrData );
-		}
-
-		/* Procedure Adds a parameter to a DAMLProcess
+		/* Procedure Adds a parameter to a DamlProcess
 		 *
-		 * Inputs: data - RDFProperty details of the parameter
+		 * Inputs: data - RdfProperty details of the parameter
 		 */
-		public void AddParameter( RDFProperty data )
+		public void AddParameter( RdfProperty data )
 		{
 			m_arrParameters.Add( data );
 		}

-		/* Procedure Adds an array of parameters to a DAMLProcess
+		/* Procedure Adds a subprocess to a (composite) DamlProcess
 		 *
-		 * Inputs: arrData - RDFProperty details of the parameters
-		 */
-		public void AddParameter( RDFProperty[] arrData )
-		{
-			m_arrParameters.AddRange( arrData );
-		}
-
-		/* Procedure Adds a subprocess to a (composite) DAMLProcess
-		 *
-		 * Inputs: data - DAMLProcess details of the process
+		 * Inputs: data - DamlProcess details of the process
 		 *
 		 * Exceptions: throws InvalidOperationException if the process is not being
-		 *			   added to a Composite DAMLProcess. ONLY Composite DAMLProcesses
+		 *			   added to a Composite DamlProcess. ONLY Composite DAMLProcesses
 		 *			   support subprocesses.
 		 */
-		public void AddSubProcess( DAMLProcess data )
+		public void AddSubProcess( DamlProcess data )
 		{
 			if( ProcessType == enuProcessType.CompositeProcess )
 				m_arrSubProcesses.Add( data );
 			else throw new InvalidOperationException( "Only Composite Processes can have SubProcesses" );
 		}

-		/* Procedure Adds an array of subprocess to a (composite) DAMLProcess
+		/* Procedure Adds an array of subprocess to a (composite) DamlProcess
 		 *
-		 * Inputs: arrData - DAMLProcess details of the processes
+		 * Inputs: arrData - DamlProcess details of the processes
 		 *
 		 * Exceptions: throws InvalidOperationException if the processes are not being
-		 *			   added to a Composite DAMLProcess. ONLY Composite DAMLProcesses
+		 *			   added to a Composite DamlProcess. ONLY Composite DAMLProcesses
 		 *			   support subprocesses.
 		 */
-		public void AddSubProcess( DAMLProcess[] arrData )
+		public void AddSubProcess( DamlProcess[] arrData )
 		{
 			if( ProcessType == enuProcessType.CompositeProcess )
 				m_arrSubProcesses.AddRange( arrData );
 			else throw new InvalidOperationException( "Only Composite Processes can have SubProcesses" );
 		}

-		/* Procedure adds an input (cardinality) restriction
-		 *
-		 * Inputs: strInput - named input
-		 *		   nRestriction - cardinality of strInput
-		 */
-		public void AddInputRestriction( string strInput, int nRestriction )
-		{
-			m_InputRestrictionMap.Add( strInput, nRestriction );
-		}
-
 		/* Procedure clears all inputs
 		 */
 		public void ClearInputs()
@@ -385,11 +707,9 @@ namespace PSL.DAML
 			m_arrSubProcesses.Clear();
 		}

-		/* Procedure clears the input restriction map
-		 */
-		public void ClearRestrictionMap()
+		public void ClearDataTypeDefinitionMap()
 		{
-			m_InputRestrictionMap.Clear();
+			m_dataTypeDefinitionMap.Clear();
 		}

 		/* Procedure clears all the constituent data structures used to store
@@ -405,8 +725,10 @@ namespace PSL.DAML
 			this.ClearOutputs();
 			this.ClearParameters();
 			this.ClearPreconditons();
-			this.ClearRestrictionMap();
 			this.ClearSubProcesses();
+			this.ClearRestrictionMap();
+
+			this.ClearDataTypeDefinitionMap();
 		}

 		// HasXXXX
diff --git a/csharpsrc/DAML/DAMLProcessModel.cs b/csharpsrc/DAML/DAMLProcessModel.cs
deleted file mode 100644
index 0bc4ad9..0000000
--- a/csharpsrc/DAML/DAMLProcessModel.cs
+++ /dev/null
@@ -1,489 +0,0 @@
-using System;
-using System.Xml;
-using System.Xml.XPath;
-using System.Collections;
-using System.Diagnostics;
-using System.Xml.Serialization;
-
-namespace PSL.DAML
-{
-	public enum enuProcessType
-	{
-		AtomicProcess,
-		CompositeProcess,
-		SimpleProcess
-	};
-
-	/// <summary>
-	/// Summary description for DAMLProcessModel.
-	/// </summary>
-	public class DAMLProcessModel:DAMLContainer
-	{
-		public const int DEFAULT_RESTRICTION = 1;
-
-		public DAMLProcessModel()
-		{
-			// Init inherited members
-			m_EvtLog = new EventLog( "Application" );
-			m_EvtLog.Source = "DAMLProcessModel";
-			m_doc = new XmlDocument();
-			m_mgr = null;
-		}
-
-
-		public string[] AtomicProcesses
-		{
-			get
-			{ return GetProcesses( enuProcessType.AtomicProcess ); }
-		}
-
-		public string[] CompositeProcesses
-		{
-			get
-			{ return GetProcesses( enuProcessType.CompositeProcess ); }
-		}
-
-		public string[] SimpleProcesses
-		{
-			get
-			{ return GetProcesses( enuProcessType.SimpleProcess ); }
-		}
-
-		public string[] AllProcesses
-		{
-			get
-			{
-				ArrayList arrProcesses = new ArrayList();
-
-				string[] arrAtomic = AtomicProcesses;
-				string[] arrComposite = CompositeProcesses;
-				string[] arrSimple = SimpleProcesses;
-
-				// Add all to our collection
-				arrProcesses.AddRange( arrAtomic );
-				arrProcesses.AddRange( arrComposite );
-				arrProcesses.AddRange( arrSimple );
-
-				return (string[]) arrProcesses.ToArray( typeof( System.String ) );
-			}
-		}
-
-		/* Function retrieves all the interesting data about a process given its name and
-		 * type.
-		 *
-		 * Interesting data:
-		 * Inputs, Outputs, Preconditions, Effects, Parameters, ConditionalOutputs,
-		 * Co-Conditions, Sub Processes (if process is a composite process)
-		 *
-		 * Inputs: strProcessName - named process
-		 *		   processType - process type (atomic, simple, composite)
-		 *
-		 * Return value: DAMLProcess containing all the relevant data
-		 */
-		public DAMLProcess GetProcessData( string strProcessName, enuProcessType processType )
-		{
-			DAMLProcess retVal = new DAMLProcess();
-
-			try
-			{
-				XmlNode root = m_doc.DocumentElement;
-				string strBaseUri = GetNamespaceBaseUri( DAMLConstants.PROCESS_NS );
-				string strUri = "";
-				strUri = strBaseUri;
-
-				switch( processType )
-				{
-					case enuProcessType.AtomicProcess: strUri += DAMLConstants.DAML_ATOMIC_PROCESS;
-						break;
-					case enuProcessType.CompositeProcess: strUri += DAMLConstants.DAML_COMPOSITE_PROCESS;
-						break;
-					case enuProcessType.SimpleProcess: strUri += DAMLConstants.DAML_SIMPLE_PROCESS;
-						break;
-					default:  throw new ArgumentException( "Invalid processType value" );
-				};
-
-				string strXPath = DAMLConstants.DAML_CLASS + "[@" + DAMLConstants.RDF_ID + "='" + strProcessName + "']" + "/" + DAMLConstants.RDFS_SUBCLASSOF + "[@" + DAMLConstants.RDF_RESOURCE + "='" + strUri + "']";
-
-				XmlNode processNode = root.SelectSingleNode( strXPath, m_mgr ).ParentNode;
-
-				// No such process exists so just exit - should throw exception since
-				// returned DAMLProcess is useless?
-				if( processNode == null )
-					return retVal;
-
-				// Set process name
-				retVal.Name = processNode.Attributes[DAMLConstants.RDF_ID].Value;
-				// Set process type
-				retVal.ProcessType = processType;
-
-				// Get inputs from querying RDFProperty nodes in document
-				strXPath = DAMLConstants.RDF_PROPERTY + "/" + DAMLConstants.RDFS_SUBPROPERTYOF + "[@" +  DAMLConstants.RDF_RESOURCE + "='" + strBaseUri + DAMLConstants.INPUT + "']" + "/" + "following-sibling::" + DAMLConstants.RDFS_DOMAIN + "[@" + DAMLConstants.RDF_RESOURCE + "='#" + strProcessName + "']";
-				XmlNodeList lstNodes = root.SelectNodes( strXPath, m_mgr );
-
-				foreach( XmlNode node in lstNodes )
-				{
-					RDFProperty data = GetNodeData( node );
-					retVal.AddInput( data );
-				}
-
-				// Get additional inputs from the process node itself
-				// they may be hidden under restictions tagged with
-				// daml:sameValueAs
-				strXPath =  DAMLConstants.DAML_CLASS + "[@" + DAMLConstants.RDF_ID + "='" + retVal.Name + "']" + "/" + DAMLConstants.RDFS_SUBCLASSOF + "/" + DAMLConstants.DAML_RESTRICTION + "/" + DAMLConstants.DAML_ON_PROPERTY + "[@" + DAMLConstants.RDF_RESOURCE + "='" + strBaseUri + DAMLConstants.INPUT + "']" + "/" + "following-sibling::" + DAMLConstants.DAML_SAMEVALUESAS;
-				lstNodes = root.SelectNodes( strXPath, m_mgr );
-
-				foreach( XmlNode node in lstNodes )
-				{
-					string strSameValueAs = node.Attributes[DAMLConstants.RDF_RESOURCE].Value;
-					strSameValueAs = strSameValueAs.Trim( new char[] {'#'} );
-
-					// Go get RDFProperty data
-					strXPath = DAMLConstants.RDF_PROPERTY + "[@" + DAMLConstants.RDF_ID + "='" + strSameValueAs + "']" + "/" + DAMLConstants.RDFS_DOMAIN;
-					XmlNode domainNode = root.SelectSingleNode( strXPath, m_mgr );
-
-					// Add to list of inputs
-					if( domainNode != null )
-					{
-						RDFProperty data = GetNodeData( domainNode );
-						retVal.AddInput( data );
-					}
-				}
-
-				// Get outputs
-				strXPath = DAMLConstants.RDF_PROPERTY + "/" + DAMLConstants.RDFS_SUBPROPERTYOF + "[@" +  DAMLConstants.RDF_RESOURCE + "='" + strBaseUri + DAMLConstants.OUTPUT + "']" + "/" + "following-sibling::" + DAMLConstants.RDFS_DOMAIN + "[@" + DAMLConstants.RDF_RESOURCE + "='#" + strProcessName + "']";
-				lstNodes = root.SelectNodes( strXPath, m_mgr );
-
-				foreach( XmlNode node in lstNodes )
-				{
-					RDFProperty data = GetNodeData( node );
-					retVal.AddOutput( data );
-				}
-
-				// Get preconditions
-				strXPath = DAMLConstants.RDF_PROPERTY + "/" + DAMLConstants.RDFS_SUBPROPERTYOF + "[@" +  DAMLConstants.RDF_RESOURCE + "='" + strBaseUri + DAMLConstants.PRECONDITION + "']" + "/" + "following-sibling::" + DAMLConstants.RDFS_DOMAIN + "[@" + DAMLConstants.RDF_RESOURCE + "='#" + strProcessName + "']";
-				lstNodes = root.SelectNodes( strXPath, m_mgr );
-
-				foreach( XmlNode node in lstNodes )
-				{
-					RDFProperty data = GetNodeData( node );
-					retVal.AddPrecondition( data );
-				}
-
-				// Get effects
-				strXPath = DAMLConstants.RDF_PROPERTY + "/" + DAMLConstants.RDFS_SUBPROPERTYOF + "[@" +  DAMLConstants.RDF_RESOURCE + "='" + strBaseUri + DAMLConstants.EFFECT + "']" + "/" + "following-sibling::" + DAMLConstants.RDFS_DOMAIN + "[@" + DAMLConstants.RDF_RESOURCE + "='#" + strProcessName + "']";
-				lstNodes = root.SelectNodes( strXPath, m_mgr );
-
-				foreach( XmlNode node in lstNodes )
-				{
-					RDFProperty data = GetNodeData( node );
-					retVal.AddEffect( data );
-				}
-
-				// Get conditional outputs
-				strXPath = DAMLConstants.RDF_PROPERTY + "/" + DAMLConstants.RDFS_SUBPROPERTYOF + "[@" +  DAMLConstants.RDF_RESOURCE + "='" + strBaseUri + DAMLConstants.CONDITIONAL_OUTPUT + "']" + "/" + "following-sibling::" + DAMLConstants.RDFS_DOMAIN + "[@" + DAMLConstants.RDF_RESOURCE + "='#" + strProcessName + "']";
-				lstNodes = root.SelectNodes( strXPath, m_mgr );
-
-				foreach( XmlNode node in lstNodes )
-				{
-					RDFProperty data = GetNodeData( node );
-					retVal.AddConditionalOutput( data );
-				}
-
-				// Get co-conditions
-				strXPath = DAMLConstants.RDF_PROPERTY + "/" + DAMLConstants.RDFS_SUBPROPERTYOF + "[@" +  DAMLConstants.RDF_RESOURCE + "='" + strBaseUri + DAMLConstants.CO_CONDITION + "']" + "/" + "following-sibling::" + DAMLConstants.RDFS_DOMAIN + "[@" + DAMLConstants.RDF_RESOURCE + "='#" + strProcessName + "']";
-				lstNodes = root.SelectNodes( strXPath, m_mgr );
-
-				foreach( XmlNode node in lstNodes )
-				{
-					RDFProperty data = GetNodeData( node );
-					retVal.AddCoCondition( data );
-				}
-
-				// Get co-outputs
-				strXPath = DAMLConstants.RDF_PROPERTY + "/" + DAMLConstants.RDFS_SUBPROPERTYOF + "[@" +  DAMLConstants.RDF_RESOURCE + "='" + strBaseUri + DAMLConstants.CO_OUTPUT + "']" + "/" + "following-sibling::" + DAMLConstants.RDFS_DOMAIN + "[@" + DAMLConstants.RDF_RESOURCE + "='#" + strProcessName + "']";
-				lstNodes = root.SelectNodes( strXPath, m_mgr );
-
-				foreach( XmlNode node in lstNodes )
-				{
-					RDFProperty data = GetNodeData( node );
-					retVal.AddCoOutput( data );
-				}
-
-				// Get parameters
-				strXPath = DAMLConstants.RDF_PROPERTY + "/" + DAMLConstants.RDFS_SUBPROPERTYOF + "[@" +  DAMLConstants.RDF_RESOURCE + "='" + strBaseUri + DAMLConstants.PARAMETER + "']" + "/" + "following-sibling::" + DAMLConstants.RDFS_DOMAIN + "[@" + DAMLConstants.RDF_RESOURCE + "='#" + strProcessName + "']";
-				lstNodes = root.SelectNodes( strXPath, m_mgr );
-
-				foreach( XmlNode node in lstNodes )
-				{
-					RDFProperty data = GetNodeData( node );
-					retVal.AddParameter( data );
-				}
-
-				// For each input, fill the process' InputRestrictionMap
-				// search on process name
-				if( retVal.HasInputs )
-				{
-					foreach( RDFProperty Input in retVal.Inputs )
-					{
-						int nRestriction = GetInputRestrictions( retVal.Name, Input.Name );
-						if( nRestriction == 0 )
-							nRestriction = DEFAULT_RESTRICTION;
-						retVal.AddInputRestriction( Input.Name, nRestriction );
-					}
-				}
-
-				// If we are dealing with a complex process we must go get
-				// the substeps - need to get process:<type> data
-				if( processType == enuProcessType.CompositeProcess )
-				{
-					retVal.SubTaskType = GetProcessSubTaskType( retVal.Name );
-					retVal.AddSubProcess( GetSubProcesses( retVal.Name ) );
-				}
-			}
-			catch( Exception e )
-			{
-				m_EvtLog.WriteEntry( e.Message, EventLogEntryType.Error );
-			}
-			return retVal;
-		}
-
-        /* Function extracts the RDFProperty data from an XmlNode. Function expects
-		 * specific RDFProperty information available.
-		 *
-		 * Inputs: node - the XmlNode to extract RDFProperty data
-		 *
-		 * Return values: the RDFProperty instance containing the node data
-		 */
-		private RDFProperty GetNodeData( XmlNode node )
-		{
-			// Go up to parent node
-			XmlNode propertyNode = node.ParentNode;
-			RDFProperty data = new RDFProperty();
-
-			// Set name
-			data.Name = propertyNode.Attributes[DAMLConstants.RDF_ID].Value;
-			// Set Domain
-			data.Domain = propertyNode.SelectSingleNode( DAMLConstants.RDFS_DOMAIN, m_mgr ).Attributes[DAMLConstants.RDF_RESOURCE].Value;
-			// Set Range
-			data.Range = propertyNode.SelectSingleNode( DAMLConstants.RDFS_RANGE, m_mgr ).Attributes[DAMLConstants.RDF_RESOURCE].Value;
-			// Set SubPropertyOf
-			data.SubPropertyOf = propertyNode.SelectSingleNode( DAMLConstants.RDFS_SUBPROPERTYOF, m_mgr ).Attributes[DAMLConstants.RDF_RESOURCE].Value;
-
-			// Fill in sameValueAs data (if any)
-			XmlNode sameValueAsNode = propertyNode.SelectSingleNode( DAMLConstants.DAML_SAMEVALUESAS, m_mgr );
-			if( sameValueAsNode != null )
-				data.SameValueAs = sameValueAsNode.Attributes[DAMLConstants.RDF_RESOURCE].Value;
-
-			return data;
-		}
-
-		/* Function retrieves the input restriction data given a process name and
-		 * a named input.
-		 *
-		 * Inputs: strProcessName - named process we are interested in
-		 *		   strInput - named input of the process
-		 */
-		private int GetInputRestrictions( string strProcessName, string strInput )
-		{
-			XmlNode root = m_doc.DocumentElement;
-
-			string strXPath = DAMLConstants.DAML_CLASS + "[@" + DAMLConstants.RDF_ID + "='" + strProcessName + "']" + "/" + DAMLConstants.RDFS_SUBCLASSOF + "/" + DAMLConstants.DAML_RESTRICTION + "/" + DAMLConstants.DAML_ON_PROPERTY + "[@" + DAMLConstants.RDF_RESOURCE + "='#" + strInput + "']";
-
-			XmlNode node = root.SelectSingleNode( strXPath, m_mgr );
-
-			if( node == null )
-				return 0;
-
-			XmlNode restrictionNode = node.ParentNode;
-			XmlNode cardinalityNode = restrictionNode.Attributes[DAMLConstants.DAML_CARDINALITY];
-			if( cardinalityNode == null )
-				return 0;
-			else return Int32.Parse( cardinalityNode.Value );
-		}
-
-		/* Private helper function used to extract URIs from our namespace
-		 * manager given a namespace prefix - even though the namespace manager is
-		 * *supposed* to be accessible like a hashtable (m_mgr[<prefixname>]) this
-		 * does not work, a for each construct is needed to iterate through all
-		 * entries in the namespace manager.
-		 *
-		 * Inputs: strNamespacePrefix - the namespace prefix we want to find the
-		 *								base Uri of
-		 *
-		 * Return values: the Basr Uri of the namespace prefix
-		 */
-		private string GetNamespaceBaseUri( string strNamespacePrefix )
-		{
-			string strBaseUri = "";
-
-			foreach( string prefix in m_mgr )
-			{
-				if( prefix == strNamespacePrefix )
-				{
-					strBaseUri = m_mgr.LookupNamespace( prefix );
-					break;
-				}
-			}
-
-			return strBaseUri;
-		}
-
-		/* Function returns the sub task type of a named process
-		 *
-		 * Inputs: strProcessName - named process
-		 *
-		 * Return values: the type of the named process' subtasks
-		 *				  sequence, choice etc.
-		 */
-		private enuProcessSubTaskType GetProcessSubTaskType( string strProcessName )
-		{
-			XmlNode root = m_doc.DocumentElement;
-			string strBaseUri = GetNamespaceBaseUri( DAMLConstants.PROCESS_NS );
-
-			string strXPath = DAMLConstants.DAML_CLASS + "[@" + DAMLConstants.RDF_ID + "='" + strProcessName + "']" + "/" + DAMLConstants.RDFS_SUBCLASSOF + "[@" + DAMLConstants.RDF_RESOURCE + "='" + strBaseUri + DAMLConstants.DAML_COMPOSITE_PROCESS + "']" + "/" + "following-sibling::" + DAMLConstants.RDFS_SUBCLASSOF;
-			XmlNode SubClassOfNode = root.SelectSingleNode( strXPath, m_mgr );
-
-			if( SubClassOfNode == null )
-				throw new Exception( "Complex process " + strProcessName + " data not found" );
-
-			// Get process:<type>
-			strXPath = ".//" + DAMLConstants.DAML_CLASS + "[@" + DAMLConstants.RDF_ABOUT + "]";
-			XmlNode dataNode = SubClassOfNode.SelectSingleNode( strXPath, m_mgr );
-
-			if( dataNode == null )
-				throw new Exception( "No process:<type> data provided for complex process " + strProcessName + " document is invalid" );
-
-			if( dataNode.Attributes[DAMLConstants.RDF_ABOUT].Value == DAMLConstants.PROCESS_CHOICE )
-				return enuProcessSubTaskType.Choice;
-			else return enuProcessSubTaskType.Sequence;
-		}
-
-		/* Function returns all the sub processes of a named process
-		 *
-		 * Inputs: strProcessName - named process
-		 *
-		 * Return values: an array of its sub processes
-		 */
-		private DAMLProcess[] GetSubProcesses( string strProcessName )
-		{
-			ArrayList lstSubProcesses = new ArrayList();
-
-			try
-			{
-				XmlNode root = m_doc.DocumentElement;
-				string strBaseUri = GetNamespaceBaseUri( DAMLConstants.PROCESS_NS );
-
-				string strXPath = DAMLConstants.DAML_CLASS + "[@" + DAMLConstants.RDF_ID + "='" + strProcessName + "']" + "/" + DAMLConstants.RDFS_SUBCLASSOF + "[@" + DAMLConstants.RDF_RESOURCE + "='" + strBaseUri + DAMLConstants.DAML_COMPOSITE_PROCESS + "']" + "/" + "following-sibling::" + DAMLConstants.RDFS_SUBCLASSOF;
-				XmlNode SubClassOfNode = root.SelectSingleNode( strXPath, m_mgr );
-
-				if( SubClassOfNode == null )
-					return (DAMLProcess[]) lstSubProcesses.ToArray( typeof(DAMLProcess) );
-
-				// Use fuzzy paths from here -> "//" operator looking for any matching
-				// child node - more expensive but intermediate nodes are not
-				// interesting/contain no info we can use
-
-				strXPath = ".//" + DAMLConstants.DAML_LIST_OF_INSTANCES_OF + "/" + DAMLConstants.DAML_CLASS;
-				XmlNodeList lstInstances = SubClassOfNode.SelectNodes( strXPath, m_mgr );
-
-				foreach( XmlNode node in lstInstances )
-				{
-					string strProcess = node.Attributes[DAMLConstants.RDF_ABOUT].Value;
-					strProcess = strProcess.Trim( new Char[] { '#' } );
-					enuProcessType processType = GetProcessType( strProcess );
-					DAMLProcess process = GetProcessData( strProcess, processType );
-					lstSubProcesses.Add( process );
-				}
-			}
-			catch( Exception e )
-			{
-				m_EvtLog.WriteEntry( e.Message, EventLogEntryType.Error );
-			}
-			return (DAMLProcess[]) lstSubProcesses.ToArray( typeof(DAMLProcess) );
-		}
-
-		/* Function returns the process type of a named process
-		 *
-		 * Inputs: strProcessName - named process
-		 *
-		 * Return values: the type of the named process (atomic, simple, composite)
-		 */
-		private enuProcessType GetProcessType( string strProcessName )
-		{
-			// process may be atomic, simple or complex
-			string strBaseUri = GetNamespaceBaseUri( DAMLConstants.PROCESS_NS );
-			XmlNode root = m_doc.DocumentElement;
-
-			string strXPathAtomicProcess = DAMLConstants.DAML_CLASS + "[@" + DAMLConstants.RDF_ID + "='" + strProcessName + "']" + "/" + DAMLConstants.RDFS_SUBCLASSOF + "[@" + DAMLConstants.RDF_RESOURCE + "='" + strBaseUri + DAMLConstants.DAML_ATOMIC_PROCESS + "']";
-			string strXPathSimpleProcess = DAMLConstants.DAML_CLASS + "[@" + DAMLConstants.RDF_ID + "='" + strProcessName + "']" + "/" + DAMLConstants.RDFS_SUBCLASSOF + "[@" + DAMLConstants.RDF_RESOURCE + "='" + strBaseUri + DAMLConstants.DAML_SIMPLE_PROCESS + "']";
-			string strXPathCompositeProcess = DAMLConstants.DAML_CLASS + "[@" + DAMLConstants.RDF_ID + "='" + strProcessName + "']" + "/" + DAMLConstants.RDFS_SUBCLASSOF + "[@" + DAMLConstants.RDF_RESOURCE + "='" + strBaseUri + DAMLConstants.DAML_COMPOSITE_PROCESS + "']";
-
-			XmlNode resultNode = root.SelectSingleNode( strXPathAtomicProcess, m_mgr );
-			if( resultNode != null )
-				return enuProcessType.AtomicProcess;
-
-			resultNode = root.SelectSingleNode( strXPathSimpleProcess, m_mgr );
-			if( resultNode != null )
-				return enuProcessType.SimpleProcess;
-
-			resultNode = root.SelectSingleNode( strXPathCompositeProcess, m_mgr );
-			if( resultNode != null )
-				return enuProcessType.CompositeProcess;
-
-			throw new Exception( "Process " + strProcessName + " does not exist" );
-		}
-
-		/* Function returns all the names of processes of a given type.
-		 *
-		 * Inputs: processType - types of processes to retrieve
-		 *
-		 * Return values: an array of process names of a given type (atomic, simple,
-		 *				  composite)
-		 */
-		private string[] GetProcesses( enuProcessType processType )
-		{
-			ArrayList arrProcess = new ArrayList();
-
-			try
-			{
-				XmlNode root = m_doc.DocumentElement;
-				string strProcessURI = GetNamespaceBaseUri( DAMLConstants.PROCESS_NS );
-				string strProcessType = "";
-
-				switch( processType )
-				{
-					case enuProcessType.AtomicProcess: strProcessType = DAMLConstants.DAML_ATOMIC_PROCESS;
-													   break;
-
-					case enuProcessType.CompositeProcess: strProcessType = DAMLConstants.DAML_COMPOSITE_PROCESS;
-														break;
-
-					case enuProcessType.SimpleProcess: strProcessType = DAMLConstants.DAML_SIMPLE_PROCESS;
-													   break;
-				};
-
-				string strXPath = DAMLConstants.DAML_CLASS + "/" + DAMLConstants.RDFS_SUBCLASSOF + "[@" + DAMLConstants.RDF_RESOURCE + "='" + strProcessURI + strProcessType + "']";
-
-				XmlNodeList lstProcess = root.SelectNodes( strXPath, m_mgr );
-
-				foreach( XmlNode processNode in lstProcess )
-				{
-					// Move up to parent
-					XmlNode parentNode = processNode.ParentNode;
-
-					string strValue = parentNode.Attributes[DAMLConstants.RDF_ID].Value;
-
-					if( strValue.Length > 0 )
-						arrProcess.Add( strValue );
-
-				}
-			}
-			catch( Exception e )
-			{
-				m_EvtLog.WriteEntry( e.Message, EventLogEntryType.Error );
-			}
-
-			return (string[]) arrProcess.ToArray( typeof( System.String ) );
-		}
-	}
-}
diff --git a/csharpsrc/DAML/DAMLProcessModelReader.cs b/csharpsrc/DAML/DAMLProcessModelReader.cs
new file mode 100644
index 0000000..561511f
--- /dev/null
+++ b/csharpsrc/DAML/DAMLProcessModelReader.cs
@@ -0,0 +1,697 @@
+using System;
+using System.Xml;
+using System.Xml.XPath;
+using System.Collections;
+using System.Diagnostics;
+using System.Xml.Serialization;
+
+namespace PSL.DAML
+{
+	/// <summary>
+	/// Summary description for DAMLProcessModel.
+	/// </summary>
+	public sealed class DamlProcessModelReader:DamlContainer
+	{
+		public DamlProcessModelReader( string strDaml ):base( strDaml )
+		{
+		}
+
+
+		public string[] AtomicProcesses
+		{
+			get
+			{ return GetProcesses( enuProcessType.AtomicProcess ); }
+		}
+
+		public string[] CompositeProcesses
+		{
+			get
+			{ return GetProcesses( enuProcessType.CompositeProcess ); }
+		}
+
+		public string[] SimpleProcesses
+		{
+			get
+			{ return GetProcesses( enuProcessType.SimpleProcess ); }
+		}
+
+		public string[] AllProcesses
+		{
+			get
+			{
+				ArrayList arrProcesses = new ArrayList();
+
+				string[] arrAtomic = AtomicProcesses;
+				string[] arrComposite = CompositeProcesses;
+				string[] arrSimple = SimpleProcesses;
+
+				// Add all to our collection
+				arrProcesses.AddRange( arrAtomic );
+				arrProcesses.AddRange( arrComposite );
+				arrProcesses.AddRange( arrSimple );
+
+				return (string[]) arrProcesses.ToArray( typeof( System.String ) );
+			}
+		}
+
+		private DamlTypeDefinition[] FindTypeDefinitions( RdfProperty data )
+		{
+			ArrayList lstDefinitions = new ArrayList();
+
+			if( !data.Range.ToLower().StartsWith( "http://" ) )
+			{
+				DamlTypeDefinition defnRdf = this.FindTypeDefintionInRdfProperty( data.Range.TrimStart( new char[] { '#' } ) );
+				if( defnRdf != null )
+					lstDefinitions.Add( defnRdf );
+
+				DamlTypeDefinition defnClass = this.FindTypeDefinitionInDamlClass( data.Range.TrimStart( new char[] { '#' } ) );
+				if( defnClass != null )
+					lstDefinitions.Add( defnClass );
+			}
+
+			if( !data.SameValueAs.ToLower().StartsWith( "http://" ) )
+			{
+				DamlTypeDefinition defnRdf = this.FindTypeDefintionInRdfProperty( data.SameValueAs.TrimStart( new char[] { '#' } ) );
+				if( defnRdf != null )
+					lstDefinitions.Add( defnRdf );
+
+				DamlTypeDefinition defnClass = this.FindTypeDefinitionInDamlClass( data.SameValueAs.TrimStart( new char[] { '#' } ) );
+				if( defnClass != null )
+					lstDefinitions.Add( defnClass );
+			}
+
+			return (DamlTypeDefinition[]) lstDefinitions.ToArray( typeof(DamlTypeDefinition) );
+		}
+
+		private DamlTypeDefinition FindTypeDefintionInRdfProperty( string strTypeName )
+		{
+			DamlTypeDefinition definition = null;
+			try
+			{
+				// A type defition could be in an rdf:Property or a damlClass
+				XmlNode root = this.m_doc.DocumentElement;
+
+				// Search for a matching rdf:Property
+				string strXPath = DamlConstants.RDF_PROPERTY + "[@" + DamlConstants.RDF_ID + "='" + strTypeName.TrimStart( new char[] { '#' } )  + "'" + "]";
+
+				XmlNode typeDefinitionNode = root.SelectSingleNode( strXPath, m_mgr );
+
+				if( typeDefinitionNode == null )
+					return null;
+
+				definition = this.GetNodeData( typeDefinitionNode );
+			}
+			catch( Exception e )
+			{
+				throw new Exception( e.Message );
+			}
+
+			return definition;
+		}
+
+		private DamlTypeDefinition FindTypeDefinitionInDamlClass( string strTypeName )
+		{
+			DamlTypeDefinition definition = null;
+			try
+			{
+				XmlNode root = this.m_doc.DocumentElement;
+
+				string strXPath = DamlConstants.DAML_CLASS + "[@" + DamlConstants.RDF_ID + "='" + strTypeName + "'" + "]";
+				XmlNode typeDefinitionNode = root.SelectSingleNode( strXPath, m_mgr  );
+				if( typeDefinitionNode == null )
+					return null;
+
+				definition = this.GetDamlClassTypeData( typeDefinitionNode );
+			}
+			catch( Exception e )
+			{
+				throw new Exception( e.Message );
+			}
+
+			return definition;
+		}
+
+
+		private DamlTypeDefinition GetDamlClassTypeData( XmlNode typeDefinitionNode )
+		{
+			if( typeDefinitionNode == null )
+				throw new ArgumentNullException( "typeDefinitionNode", "Cannot be null" );
+
+			DamlTypeDefinition definition = null;
+
+			// Get the first child of this node, this will determine the "type" we actually have
+			XmlNode typeDescriptionNode = typeDefinitionNode.FirstChild;
+
+			if( typeDescriptionNode == null )
+				throw new Exception( "Invalid/Unexpected typeDefinitionNode passed" );
+
+			switch( typeDescriptionNode.Name )
+			{
+				case DamlConstants.DAML_ONE_OF:
+				{
+					DamlOneOf oneOf = new DamlOneOf();
+
+					// Get attribute on description node, set the type name
+					oneOf.Name = typeDefinitionNode.Attributes[DamlConstants.RDF_ID].Value;
+					// Get the parseType on the description node
+					string strParseType = typeDescriptionNode.Attributes[DamlConstants.RDF_PARSE_TYPE].Value;
+
+					if( strParseType != DamlConstants.DAML_COLLECTION )
+						throw new Exception( "Unexpected parse type on daml:Class node's first child" );
+					else oneOf.ParseType = enuRdfParseType.damlCollection;
+
+					XmlNodeList lstOptions = typeDescriptionNode.ChildNodes;
+					foreach( XmlNode optionNode in lstOptions )
+					{
+						oneOf.AddOption( optionNode.Attributes[DamlConstants.RDF_ID].Value );
+					}
+
+					definition = oneOf;
+				}
+				break;
+				case DamlConstants.DAML_UNION_OF:
+				{
+					DamlUnionOf unionOf = new DamlUnionOf();
+
+					// Get attribute on description node, set the type name
+					unionOf.Name = typeDefinitionNode.Attributes[DamlConstants.RDF_ID].Value;
+					// Get the parseType on the description node
+					string strParseType = typeDescriptionNode.Attributes[DamlConstants.RDF_PARSE_TYPE].Value;
+
+					if( strParseType != DamlConstants.DAML_COLLECTION )
+						throw new Exception( "Unexpected parse type on daml:Class node's first child" );
+					else unionOf.ParseType = enuRdfParseType.damlCollection;
+
+					XmlNodeList lstOptions = typeDescriptionNode.ChildNodes;
+					foreach( XmlNode optionNode in lstOptions )
+					{
+						XmlAttribute att = optionNode.Attributes[DamlConstants.RDF_ABOUT];
+						unionOf.AddOption( att.Value );
+					}
+
+					definition = unionOf;
+				}
+				break;
+				case DamlConstants.RDFS_SUBCLASSOF:
+				{
+					RdfsSubClassOf subClassOf = new RdfsSubClassOf();
+
+					subClassOf.Name = typeDefinitionNode.Attributes[DamlConstants.RDF_ID].Value;
+					subClassOf.Value = typeDescriptionNode.Attributes[DamlConstants.RDF_RESOURCE].Value;
+
+					definition = subClassOf;
+				}
+				break;
+
+				default: throw new Exception( "Unexpected node. Cannot get daml:Class type data." );
+			}
+
+			return definition;
+		}
+
+
+		/* Function retrieves all the interesting data about a process given its name and
+		 * type.
+		 *
+		 * Interesting data:
+		 * Inputs, Outputs, Preconditions, Effects, Parameters, ConditionalOutputs,
+		 * Co-Conditions, Sub Processes (if process is a composite process)
+		 *
+		 * Inputs: strProcessName - named process
+		 *		   processType - process type (atomic, simple, composite)
+		 *
+		 * Return value: DamlProcess containing all the relevant data
+		 */
+		public DamlProcess GetProcessData( string strProcessName, enuProcessType processType )
+		{
+			DamlProcess retVal = new DamlProcess();
+
+			XmlNode root = m_doc.DocumentElement;
+			string strBaseUri = GetNamespaceBaseUri( DamlConstants.PROCESS_NS );
+			string strUri = "";
+			strUri = strBaseUri;
+
+			switch( processType )
+			{
+				case enuProcessType.AtomicProcess: strUri += DamlConstants.DAML_ATOMIC_PROCESS;
+					break;
+				case enuProcessType.CompositeProcess: strUri += DamlConstants.DAML_COMPOSITE_PROCESS;
+					break;
+				case enuProcessType.SimpleProcess: strUri += DamlConstants.DAML_SIMPLE_PROCESS;
+					break;
+				default:  throw new ArgumentException( "Invalid processType value" );
+			};
+
+			string strXPath = DamlConstants.DAML_CLASS + "[@" + DamlConstants.RDF_ID + "='" + strProcessName + "']" + "/" + DamlConstants.RDFS_SUBCLASSOF + "[@" + DamlConstants.RDF_RESOURCE + "='" + strUri + "']";
+
+			XmlNode processNode = root.SelectSingleNode( strXPath, m_mgr ).ParentNode;
+
+			if( processNode == null )
+				throw new Exception( "Process node found" );
+
+			// Set process name
+			retVal.Name = processNode.Attributes[DamlConstants.RDF_ID].Value;
+			// Set process type
+			retVal.ProcessType = processType;
+
+			// Get Process restrictions - these are actually input restrictions on
+			// the process
+			DamlRestriction[] arrProcessRestrict = this.GetRestrictions( strProcessName );
+			retVal.AddRestriction( enuIOPEType.Input, arrProcessRestrict );
+
+			// Get inputs from querying RdfProperty nodes in document
+			strXPath = DamlConstants.RDF_PROPERTY + "/" + DamlConstants.RDFS_SUBPROPERTYOF + "[@" +  DamlConstants.RDF_RESOURCE + "='" + strBaseUri + DamlConstants.INPUT + "']" + "/" + "following-sibling::" + DamlConstants.RDFS_DOMAIN + "[@" + DamlConstants.RDF_RESOURCE + "='#" + strProcessName + "']";
+			XmlNodeList lstNodes = root.SelectNodes( strXPath, m_mgr );
+
+			foreach( XmlNode node in lstNodes )
+			{
+				RdfProperty data = GetNodeData( node.ParentNode );
+				retVal.AddInput( data );
+
+				// Get restrictions (if any)
+				enuIOPEType restrictionType = enuIOPEType.Input;
+				DamlRestriction[] arrRestrict = this.GetRestrictions( data.Name );
+				retVal.AddRestriction( restrictionType, arrRestrict );
+				retVal.AddDataTypeDefinition( this.FindTypeDefinitions( data ) );
+			}
+
+			// Get additional inputs from the process node itself
+			// they may be hidden under restictions tagged with
+			// daml:sameValueAs
+			strXPath =  DamlConstants.DAML_CLASS + "[@" + DamlConstants.RDF_ID + "='" + retVal.Name + "']" + "/" + DamlConstants.RDFS_SUBCLASSOF + "/" + DamlConstants.DAML_RESTRICTION + "/" + DamlConstants.DAML_ON_PROPERTY + "[@" + DamlConstants.RDF_RESOURCE + "='" + strBaseUri + DamlConstants.INPUT + "']" + "/" + "following-sibling::" + DamlConstants.DAML_SAMEVALUESAS;
+			lstNodes = root.SelectNodes( strXPath, m_mgr );
+
+			foreach( XmlNode node in lstNodes )
+			{
+				string strSameValueAs = node.Attributes[DamlConstants.RDF_RESOURCE].Value;
+				strSameValueAs = strSameValueAs.Trim( new char[] {'#'} );
+
+				// Go get RdfProperty data
+				strXPath = DamlConstants.RDF_PROPERTY + "[@" + DamlConstants.RDF_ID + "='" + strSameValueAs + "']" + "/" + DamlConstants.RDFS_DOMAIN;
+				XmlNode domainNode = root.SelectSingleNode( strXPath, m_mgr );
+
+				// Add to list of inputs
+				if( domainNode != null )
+				{
+					RdfProperty data = GetNodeData( domainNode.ParentNode );
+					retVal.AddInput( data );
+
+					// Get restrictions (if any)
+					enuIOPEType restrictionType = enuIOPEType.Input;
+					DamlRestriction[] arrRestrict = this.GetRestrictions( data.Name );
+					retVal.AddRestriction( restrictionType, arrRestrict );
+					retVal.AddDataTypeDefinition( this.FindTypeDefinitions( data ) );
+				}
+			}
+
+			// Get outputs
+			strXPath = DamlConstants.RDF_PROPERTY + "/" + DamlConstants.RDFS_SUBPROPERTYOF + "[@" +  DamlConstants.RDF_RESOURCE + "='" + strBaseUri + DamlConstants.OUTPUT + "']" + "/" + "following-sibling::" + DamlConstants.RDFS_DOMAIN + "[@" + DamlConstants.RDF_RESOURCE + "='#" + strProcessName + "']";
+			lstNodes = root.SelectNodes( strXPath, m_mgr );
+
+			foreach( XmlNode node in lstNodes )
+			{
+				RdfProperty data = GetNodeData( node.ParentNode );
+				retVal.AddOutput( data );
+
+				// Get restrictions (if any)
+				enuIOPEType restrictionType = enuIOPEType.Output;
+				DamlRestriction[] arrRestrict = this.GetRestrictions( data.Name );
+				retVal.AddRestriction( restrictionType, arrRestrict );
+				retVal.AddDataTypeDefinition( this.FindTypeDefinitions( data ) );
+			}
+
+			// Get preconditions
+			strXPath = DamlConstants.RDF_PROPERTY + "/" + DamlConstants.RDFS_SUBPROPERTYOF + "[@" +  DamlConstants.RDF_RESOURCE + "='" + strBaseUri + DamlConstants.PRECONDITION + "']" + "/" + "following-sibling::" + DamlConstants.RDFS_DOMAIN + "[@" + DamlConstants.RDF_RESOURCE + "='#" + strProcessName + "']";
+			lstNodes = root.SelectNodes( strXPath, m_mgr );
+
+			foreach( XmlNode node in lstNodes )
+			{
+				RdfProperty data = GetNodeData( node.ParentNode );
+				retVal.AddPrecondition( data );
+
+				// Get restrictions (if any)
+				enuIOPEType restrictionType = enuIOPEType.Precondition;
+				DamlRestriction[] arrRestrict = this.GetRestrictions( data.Name );
+				retVal.AddRestriction( restrictionType, arrRestrict );
+				retVal.AddDataTypeDefinition( this.FindTypeDefinitions( data ) );
+			}
+
+			// Get effects
+			strXPath = DamlConstants.RDF_PROPERTY + "/" + DamlConstants.RDFS_SUBPROPERTYOF + "[@" +  DamlConstants.RDF_RESOURCE + "='" + strBaseUri + DamlConstants.EFFECT + "']" + "/" + "following-sibling::" + DamlConstants.RDFS_DOMAIN + "[@" + DamlConstants.RDF_RESOURCE + "='#" + strProcessName + "']";
+			lstNodes = root.SelectNodes( strXPath, m_mgr );
+
+			foreach( XmlNode node in lstNodes )
+			{
+				RdfProperty data = GetNodeData( node.ParentNode );
+				retVal.AddEffect( data );
+
+				// Get restrictions (if any)
+				enuIOPEType restrictionType = enuIOPEType.Effect;
+				DamlRestriction[] arrRestrict = this.GetRestrictions( data.Name );
+				retVal.AddRestriction( restrictionType, arrRestrict );
+				retVal.AddDataTypeDefinition( this.FindTypeDefinitions( data ) );
+			}
+
+			// Get conditional outputs
+			strXPath = DamlConstants.RDF_PROPERTY + "/" + DamlConstants.RDFS_SUBPROPERTYOF + "[@" +  DamlConstants.RDF_RESOURCE + "='" + strBaseUri + DamlConstants.CONDITIONAL_OUTPUT + "']" + "/" + "following-sibling::" + DamlConstants.RDFS_DOMAIN + "[@" + DamlConstants.RDF_RESOURCE + "='#" + strProcessName + "']";
+			lstNodes = root.SelectNodes( strXPath, m_mgr );
+
+			foreach( XmlNode node in lstNodes )
+			{
+				RdfProperty data = GetNodeData( node.ParentNode );
+				retVal.AddConditionalOutput( data );
+
+				// Get restrictions (if any)
+				enuIOPEType restrictionType = enuIOPEType.ConditionalOutput;
+				DamlRestriction[] arrRestrict = this.GetRestrictions( data.Name );
+				retVal.AddRestriction( restrictionType, arrRestrict );
+				retVal.AddDataTypeDefinition( this.FindTypeDefinitions( data ) );
+			}
+
+			// Get co-conditions
+			strXPath = DamlConstants.RDF_PROPERTY + "/" + DamlConstants.RDFS_SUBPROPERTYOF + "[@" +  DamlConstants.RDF_RESOURCE + "='" + strBaseUri + DamlConstants.CO_CONDITION + "']" + "/" + "following-sibling::" + DamlConstants.RDFS_DOMAIN + "[@" + DamlConstants.RDF_RESOURCE + "='#" + strProcessName + "']";
+			lstNodes = root.SelectNodes( strXPath, m_mgr );
+
+			foreach( XmlNode node in lstNodes )
+			{
+				RdfProperty data = GetNodeData( node.ParentNode );
+				retVal.AddCoCondition( data );
+
+				// Get restrictions (if any)
+				enuIOPEType restrictionType = enuIOPEType.CoCondition;
+				DamlRestriction[] arrRestrict = this.GetRestrictions( data.Name );
+				retVal.AddRestriction( restrictionType, arrRestrict );
+				retVal.AddDataTypeDefinition( this.FindTypeDefinitions( data ) );
+			}
+
+			// Get co-outputs
+			strXPath = DamlConstants.RDF_PROPERTY + "/" + DamlConstants.RDFS_SUBPROPERTYOF + "[@" +  DamlConstants.RDF_RESOURCE + "='" + strBaseUri + DamlConstants.CO_OUTPUT + "']" + "/" + "following-sibling::" + DamlConstants.RDFS_DOMAIN + "[@" + DamlConstants.RDF_RESOURCE + "='#" + strProcessName + "']";
+			lstNodes = root.SelectNodes( strXPath, m_mgr );
+
+			foreach( XmlNode node in lstNodes )
+			{
+				RdfProperty data = GetNodeData( node.ParentNode );
+				retVal.AddCoOutput( data );
+
+				// Get restrictions (if any)
+				enuIOPEType restrictionType = enuIOPEType.CoOutput;
+				DamlRestriction[] arrRestrict = this.GetRestrictions( data.Name );
+				retVal.AddRestriction( restrictionType, arrRestrict );
+				retVal.AddDataTypeDefinition( this.FindTypeDefinitions( data ) );
+			}
+
+			// Get parameters
+			strXPath = DamlConstants.RDF_PROPERTY + "/" + DamlConstants.RDFS_SUBPROPERTYOF + "[@" +  DamlConstants.RDF_RESOURCE + "='" + strBaseUri + DamlConstants.PARAMETER + "']" + "/" + "following-sibling::" + DamlConstants.RDFS_DOMAIN + "[@" + DamlConstants.RDF_RESOURCE + "='#" + strProcessName + "']";
+			lstNodes = root.SelectNodes( strXPath, m_mgr );
+
+			foreach( XmlNode node in lstNodes )
+			{
+				RdfProperty data = GetNodeData( node.ParentNode );
+				retVal.AddParameter( data );
+
+				// Get restrictions (if any)
+				enuIOPEType restrictionType = enuIOPEType.Parameter;
+				DamlRestriction[] arrRestrict = this.GetRestrictions( data.Name );
+				retVal.AddRestriction( restrictionType, arrRestrict );
+				retVal.AddDataTypeDefinition( this.FindTypeDefinitions( data ) );
+			}
+
+			// If we are dealing with a complex process we must go get
+			// the substeps - need to get process:<type> data
+			if( processType == enuProcessType.CompositeProcess )
+			{
+				retVal.SubTaskType = GetProcessSubTaskType( retVal.Name );
+				retVal.AddSubProcess( GetSubProcesses( retVal.Name ) );
+			}
+			return retVal;
+		}
+
+        /* Function extracts the RdfProperty data from an XmlNode. Function expects
+		 * specific RdfProperty information available.
+		 *
+		 * Inputs: node - the XmlNode to extract RdfProperty data
+		 *
+		 * Return values: the RdfProperty instance containing the node data
+		 */
+		private RdfProperty GetNodeData( XmlNode propertyNode )
+		{
+			if( propertyNode == null )
+				throw new ArgumentNullException( "propertyNode", "Cannot be null" );
+
+			RdfProperty data = new RdfProperty();
+
+			// Set name
+			data.Name = propertyNode.Attributes[DamlConstants.RDF_ID].Value;
+			// Set Domain
+			data.Domain = propertyNode.SelectSingleNode( DamlConstants.RDFS_DOMAIN, m_mgr ).Attributes[DamlConstants.RDF_RESOURCE].Value;
+			// Set Range
+			data.Range = propertyNode.SelectSingleNode( DamlConstants.RDFS_RANGE, m_mgr ).Attributes[DamlConstants.RDF_RESOURCE].Value;
+			// Set SubPropertyOf
+			data.SubPropertyOf = propertyNode.SelectSingleNode( DamlConstants.RDFS_SUBPROPERTYOF, m_mgr ).Attributes[DamlConstants.RDF_RESOURCE].Value;
+
+			// Fill in sameValueAs data (if any)
+			XmlNode sameValueAsNode = propertyNode.SelectSingleNode( DamlConstants.DAML_SAMEVALUESAS, m_mgr );
+			if( sameValueAsNode != null )
+				data.SameValueAs = sameValueAsNode.Attributes[DamlConstants.RDF_RESOURCE].Value;
+
+			return data;
+		}
+
+		private DamlRestriction[] GetRestrictions( string strOwnerName )
+		{
+			ArrayList lstRestrictions = new ArrayList();
+
+			XmlNode root = m_doc.DocumentElement;
+
+			string strXPath = DamlConstants.DAML_CLASS + "[@" + DamlConstants.RDF_ID + "='" + strOwnerName + "']" + "/" + DamlConstants.RDFS_SUBCLASSOF + "/" + DamlConstants.DAML_RESTRICTION;
+
+			XmlNodeList lstNodes = root.SelectNodes( strXPath, m_mgr );
+
+			if( lstNodes.Count == 0 )
+				return (DamlRestriction[]) lstRestrictions.ToArray( typeof(DamlRestriction) );
+
+			foreach( XmlNode restrictionNode in lstNodes )
+			{
+				// Create a daml restriction
+				DamlRestriction res = GetRestrictionNodeData( restrictionNode );
+
+				res.Owner = strOwnerName;
+				// Add it to our list of restrictions
+				lstRestrictions.Add( res );
+			}
+
+			return (DamlRestriction[]) lstRestrictions.ToArray( typeof(DamlRestriction) );
+		}
+
+		private DamlRestriction GetRestrictionNodeData( XmlNode restrictionNode )
+		{
+			if( restrictionNode == null )
+				throw new ArgumentNullException( "restriction", "Node cannnot be null" );
+
+			DamlRestriction res = new DamlRestriction();
+
+			// Restriction nodes may specify a cardinality
+			if( restrictionNode.Attributes.Count > 0 )
+			{
+				XmlAttribute cardinalityAtt = restrictionNode.Attributes[DamlConstants.DAML_CARDINALITY];
+				if( cardinalityAtt != null )
+					res.Cardinality = int.Parse( cardinalityAtt.Value );
+			}
+
+			// Find the property which this restriction applies to
+			XmlNode onPropertyNode = restrictionNode.SelectSingleNode( DamlConstants.DAML_ON_PROPERTY, m_mgr );
+
+			if( onPropertyNode != null )
+				res.OnProperty = onPropertyNode.Attributes[DamlConstants.RDF_RESOURCE].Value;
+
+			XmlNode hasValueNode = restrictionNode.SelectSingleNode( DamlConstants.DAML_HAS_VALUE, m_mgr );
+			if( hasValueNode != null )
+				res.HasValue = hasValueNode.Attributes[DamlConstants.RDF_ID].Value;
+
+			return res;
+		}
+
+
+		/* Private helper function used to extract URIs from our namespace
+		 * manager given a namespace prefix - even though the namespace manager is
+		 * *supposed* to be accessible like a hashtable (m_mgr[<prefixname>]) this
+		 * does not work, a for each construct is needed to iterate through all
+		 * entries in the namespace manager.
+		 *
+		 * Inputs: strNamespacePrefix - the namespace prefix we want to find the
+		 *								base Uri of
+		 *
+		 * Return values: the Basr Uri of the namespace prefix
+		 */
+		private string GetNamespaceBaseUri( string strNamespacePrefix )
+		{
+			string strBaseUri = "";
+
+			foreach( string prefix in m_mgr )
+			{
+				if( prefix == strNamespacePrefix )
+				{
+					strBaseUri = m_mgr.LookupNamespace( prefix );
+					break;
+				}
+			}
+
+			return strBaseUri;
+		}
+
+		/* Function returns the sub task type of a named process
+		 *
+		 * Inputs: strProcessName - named process
+		 *
+		 * Return values: the type of the named process' subtasks
+		 *				  sequence, choice etc.
+		 */
+		private enuProcessSubTaskType GetProcessSubTaskType( string strProcessName )
+		{
+			XmlNode root = m_doc.DocumentElement;
+			string strBaseUri = GetNamespaceBaseUri( DamlConstants.PROCESS_NS );
+
+			string strXPath = DamlConstants.DAML_CLASS + "[@" + DamlConstants.RDF_ID + "='" + strProcessName + "']" + "/" + DamlConstants.RDFS_SUBCLASSOF + "[@" + DamlConstants.RDF_RESOURCE + "='" + strBaseUri + DamlConstants.DAML_COMPOSITE_PROCESS + "']" + "/" + "following-sibling::" + DamlConstants.RDFS_SUBCLASSOF;
+			XmlNode SubClassOfNode = root.SelectSingleNode( strXPath, m_mgr );
+
+			if( SubClassOfNode == null )
+				throw new Exception( "Complex process " + strProcessName + " data not found" );
+
+			// Get process:<type>
+			strXPath = ".//" + DamlConstants.DAML_CLASS + "[@" + DamlConstants.RDF_ABOUT + "]";
+			XmlNode dataNode = SubClassOfNode.SelectSingleNode( strXPath, m_mgr );
+
+			if( dataNode == null )
+				throw new Exception( "No process:<type> data provided for complex process " + strProcessName + " document is invalid" );
+
+			if( dataNode.Attributes[DamlConstants.RDF_ABOUT].Value == DamlConstants.PROCESS_CHOICE )
+				return enuProcessSubTaskType.Choice;
+			else return enuProcessSubTaskType.Sequence;
+		}
+
+		/* Function returns all the sub processes of a named process
+		 *
+		 * Inputs: strProcessName - named process
+		 *
+		 * Return values: an array of its sub processes
+		 */
+		private DamlProcess[] GetSubProcesses( string strProcessName )
+		{
+			ArrayList lstSubProcesses = new ArrayList();
+
+			try
+			{
+				XmlNode root = m_doc.DocumentElement;
+				string strBaseUri = GetNamespaceBaseUri( DamlConstants.PROCESS_NS );
+
+				string strXPath = DamlConstants.DAML_CLASS + "[@" + DamlConstants.RDF_ID + "='" + strProcessName + "']" + "/" + DamlConstants.RDFS_SUBCLASSOF + "[@" + DamlConstants.RDF_RESOURCE + "='" + strBaseUri + DamlConstants.DAML_COMPOSITE_PROCESS + "']" + "/" + "following-sibling::" + DamlConstants.RDFS_SUBCLASSOF;
+				XmlNode SubClassOfNode = root.SelectSingleNode( strXPath, m_mgr );
+
+				if( SubClassOfNode == null )
+					return (DamlProcess[]) lstSubProcesses.ToArray( typeof(DamlProcess) );
+
+				// Use fuzzy paths from here -> "//" operator looking for any matching
+				// child node - more expensive but intermediate nodes are not
+				// interesting/contain no info we can use
+
+				strXPath = ".//" + DamlConstants.DAML_LIST_OF_INSTANCES_OF + "/" + DamlConstants.DAML_CLASS;
+				XmlNodeList lstInstances = SubClassOfNode.SelectNodes( strXPath, m_mgr );
+
+				foreach( XmlNode node in lstInstances )
+				{
+					string strProcess = node.Attributes[DamlConstants.RDF_ABOUT].Value;
+					strProcess = strProcess.Trim( new Char[] { '#' } );
+					enuProcessType processType = GetProcessType( strProcess );
+					DamlProcess process = GetProcessData( strProcess, processType );
+					lstSubProcesses.Add( process );
+				}
+			}
+			catch( Exception /*e*/ )
+			{
+			}
+			return (DamlProcess[]) lstSubProcesses.ToArray( typeof(DamlProcess) );
+		}
+
+		/* Function returns the process type of a named process
+		 *
+		 * Inputs: strProcessName - named process
+		 *
+		 * Return values: the type of the named process (atomic, simple, composite)
+		 */
+		private enuProcessType GetProcessType( string strProcessName )
+		{
+			// process may be atomic, simple or complex
+			string strBaseUri = GetNamespaceBaseUri( DamlConstants.PROCESS_NS );
+			XmlNode root = m_doc.DocumentElement;
+
+			string strXPathAtomicProcess = DamlConstants.DAML_CLASS + "[@" + DamlConstants.RDF_ID + "='" + strProcessName + "']" + "/" + DamlConstants.RDFS_SUBCLASSOF + "[@" + DamlConstants.RDF_RESOURCE + "='" + strBaseUri + DamlConstants.DAML_ATOMIC_PROCESS + "']";
+			string strXPathSimpleProcess = DamlConstants.DAML_CLASS + "[@" + DamlConstants.RDF_ID + "='" + strProcessName + "']" + "/" + DamlConstants.RDFS_SUBCLASSOF + "[@" + DamlConstants.RDF_RESOURCE + "='" + strBaseUri + DamlConstants.DAML_SIMPLE_PROCESS + "']";
+			string strXPathCompositeProcess = DamlConstants.DAML_CLASS + "[@" + DamlConstants.RDF_ID + "='" + strProcessName + "']" + "/" + DamlConstants.RDFS_SUBCLASSOF + "[@" + DamlConstants.RDF_RESOURCE + "='" + strBaseUri + DamlConstants.DAML_COMPOSITE_PROCESS + "']";
+
+			XmlNode resultNode = root.SelectSingleNode( strXPathAtomicProcess, m_mgr );
+			if( resultNode != null )
+				return enuProcessType.AtomicProcess;
+
+			resultNode = root.SelectSingleNode( strXPathSimpleProcess, m_mgr );
+			if( resultNode != null )
+				return enuProcessType.SimpleProcess;
+
+			resultNode = root.SelectSingleNode( strXPathCompositeProcess, m_mgr );
+			if( resultNode != null )
+				return enuProcessType.CompositeProcess;
+
+			throw new Exception( "Process " + strProcessName + " does not exist" );
+		}
+
+		/* Function returns all the names of processes of a given type.
+		 *
+		 * Inputs: processType - types of processes to retrieve
+		 *
+		 * Return values: an array of process names of a given type (atomic, simple,
+		 *				  composite)
+		 */
+		private string[] GetProcesses( enuProcessType processType )
+		{
+			ArrayList arrProcess = new ArrayList();
+
+			try
+			{
+				XmlNode root = m_doc.DocumentElement;
+				string strProcessURI = GetNamespaceBaseUri( DamlConstants.PROCESS_NS );
+				string strProcessType = "";
+
+				switch( processType )
+				{
+					case enuProcessType.AtomicProcess: strProcessType = DamlConstants.DAML_ATOMIC_PROCESS;
+													   break;
+
+					case enuProcessType.CompositeProcess: strProcessType = DamlConstants.DAML_COMPOSITE_PROCESS;
+														break;
+
+					case enuProcessType.SimpleProcess: strProcessType = DamlConstants.DAML_SIMPLE_PROCESS;
+													   break;
+				};
+
+				string strXPath = DamlConstants.DAML_CLASS + "/" + DamlConstants.RDFS_SUBCLASSOF + "[@" + DamlConstants.RDF_RESOURCE + "='" + strProcessURI + strProcessType + "']";
+
+				XmlNodeList lstProcess = root.SelectNodes( strXPath, m_mgr );
+
+				foreach( XmlNode processNode in lstProcess )
+				{
+					// Move up to parent
+					XmlNode parentNode = processNode.ParentNode;
+
+					string strValue = parentNode.Attributes[DamlConstants.RDF_ID].Value;
+
+					if( strValue.Length > 0 )
+						arrProcess.Add( strValue );
+				}
+			}
+			catch( Exception /*e*/ )
+			{
+			}
+
+			return (string[]) arrProcess.ToArray( typeof( System.String ) );
+		}
+	}
+}
diff --git a/csharpsrc/DAML/DAMLServiceProfile.cs b/csharpsrc/DAML/DAMLServiceProfile.cs
index 7bd90bc..eb6fd8b 100644
--- a/csharpsrc/DAML/DAMLServiceProfile.cs
+++ b/csharpsrc/DAML/DAMLServiceProfile.cs
@@ -27,7 +27,12 @@ namespace PSL.DAML
 			get
 			{ return m_strParamDesc; }
 			set
-			{ m_strParamDesc = value; }
+			{
+				if( value == null || value.Length == 0 )
+					return;
+
+				m_strParamDesc = value;
+			}
 		}

 		public string ParameterName
@@ -35,7 +40,12 @@ namespace PSL.DAML
 			get
 			{ return m_strParamName; }
 			set
-			{ m_strParamName = value; }
+			{
+				if( value == null || value.Length == 0 )
+					return;
+
+				m_strParamName = value;
+			}
 		}

 		public string RestrictedTo
@@ -43,7 +53,12 @@ namespace PSL.DAML
 			get
 			{ return m_strRestrictedTo; }
 			set
-			{ m_strRestrictedTo = value; }
+			{
+				if( value == null || value.Length == 0 )
+					return;
+
+				m_strRestrictedTo = value;
+			}
 		}

 		public string RefersTo
@@ -51,9 +66,13 @@ namespace PSL.DAML
 			get
 			{ return m_strRefersTo; }
 			set
-			{ m_strRefersTo = value; }
-		}
+			{
+				if( value == null || value.Length == 0 )
+					return;

+				m_strRefersTo = value;
+			}
+		}
 	}

 	public struct EPType
@@ -74,7 +93,12 @@ namespace PSL.DAML
 			get
 			{ return m_strConditionDesc; }
 			set
-			{ m_strConditionDesc = value; }
+			{
+				if( value == null || value.Length == 0 )
+					return;
+
+				m_strConditionDesc = value;
+			}
 		}

 		public string ConditionName
@@ -82,7 +106,12 @@ namespace PSL.DAML
 			get
 			{ return m_strConditionName; }
 			set
-			{ m_strConditionName = value; }
+			{
+				if( value == null || value.Length == 0 )
+					return;
+
+				m_strConditionName = value;
+			}
 		}

 		public string Statement
@@ -90,7 +119,12 @@ namespace PSL.DAML
 			get
 			{ return m_strStatement; }
 			set
-			{ m_strStatement = value; }
+			{
+				if( value == null || value.Length == 0 )
+					return;
+
+				m_strStatement = value;
+			}
 		}

 		public string RefersTo
@@ -98,32 +132,23 @@ namespace PSL.DAML
 			get
 			{ return m_strRefersTo; }
 			set
-			{ m_strRefersTo = value; }
+			{
+				if( value == null || value.Length == 0 )
+					return;
+
+				m_strRefersTo = value;
+			}
 		}
 	}

-	public enum enuIOPESearchBy
-	{
-		PARAM_DESC,
-		PARAM_NAME,
-		COND_DESC,
-		COND_NAME,
-		REFERS_TO
-	};
-
 	/// <summary>
 	/// Summary description for DAMLServiceProfile.
 	/// </summary>
-	public class DAMLServiceProfile:DAMLContainer
+	public sealed class DamlServiceProfile:DamlContainer
 	{
 		/* Constructor */
-		public DAMLServiceProfile()
+		public DamlServiceProfile( string strDaml ):base( strDaml )
 		{
-			// Init inherited members
-			m_EvtLog = new EventLog( "Application" );
-			m_EvtLog.Source = "DAMLServiceProfile";
-			m_doc = new XmlDocument();
-			m_mgr = null;
 		}

 		// Properties
@@ -267,7 +292,7 @@ namespace PSL.DAML
 			// Create Expression Builder instance
 			IIOPEXPathExprBuilder IBuilder = IOPEXPathExprBuilderFactory.CreateInstance( enuIOPEType.Input );
 			// Build XPath Expression
-			string strXPathExpr = DAMLConstants.SERVICE_PROFILE + IBuilder.BuildExpression( enuIOPESearchBy.PARAM_NAME, strName );
+			string strXPathExpr = DamlConstants.SERVICE_PROFILE + IBuilder.BuildExpression( enuIOPESearchBy.PARAM_NAME, strName );
 			XmlNode root = m_doc.DocumentElement;
 			XmlNode node = root.SelectSingleNode( strXPathExpr, m_mgr );
 			node = node.ParentNode;
@@ -288,7 +313,7 @@ namespace PSL.DAML
 			// Create Expression Builder instance
 			IIOPEXPathExprBuilder IBuilder = IOPEXPathExprBuilderFactory.CreateInstance( enuIOPEType.Input );
 			// Build XPath Expression
-			string strXPathExpr = DAMLConstants.SERVICE_PROFILE + IBuilder.BuildExpression( enuIOPESearchBy.PARAM_DESC, strDesc );
+			string strXPathExpr = DamlConstants.SERVICE_PROFILE + IBuilder.BuildExpression( enuIOPESearchBy.PARAM_DESC, strDesc );
 			XmlNode root = m_doc.DocumentElement;
 			XmlNode node = root.SelectSingleNode( strXPathExpr, m_mgr );

@@ -308,7 +333,7 @@ namespace PSL.DAML
 			// Create Expression Builder instance
 			IIOPEXPathExprBuilder IBuilder = IOPEXPathExprBuilderFactory.CreateInstance( enuIOPEType.Input );
 			// Build XPath Expression
-			string strXPathExpr = DAMLConstants.SERVICE_PROFILE + IBuilder.BuildExpression( enuIOPESearchBy.REFERS_TO, strRef );
+			string strXPathExpr = DamlConstants.SERVICE_PROFILE + IBuilder.BuildExpression( enuIOPESearchBy.REFERS_TO, strRef );
 			XmlNode root = m_doc.DocumentElement;
 			XmlNode node = root.SelectSingleNode( strXPathExpr, m_mgr );
 			node = node.ParentNode;
@@ -329,7 +354,7 @@ namespace PSL.DAML
 			// Create Expression Builder instance
 			IIOPEXPathExprBuilder IBuilder = IOPEXPathExprBuilderFactory.CreateInstance( enuIOPEType.Output );
 			// Build XPath Expression
-			string strXPathExpr = DAMLConstants.SERVICE_PROFILE + IBuilder.BuildExpression( enuIOPESearchBy.PARAM_NAME, strName );
+			string strXPathExpr = DamlConstants.SERVICE_PROFILE + IBuilder.BuildExpression( enuIOPESearchBy.PARAM_NAME, strName );
 			XmlNode root = m_doc.DocumentElement;
 			XmlNode node = root.SelectSingleNode( strXPathExpr, m_mgr );
 			node = node.ParentNode;
@@ -350,7 +375,7 @@ namespace PSL.DAML
 			// Create Expression Builder instance
 			IIOPEXPathExprBuilder IBuilder = IOPEXPathExprBuilderFactory.CreateInstance( enuIOPEType.Output );
 			// Build XPath Expression
-			string strXPathExpr = DAMLConstants.SERVICE_PROFILE + IBuilder.BuildExpression( enuIOPESearchBy.PARAM_DESC, strDesc );
+			string strXPathExpr = DamlConstants.SERVICE_PROFILE + IBuilder.BuildExpression( enuIOPESearchBy.PARAM_DESC, strDesc );
 			XmlNode root = m_doc.DocumentElement;
 			XmlNode node = root.SelectSingleNode( strXPathExpr, m_mgr );

@@ -370,7 +395,7 @@ namespace PSL.DAML
 			// Create Expression Builder instance
 			IIOPEXPathExprBuilder IBuilder = IOPEXPathExprBuilderFactory.CreateInstance( enuIOPEType.Output );
 			// Build XPath Expression
-			string strXPathExpr = DAMLConstants.SERVICE_PROFILE + IBuilder.BuildExpression( enuIOPESearchBy.REFERS_TO, strRef );
+			string strXPathExpr = DamlConstants.SERVICE_PROFILE + IBuilder.BuildExpression( enuIOPESearchBy.REFERS_TO, strRef );
 			XmlNode root = m_doc.DocumentElement;
 			XmlNode node = root.SelectSingleNode( strXPathExpr, m_mgr );
 			node = node.ParentNode;
@@ -391,7 +416,7 @@ namespace PSL.DAML
 			// Create Expression Builder instance
 			IIOPEXPathExprBuilder IBuilder = IOPEXPathExprBuilderFactory.CreateInstance( enuIOPEType.Precondition );
 			// Build XPath Expression
-			string strXPathExpr = DAMLConstants.SERVICE_PROFILE + IBuilder.BuildExpression( enuIOPESearchBy.COND_NAME, strName );
+			string strXPathExpr = DamlConstants.SERVICE_PROFILE + IBuilder.BuildExpression( enuIOPESearchBy.COND_NAME, strName );
 			XmlNode root = m_doc.DocumentElement;
 			XmlNode node = root.SelectSingleNode( strXPathExpr, m_mgr );
 			node = node.ParentNode;
@@ -412,7 +437,7 @@ namespace PSL.DAML
 			// Create Expression Builder instance
 			IIOPEXPathExprBuilder IBuilder = IOPEXPathExprBuilderFactory.CreateInstance( enuIOPEType.Precondition );
 			// Build XPath Expression
-			string strXPathExpr = DAMLConstants.SERVICE_PROFILE + IBuilder.BuildExpression( enuIOPESearchBy.COND_DESC, strDesc );
+			string strXPathExpr = DamlConstants.SERVICE_PROFILE + IBuilder.BuildExpression( enuIOPESearchBy.COND_DESC, strDesc );
 			XmlNode root = m_doc.DocumentElement;
 			XmlNode node = root.SelectSingleNode( strXPathExpr, m_mgr );

@@ -432,7 +457,7 @@ namespace PSL.DAML
 			// Create Expression Builder instance
 			IIOPEXPathExprBuilder IBuilder = IOPEXPathExprBuilderFactory.CreateInstance( enuIOPEType.Precondition );
 			// Build XPath Expression
-			string strXPathExpr = DAMLConstants.SERVICE_PROFILE + IBuilder.BuildExpression( enuIOPESearchBy.REFERS_TO, strRef );
+			string strXPathExpr = DamlConstants.SERVICE_PROFILE + IBuilder.BuildExpression( enuIOPESearchBy.REFERS_TO, strRef );
 			XmlNode root = m_doc.DocumentElement;
 			XmlNode node = root.SelectSingleNode( strXPathExpr, m_mgr );
 			node = node.ParentNode;
@@ -453,7 +478,7 @@ namespace PSL.DAML
 			// Create Expression Builder instance
 			IIOPEXPathExprBuilder IBuilder = IOPEXPathExprBuilderFactory.CreateInstance( enuIOPEType.Effect );
 			// Build XPath Expression
-			string strXPathExpr = DAMLConstants.SERVICE_PROFILE + IBuilder.BuildExpression( enuIOPESearchBy.COND_NAME, strName );
+			string strXPathExpr = DamlConstants.SERVICE_PROFILE + IBuilder.BuildExpression( enuIOPESearchBy.COND_NAME, strName );
 			XmlNode root = m_doc.DocumentElement;
 			XmlNode node = root.SelectSingleNode( strXPathExpr, m_mgr );
 			node = node.ParentNode;
@@ -474,7 +499,7 @@ namespace PSL.DAML
 			// Create Expression Builder instance
 			IIOPEXPathExprBuilder IBuilder = IOPEXPathExprBuilderFactory.CreateInstance( enuIOPEType.Effect );
 			// Build XPath Expression
-			string strXPathExpr = DAMLConstants.SERVICE_PROFILE + IBuilder.BuildExpression( enuIOPESearchBy.COND_DESC, strDesc );
+			string strXPathExpr = DamlConstants.SERVICE_PROFILE + IBuilder.BuildExpression( enuIOPESearchBy.COND_DESC, strDesc );
 			XmlNode root = m_doc.DocumentElement;
 			XmlNode node = root.SelectSingleNode( strXPathExpr, m_mgr );

@@ -494,7 +519,7 @@ namespace PSL.DAML
 			// Create Expression Builder instance
 			IIOPEXPathExprBuilder IBuilder = IOPEXPathExprBuilderFactory.CreateInstance( enuIOPEType.Effect );
 			// Build XPath Expression
-			string strXPathExpr = DAMLConstants.SERVICE_PROFILE + IBuilder.BuildExpression( enuIOPESearchBy.REFERS_TO, strRef );
+			string strXPathExpr = DamlConstants.SERVICE_PROFILE + IBuilder.BuildExpression( enuIOPESearchBy.REFERS_TO, strRef );
 			XmlNode root = m_doc.DocumentElement;
 			XmlNode node = root.SelectSingleNode( strXPathExpr, m_mgr );
 			node = node.ParentNode;
@@ -521,7 +546,7 @@ namespace PSL.DAML
 				// Create Expression Builder instance
 				IIOPEXPathExprBuilder IBuilder = IOPEXPathExprBuilderFactory.CreateInstance( enuIOPEType.Effect );
 				// Build XPath Expression
-				string strXPathExpr = DAMLConstants.SERVICE_PROFILE + IBuilder.BuildExpression( enuIOPESearchBy.COND_DESC );
+				string strXPathExpr = DamlConstants.SERVICE_PROFILE + IBuilder.BuildExpression( enuIOPESearchBy.COND_DESC );

 				XmlNodeList nodeList = root.SelectNodes( strXPathExpr, m_mgr );

@@ -534,9 +559,8 @@ namespace PSL.DAML
 				}

 			}
-			catch( Exception e )
+			catch( Exception /*e*/ )
 			{
-				m_EvtLog.WriteEntry( e.Message, EventLogEntryType.Error );
 			}

 			return (EPType[]) lstEffects.ToArray( typeof(EPType) );
@@ -559,7 +583,7 @@ namespace PSL.DAML
 				// Create Expression Builder instance
 				IIOPEXPathExprBuilder IBuilder = IOPEXPathExprBuilderFactory.CreateInstance( enuIOPEType.Precondition );
 				// Build XPath Expression
-				string strXPathExpr = DAMLConstants.SERVICE_PROFILE + IBuilder.BuildExpression( enuIOPESearchBy.COND_DESC );
+				string strXPathExpr = DamlConstants.SERVICE_PROFILE + IBuilder.BuildExpression( enuIOPESearchBy.COND_DESC );

 				XmlNodeList nodeList = root.SelectNodes( strXPathExpr, m_mgr );

@@ -572,9 +596,8 @@ namespace PSL.DAML
 				}

 			}
-			catch( Exception e )
+			catch( Exception /*e*/ )
 			{
-				m_EvtLog.WriteEntry( e.Message, EventLogEntryType.Error );
 			}

 			return (EPType[]) lstPreconds.ToArray( typeof(EPType) );
@@ -597,7 +620,7 @@ namespace PSL.DAML
 				// Create Expression Builder instance
 				IIOPEXPathExprBuilder IBuilder = IOPEXPathExprBuilderFactory.CreateInstance( enuIOPEType.Output );
 				// Build XPath Expression
-				string strXPathExpr = DAMLConstants.SERVICE_PROFILE + IBuilder.BuildExpression( enuIOPESearchBy.PARAM_DESC );
+				string strXPathExpr = DamlConstants.SERVICE_PROFILE + IBuilder.BuildExpression( enuIOPESearchBy.PARAM_DESC );

 				XmlNodeList nodeList = root.SelectNodes( strXPathExpr, m_mgr );

@@ -610,9 +633,8 @@ namespace PSL.DAML
 				}

 			}
-			catch( Exception e )
+			catch( Exception /*e*/ )
 			{
-				m_EvtLog.WriteEntry( e.Message, EventLogEntryType.Error );
 			}

 			return (IOType[]) lstOutputs.ToArray( typeof(IOType) );
@@ -635,7 +657,7 @@ namespace PSL.DAML
 				// Create Expression Builder instance
 				IIOPEXPathExprBuilder IBuilder = IOPEXPathExprBuilderFactory.CreateInstance( enuIOPEType.Input );
 				// Build XPath Expression
-				string strXPathExpr = DAMLConstants.SERVICE_PROFILE + IBuilder.BuildExpression( enuIOPESearchBy.PARAM_DESC );
+				string strXPathExpr = DamlConstants.SERVICE_PROFILE + IBuilder.BuildExpression( enuIOPESearchBy.PARAM_DESC );

 				XmlNodeList nodeList = root.SelectNodes( strXPathExpr, m_mgr );

@@ -648,9 +670,8 @@ namespace PSL.DAML
 				}

 			}
-			catch( Exception e )
+			catch( Exception /*e*/ )
 			{
-				m_EvtLog.WriteEntry( e.Message, EventLogEntryType.Error );
 			}

 			return (IOType[]) lstInputs.ToArray( typeof(IOType) );
@@ -666,19 +687,19 @@ namespace PSL.DAML
 		{
 			IOType ioData = new IOType();

-			ioData.ParameterDesc = descNode.Attributes[DAMLConstants.RDF_ID].Value;
+			ioData.ParameterDesc = descNode.Attributes[DamlConstants.RDF_ID].Value;

 			// Get Param name
-			XmlNode nameNode = descNode.SelectSingleNode( DAMLConstants.PROFILE_PARAM_NAME, m_mgr );
+			XmlNode nameNode = descNode.SelectSingleNode( DamlConstants.PROFILE_PARAM_NAME, m_mgr );
 			ioData.ParameterName = nameNode.InnerText;

 			// Get Param RestrictedTo
-			XmlNode restrictNode = descNode.SelectSingleNode( DAMLConstants.PROFILE_RESTRICTED_TO, m_mgr );
-			ioData.RestrictedTo = restrictNode.Attributes[DAMLConstants.RDF_RESOURCE].Value;
+			XmlNode restrictNode = descNode.SelectSingleNode( DamlConstants.PROFILE_RESTRICTED_TO, m_mgr );
+			ioData.RestrictedTo = restrictNode.Attributes[DamlConstants.RDF_RESOURCE].Value;

 			// Get Param RefersTo
-			XmlNode referNode = descNode.SelectSingleNode( DAMLConstants.PROFILE_REFERS_TO, m_mgr );
-			ioData.RefersTo = referNode.Attributes[DAMLConstants.RDF_RESOURCE].Value;
+			XmlNode referNode = descNode.SelectSingleNode( DamlConstants.PROFILE_REFERS_TO, m_mgr );
+			ioData.RefersTo = referNode.Attributes[DamlConstants.RDF_RESOURCE].Value;

 			return ioData;
 		}
@@ -693,16 +714,16 @@ namespace PSL.DAML
 		{
 			EPType epData = new EPType();

-			epData.ConditionDesc = descNode.Attributes[DAMLConstants.RDF_ID].Value;
+			epData.ConditionDesc = descNode.Attributes[DamlConstants.RDF_ID].Value;

-			XmlNode nameNode = descNode.SelectSingleNode( DAMLConstants.PROFILE_CONDITION_NAME, m_mgr );
+			XmlNode nameNode = descNode.SelectSingleNode( DamlConstants.PROFILE_CONDITION_NAME, m_mgr );
 			epData.ConditionName = nameNode.InnerText;

-			XmlNode stmntNode = descNode.SelectSingleNode( DAMLConstants.PROFILE_STATEMENT, m_mgr );
-			epData.Statement = stmntNode.Attributes[DAMLConstants.RDF_RESOURCE].Value;
+			XmlNode stmntNode = descNode.SelectSingleNode( DamlConstants.PROFILE_STATEMENT, m_mgr );
+			epData.Statement = stmntNode.Attributes[DamlConstants.RDF_RESOURCE].Value;

-			XmlNode referNode = descNode.SelectSingleNode( DAMLConstants.PROFILE_REFERS_TO, m_mgr );
-			epData.RefersTo = referNode.Attributes[DAMLConstants.RDF_RESOURCE].Value;
+			XmlNode referNode = descNode.SelectSingleNode( DamlConstants.PROFILE_REFERS_TO, m_mgr );
+			epData.RefersTo = referNode.Attributes[DamlConstants.RDF_RESOURCE].Value;

 			return epData;
 		}
@@ -720,16 +741,15 @@ namespace PSL.DAML
 			try
 			{
 				XmlNode root = m_doc.DocumentElement;
-				XmlNode node = root.SelectSingleNode( DAMLConstants.SERVICE_PROFILE + "/" + DAMLConstants.PROFILE_HAS_PROCESS, m_mgr );
+				XmlNode node = root.SelectSingleNode( DamlConstants.SERVICE_PROFILE + "/" + DamlConstants.PROFILE_HAS_PROCESS, m_mgr );

 				if( node == null )
 					return "";

-				strRetVal = node.Attributes[DAMLConstants.RDF_RESOURCE].Value;
+				strRetVal = node.Attributes[DamlConstants.RDF_RESOURCE].Value;
 			}
-			catch( Exception e )
+			catch( Exception /*e*/ )
 			{
-				m_EvtLog.WriteEntry( e.Message, EventLogEntryType.Error );
 			}

 			return strRetVal;
@@ -748,16 +768,15 @@ namespace PSL.DAML
 			try
 			{
 				XmlNode root = m_doc.DocumentElement;
-				XmlNode node = root.SelectSingleNode( DAMLConstants.SERVICE_PROFILE + "/" + DAMLConstants.PROFILE_QUALITY_RATING, m_mgr );
+				XmlNode node = root.SelectSingleNode( DamlConstants.SERVICE_PROFILE + "/" + DamlConstants.PROFILE_QUALITY_RATING, m_mgr );

 				if( node == null )
 					return "";

-				strRetVal = node.Attributes[DAMLConstants.RDF_RESOURCE].Value;
+				strRetVal = node.Attributes[DamlConstants.RDF_RESOURCE].Value;
 			}
-			catch( Exception e )
+			catch( Exception /*e*/ )
 			{
-				m_EvtLog.WriteEntry( e.Message, EventLogEntryType.Error );
 			}

 			return strRetVal;
@@ -776,16 +795,15 @@ namespace PSL.DAML
 			try
 			{
 				XmlNode root = m_doc.DocumentElement;
-				XmlNode node = root.SelectSingleNode( DAMLConstants.SERVICE_PROFILE + "/" + DAMLConstants.PROFILE_GEOG_RADIUS, m_mgr );
+				XmlNode node = root.SelectSingleNode( DamlConstants.SERVICE_PROFILE + "/" + DamlConstants.PROFILE_GEOG_RADIUS, m_mgr );

 				if( node == null )
 					return "";

-				strRetVal = node.Attributes[DAMLConstants.RDF_RESOURCE].Value;
+				strRetVal = node.Attributes[DamlConstants.RDF_RESOURCE].Value;
 			}
-			catch( Exception e )
+			catch( Exception /*e*/ )
 			{
-				m_EvtLog.WriteEntry( e.Message, EventLogEntryType.Error );
 			}

 			return strRetVal;
@@ -804,16 +822,15 @@ namespace PSL.DAML
 			try
 			{
 				XmlNode root = m_doc.DocumentElement;
-				XmlNode node = root.SelectSingleNode( DAMLConstants.SERVICE_PROFILE + "/" + DAMLConstants.PROFILE_PROVIDED_BY + "/" + DAMLConstants.PROFILE_SERVICE_PROVIDER + "/" + DAMLConstants.PROFILE_WEB_URL, m_mgr );
+				XmlNode node = root.SelectSingleNode( DamlConstants.SERVICE_PROFILE + "/" + DamlConstants.PROFILE_PROVIDED_BY + "/" + DamlConstants.PROFILE_SERVICE_PROVIDER + "/" + DamlConstants.PROFILE_WEB_URL, m_mgr );

 				if( node == null )
 					return "";

 				strRetVal = node.InnerText;
 			}
-			catch( Exception e )
+			catch( Exception /*e*/ )
 			{
-				m_EvtLog.WriteEntry( e.Message, EventLogEntryType.Error );
 			}

 			return strRetVal;
@@ -832,16 +849,15 @@ namespace PSL.DAML
 			try
 			{
 				XmlNode root = m_doc.DocumentElement;
-				XmlNode node = root.SelectSingleNode( DAMLConstants.SERVICE_PROFILE + "/" + DAMLConstants.PROFILE_PROVIDED_BY + "/" + DAMLConstants.PROFILE_SERVICE_PROVIDER + "/" + DAMLConstants.PROFILE_PHYSICAL_ADDRESS, m_mgr );
+				XmlNode node = root.SelectSingleNode( DamlConstants.SERVICE_PROFILE + "/" + DamlConstants.PROFILE_PROVIDED_BY + "/" + DamlConstants.PROFILE_SERVICE_PROVIDER + "/" + DamlConstants.PROFILE_PHYSICAL_ADDRESS, m_mgr );

 				if( node == null )
 					return "";

 				strRetVal = node.InnerText;
 			}
-			catch( Exception e )
+			catch( Exception /*e*/ )
 			{
-				m_EvtLog.WriteEntry( e.Message, EventLogEntryType.Error );
 			}

 			return strRetVal;
@@ -860,16 +876,15 @@ namespace PSL.DAML
 			try
 			{
 				XmlNode root = m_doc.DocumentElement;
-				XmlNode node = root.SelectSingleNode( DAMLConstants.SERVICE_PROFILE + "/" + DAMLConstants.PROFILE_PROVIDED_BY + "/" + DAMLConstants.PROFILE_SERVICE_PROVIDER + "/" + DAMLConstants.PROFILE_EMAIL, m_mgr );
+				XmlNode node = root.SelectSingleNode( DamlConstants.SERVICE_PROFILE + "/" + DamlConstants.PROFILE_PROVIDED_BY + "/" + DamlConstants.PROFILE_SERVICE_PROVIDER + "/" + DamlConstants.PROFILE_EMAIL, m_mgr );

 				if( node == null )
 					return "";

 				strRetVal = node.InnerText;
 			}
-			catch( Exception e )
+			catch( Exception /*e*/ )
 			{
-				m_EvtLog.WriteEntry( e.Message, EventLogEntryType.Error );
 			}

 			return strRetVal;
@@ -888,16 +903,15 @@ namespace PSL.DAML
 			try
 			{
 				XmlNode root = m_doc.DocumentElement;
-				XmlNode node = root.SelectSingleNode( DAMLConstants.SERVICE_PROFILE + "/" + DAMLConstants.PROFILE_PROVIDED_BY + "/" + DAMLConstants.PROFILE_SERVICE_PROVIDER + "/" + DAMLConstants.PROFILE_FAX, m_mgr );
+				XmlNode node = root.SelectSingleNode( DamlConstants.SERVICE_PROFILE + "/" + DamlConstants.PROFILE_PROVIDED_BY + "/" + DamlConstants.PROFILE_SERVICE_PROVIDER + "/" + DamlConstants.PROFILE_FAX, m_mgr );

 				if( node == null )
 					return "";

 				strRetVal = node.InnerText;
 			}
-			catch( Exception e )
+			catch( Exception /*e*/ )
 			{
-				m_EvtLog.WriteEntry( e.Message, EventLogEntryType.Error );
 			}

 			return strRetVal;
@@ -916,16 +930,15 @@ namespace PSL.DAML
 			try
 			{
 				XmlNode root = m_doc.DocumentElement;
-				XmlNode node = root.SelectSingleNode( DAMLConstants.SERVICE_PROFILE + "/" + DAMLConstants.PROFILE_PROVIDED_BY + "/" + DAMLConstants.PROFILE_SERVICE_PROVIDER + "/" + DAMLConstants.PROFILE_PHONE, m_mgr );
+				XmlNode node = root.SelectSingleNode( DamlConstants.SERVICE_PROFILE + "/" + DamlConstants.PROFILE_PROVIDED_BY + "/" + DamlConstants.PROFILE_SERVICE_PROVIDER + "/" + DamlConstants.PROFILE_PHONE, m_mgr );

 				if( node == null )
 					return "";

 				strRetVal = node.InnerText;
 			}
-			catch( Exception e )
+			catch( Exception /*e*/ )
 			{
-				m_EvtLog.WriteEntry( e.Message, EventLogEntryType.Error );
 			}

 			return strRetVal;
@@ -944,16 +957,15 @@ namespace PSL.DAML
 			try
 			{
 				XmlNode root = m_doc.DocumentElement;
-				XmlNode node = root.SelectSingleNode( DAMLConstants.SERVICE_PROFILE + "/" + DAMLConstants.PROFILE_PROVIDED_BY + "/" + DAMLConstants.PROFILE_SERVICE_PROVIDER + "/" + DAMLConstants.PROFILE_NAME, m_mgr );
+				XmlNode node = root.SelectSingleNode( DamlConstants.SERVICE_PROFILE + "/" + DamlConstants.PROFILE_PROVIDED_BY + "/" + DamlConstants.PROFILE_SERVICE_PROVIDER + "/" + DamlConstants.PROFILE_NAME, m_mgr );

 				if( node == null )
 					return "";

 				strRetVal = node.InnerText;
 			}
-			catch( Exception e )
+			catch( Exception /*e*/ )
 			{
-				m_EvtLog.WriteEntry( e.Message, EventLogEntryType.Error );
 			}

 			return strRetVal;
@@ -972,17 +984,16 @@ namespace PSL.DAML
 			try
 			{
 				XmlNode root = m_doc.DocumentElement;
-				XmlNode node = root.SelectSingleNode( DAMLConstants.SERVICE_PROFILE + "/" + DAMLConstants.PROFILE_PROVIDED_BY + "/" + DAMLConstants.PROFILE_SERVICE_PROVIDER, m_mgr );
+				XmlNode node = root.SelectSingleNode( DamlConstants.SERVICE_PROFILE + "/" + DamlConstants.PROFILE_PROVIDED_BY + "/" + DamlConstants.PROFILE_SERVICE_PROVIDER, m_mgr );

 				if( node == null )
 					return "";

-				strRetVal = node.Attributes[DAMLConstants.RDF_ID].Value;
+				strRetVal = node.Attributes[DamlConstants.RDF_ID].Value;

 			}
-			catch( Exception e )
+			catch( Exception /*e*/ )
 			{
-				m_EvtLog.WriteEntry( e.Message, EventLogEntryType.Error );
 			}

 			return strRetVal;
@@ -1001,16 +1012,15 @@ namespace PSL.DAML
 			try
 			{
 				XmlNode root = m_doc.DocumentElement;
-				XmlNode node = root.SelectSingleNode( DAMLConstants.SERVICE_PROFILE + "/" + DAMLConstants.PROFILE_REQUESTED_BY, m_mgr );
+				XmlNode node = root.SelectSingleNode( DamlConstants.SERVICE_PROFILE + "/" + DamlConstants.PROFILE_REQUESTED_BY, m_mgr );

 				if( node == null )
 					return "";

 				strRetVal = node.InnerText;
 			}
-			catch( Exception e )
+			catch( Exception /*e*/ )
 			{
-				m_EvtLog.WriteEntry( e.Message, EventLogEntryType.Error );
 			}

 			return strRetVal;
@@ -1029,16 +1039,15 @@ namespace PSL.DAML
 			try
 			{
 				XmlNode root = m_doc.DocumentElement;
-				XmlNode node = root.SelectSingleNode( DAMLConstants.SERVICE_PROFILE + "/" + DAMLConstants.PROFILE_INTENDED_PURPOSE, m_mgr );
+				XmlNode node = root.SelectSingleNode( DamlConstants.SERVICE_PROFILE + "/" + DamlConstants.PROFILE_INTENDED_PURPOSE, m_mgr );

 				if( node == null )
 					return "";

 				strRetVal = node.InnerText;
 			}
-			catch( Exception e )
+			catch( Exception /*e*/ )
 			{
-				m_EvtLog.WriteEntry( e.Message, EventLogEntryType.Error );
 			}

 			return strRetVal;
@@ -1057,16 +1066,15 @@ namespace PSL.DAML
 			try
 			{
 				XmlNode root = m_doc.DocumentElement;
-				XmlNode node = root.SelectSingleNode( DAMLConstants.SERVICE_PROFILE + "/" + DAMLConstants.PROFILE_TEXT_DESC, m_mgr );
+				XmlNode node = root.SelectSingleNode( DamlConstants.SERVICE_PROFILE + "/" + DamlConstants.PROFILE_TEXT_DESC, m_mgr );

 				if( node == null )
 					return "";

 				strRetVal = node.InnerText;
 			}
-			catch( Exception e )
+			catch( Exception /*e*/ )
 			{
-				m_EvtLog.WriteEntry( e.Message, EventLogEntryType.Error );
 			}

 			return strRetVal;
@@ -1085,16 +1093,15 @@ namespace PSL.DAML
 			try
 			{
 				XmlNode root = m_doc.DocumentElement;
-				XmlNode node = root.SelectSingleNode( DAMLConstants.SERVICE_PROFILE + "/" + DAMLConstants.SERVICE_PRESENTED_BY, m_mgr );
+				XmlNode node = root.SelectSingleNode( DamlConstants.SERVICE_PROFILE + "/" + DamlConstants.SERVICE_PRESENTED_BY, m_mgr );

 				if( node == null )
 					return "";

-				strRetVal = node.Attributes[DAMLConstants.RDF_RESOURCE].Value;
+				strRetVal = node.Attributes[DamlConstants.RDF_RESOURCE].Value;
 			}
-			catch( Exception e )
+			catch( Exception /*e*/ )
 			{
-				m_EvtLog.WriteEntry( e.Message, EventLogEntryType.Error );
 			}

 			return strRetVal;
@@ -1113,16 +1120,15 @@ namespace PSL.DAML
 			try
 			{
 				XmlNode root = m_doc.DocumentElement;
-				XmlNode node = root.SelectSingleNode( DAMLConstants.SERVICE_PROFILE, m_mgr );
+				XmlNode node = root.SelectSingleNode( DamlConstants.SERVICE_PROFILE, m_mgr );

 				if( node == null )
 					return "";

-				strRetVal = node.Attributes[DAMLConstants.RDF_ID].Value;
+				strRetVal = node.Attributes[DamlConstants.RDF_ID].Value;
 			}
-			catch( Exception e )
+			catch( Exception /*e*/ )
 			{
-				m_EvtLog.WriteEntry( e.Message, EventLogEntryType.Error );
 			}

 			return strRetVal;
@@ -1141,16 +1147,15 @@ namespace PSL.DAML
 			try
 			{
 				XmlNode root = m_doc.DocumentElement;
-				XmlNode node = root.SelectSingleNode( DAMLConstants.SERVICE_PROFILE + "/" + DAMLConstants.PROFILE_SERVICE_NAME, m_mgr );
+				XmlNode node = root.SelectSingleNode( DamlConstants.SERVICE_PROFILE + "/" + DamlConstants.PROFILE_SERVICE_NAME, m_mgr );

 				if( node == null )
 					return "";

 				strRetVal = node.InnerText;
 			}
-			catch( Exception e )
+			catch( Exception /*e*/ )
 			{
-				m_EvtLog.WriteEntry( e.Message, EventLogEntryType.Error );
 			}

 			return strRetVal;
diff --git a/csharpsrc/DAML/DamlClass.cs b/csharpsrc/DAML/DamlClass.cs
new file mode 100644
index 0000000..362b1f9
--- /dev/null
+++ b/csharpsrc/DAML/DamlClass.cs
@@ -0,0 +1,100 @@
+using System;
+using System.Collections;
+
+namespace PSL.DAML
+{
+	/// <summary>
+	/// Abstract base class for daml:Class elements
+	/// </summary>
+	public abstract class DamlClass:DamlTypeDefinition
+	{
+		protected enuDamlClassType m_damlClassType = enuDamlClassType.rdfsSubClassOf;
+		protected enuRdfParseType m_parseType = enuRdfParseType.damlCollection;
+		protected string m_strValue = "";
+		protected Hashtable m_options = new Hashtable();
+
+		/// <summary>
+		/// Ctor.
+		/// </summary>
+		public DamlClass()
+		{
+			this.m_damlType = enuDamlType.damlClass;
+		}
+
+		/// <summary>
+		/// Property gets/sets the value of this instance
+		/// </summary>
+		public virtual string Value
+		{
+			get
+			{ return this.m_strValue; }
+			set
+			{
+				if( value == null || value.Length == 0 )
+					return;
+
+				if( !this.m_options.Contains( value ) )
+					throw new Exception( "Value can only be set to one of the options already added." );
+
+				this.m_strValue = value;
+			}
+		}
+
+		/// <summary>
+		/// Property gets the daml class type of this instance
+		/// </summary>
+		public virtual enuDamlClassType DamlClassType
+		{
+			get
+			{ return this.m_damlClassType; }
+		}
+
+		/// <summary>
+		/// Property gets/sets the parseType of this instance
+		/// </summary>
+		public virtual enuRdfParseType ParseType
+		{
+			get
+			{ return this.m_parseType; }
+			set
+			{ this.m_parseType = value; }
+		}
+
+		/// <summary>
+		/// Procedure adds an option to the instance (applicable for daml:collection
+		/// parseTypes)
+		/// </summary>
+		/// <param name="strOption"></param>
+		public virtual void AddOption( string strOption )
+		{
+			if( strOption == null || strOption.Length == 0 )
+				return;
+
+			if( !this.m_options.ContainsKey( strOption ) )
+				this.m_options.Add( strOption, strOption.TrimStart( new char[] { '#' } ) );
+		}
+
+		/// <summary>
+		/// Procedure removes an option from the instance (applicable for daml:collection
+		/// parseTypes)
+		/// </summary>
+		/// <param name="strOption"></param>
+		public virtual void RemoveOption( string strOption )
+		{
+			if( strOption == null || strOption.Length == 0 )
+				return;
+
+			this.m_options.Remove( strOption );
+		}
+
+		/// <summary>
+		/// Procedure resets the instance
+		/// </summary>
+		public override void Clear()
+		{
+			this.m_strName = "";
+			this.m_strValue = "";
+			this.m_options.Clear();
+		}
+	}
+}
diff --git a/csharpsrc/DAML/DamlOneOf.cs b/csharpsrc/DAML/DamlOneOf.cs
new file mode 100644
index 0000000..7dcfe6a
--- /dev/null
+++ b/csharpsrc/DAML/DamlOneOf.cs
@@ -0,0 +1,80 @@
+using System;
+using System.Collections;
+using System.Xml;
+
+namespace PSL.DAML
+{
+	/// <summary>
+	/// DamlOneOf is a specialized version of a DamlClass
+	/// </summary>
+	public class DamlOneOf:DamlClass
+	{
+		/// <summary>
+		/// Ctor.
+		/// </summary>
+		public DamlOneOf()
+		{
+			this.m_damlClassType = enuDamlClassType.damlOneOf;
+		}
+
+		/// <summary>
+		/// Function converts an instance to and xml string
+		/// </summary>
+		/// <returns>The xml string representing the instance</returns>
+		public override string ToXml()
+		{
+			XmlDocument doc = DamlContainer.BuildDamlDocumentTemplate( false );
+			XmlNode root = doc.DocumentElement;
+
+			// Create the document root
+			XmlNode damlClassNode = doc.CreateNode( XmlNodeType.Element, DamlConstants.DAML_CLASS, DamlConstants.DAML_NS_URI );
+			// Create an attribute to hold the name of the damlClass
+			XmlAttribute damlClassAtt = doc.CreateAttribute( DamlConstants.RDF_ID, DamlConstants.RDF_NS_URI );
+			// Set attribute value
+			damlClassAtt.Value = this.m_strName;
+			// Append attribute to damlClass node
+			damlClassNode.Attributes.Append( damlClassAtt );
+
+			// Create daml:OneOf node
+			XmlNode damlTypeNode = doc.CreateNode( XmlNodeType.Element, DamlConstants.DAML_ONE_OF, DamlConstants.DAML_NS_URI );
+			// Create attribute to set the parseType
+			XmlAttribute damlTypeNodeAtt = doc.CreateAttribute( DamlConstants.RDF_PARSE_TYPE, DamlConstants.RDF_NS_URI );
+			// Set attribute value
+			switch( this.m_parseType )
+			{
+				case enuRdfParseType.damlCollection:
+					damlTypeNodeAtt.Value = DamlConstants.DAML_COLLECTION;
+					break;
+
+				default: throw new Exception( "Unknown rdfParseType" );
+			}
+			// Append attribute to node
+			damlTypeNode.Attributes.Append( damlTypeNodeAtt );
+
+			// Scroll thru the options creating a daml:Class rdf:about node
+			// adding each one to the damlTypeNode
+			IDictionaryEnumerator it = this.m_options.GetEnumerator();
+
+			while( it.MoveNext() )
+			{
+				// Create node
+				XmlNode rdfAboutNode = doc.CreateNode( XmlNodeType.Element, DamlConstants.DAML_CLASS, DamlConstants.DAML_NS_URI );
+				// Create attribute
+				XmlAttribute rdfAboutAtt = doc.CreateAttribute( DamlConstants.RDF_ABOUT, DamlConstants.RDF_NS_URI );
+				// Set attribute value
+				rdfAboutAtt.Value = (string) it.Key;
+				// Add attribute to node
+				rdfAboutNode.Attributes.Append( rdfAboutAtt );
+
+				// Add node to the damlTypeNode
+				damlTypeNode.AppendChild( rdfAboutNode );
+
+			}
+
+			damlClassNode.AppendChild( damlTypeNode );
+			root.AppendChild( damlClassNode );
+			// Return the xml string
+			return doc.OuterXml;
+		}//End-ToXml
+	}//End-Class
+}//End-Namespace
diff --git a/csharpsrc/DAML/DamlProcessModelWriter.cs b/csharpsrc/DAML/DamlProcessModelWriter.cs
new file mode 100644
index 0000000..a68dc43
--- /dev/null
+++ b/csharpsrc/DAML/DamlProcessModelWriter.cs
@@ -0,0 +1,112 @@
+using System;
+using System.Xml;
+using System.Collections;
+
+namespace PSL.DAML
+{
+	/// <summary>
+	/// Summary description for DamlProcessModelWriter.
+	/// </summary>
+	public class DamlProcessModelWriter
+	{
+		private Hashtable m_processMap = new Hashtable();
+		private Hashtable m_dataTypeDefinitionMap = new Hashtable();
+
+		public DamlProcessModelWriter()
+		{
+		}
+
+		public void AddDamlProcess( DamlProcess process )
+		{
+			if( process == null )
+				throw new ArgumentNullException( "process", "DamlProcess parameter cannot be null" );
+
+			if( process.Name == null || process.Name.Length == 0 )
+				throw new ArgumentException( "DamlProcess name must be set", "process" );
+
+			if( !this.m_processMap.ContainsKey( process.Name ) )
+				this.m_processMap.Add( process.Name, process );
+		}
+
+		public void RemoveProcess( string strProcessName )
+		{
+			if( strProcessName == null || strProcessName.Length == 0 )
+				throw new ArgumentException( "Process name cannot be null or empty string", "strProcessName" );
+
+			this.m_processMap.Remove( strProcessName );
+		}
+
+		public string ToXml()
+		{
+			// Get a document template
+			XmlDocument doc = DamlContainer.BuildDamlDocumentTemplate( true );
+
+			// Get the document element (document root)
+			XmlNode root = doc.DocumentElement;
+
+			// DamlProcessWriter may have to control the datatypes
+			// being written out by each DamlProcess, multiple processes in
+			// a proces model may share data types, we only need one
+			// data type definition
+
+			IDictionaryEnumerator it = this.m_processMap.GetEnumerator();
+
+			while( it.MoveNext() )
+			{
+				DamlProcess proc = (DamlProcess) it.Value;
+
+				XmlDocument processDoc = new XmlDocument();
+				// DO NOT add type defintions to xml document we create
+				// the ProcessModel should keep track of all the data types
+				// in each process to ensure each type definition gets written
+				// only once since multiple process in a process model may share
+				// data types an as such could cause duplicate definitions
+				// to be written out in the process model xml document
+				processDoc.LoadXml( proc.ToXml( false ) );
+
+				XmlNode processDocRoot = processDoc.DocumentElement;
+
+				XmlNodeList lstChildren = processDocRoot.ChildNodes;
+
+				foreach( XmlNode child in lstChildren )
+				{
+					// Add every child to our document root except the ontology imports
+					// since we already have these from the DamlDocumentTemplate
+					if( child.Name != DamlConstants.DAML_ONTOLOGY )
+					{
+						XmlNode temp = doc.ImportNode( child, true );
+						root.AppendChild( temp );
+					}
+				}
+
+				// Get the data types we have not seen as yet
+				DamlTypeDefinition[] arrDefinitions = proc.TypeDefinitions;
+				for( int i = 0; i < arrDefinitions.Length; i++ )
+				{
+					if( !this.m_dataTypeDefinitionMap.ContainsKey( arrDefinitions[i].Name ) )
+						this.m_dataTypeDefinitionMap.Add( arrDefinitions[i].Name, arrDefinitions[i] );
+				}
+			}
+
+			// Write data type map last
+			IDictionaryEnumerator typeIt = this.m_dataTypeDefinitionMap.GetEnumerator();
+
+			while( typeIt.MoveNext() )
+			{
+				DamlTypeDefinition definition = (DamlTypeDefinition) typeIt.Value;
+				XmlDocument typeDoc = new XmlDocument();
+				// Load the xml of the type definition
+				typeDoc.LoadXml( definition.ToXml() );
+				// Get the document element
+				XmlNode typeDocRoot = typeDoc.DocumentElement;
+				// Import the first child of the root into the damlProcess xml document
+				// being created
+				XmlNode temp = doc.ImportNode( typeDocRoot.FirstChild, true );
+				// Append that node to our current document root
+				root.AppendChild( temp );
+			}
+
+			return doc.OuterXml;
+		}
+	}
+}
diff --git a/csharpsrc/DAML/DamlRestriction.cs b/csharpsrc/DAML/DamlRestriction.cs
new file mode 100644
index 0000000..841ec11
--- /dev/null
+++ b/csharpsrc/DAML/DamlRestriction.cs
@@ -0,0 +1,107 @@
+using System;
+using System.Xml;
+
+namespace PSL.DAML
+{
+	/// <summary>
+	/// DamlRestriction classes represent a restriction in a Daml Process Model
+	/// on some attribute of a process.
+	/// </summary>
+	public sealed class DamlRestriction:IComparable
+	{
+		public const int NO_CARDINALITY = -1;
+
+		private string m_strOwner = "";
+		private int m_nCardinality = NO_CARDINALITY;
+		private string m_strHasValue = "";
+		private string m_strOnProperty = ""; // May or may not have # pre-pended
+
+		public DamlRestriction()
+		{
+		}
+
+		/// <summary>
+		/// Property gets/sets the owner (process attribute) which this restriction
+		/// applies to.
+		/// </summary>
+		public string Owner
+		{
+			get
+			{ return this.m_strOwner; }
+			set
+			{
+				if( value == null || value.Length == 0 )
+					return;
+
+				this.m_strOwner = value;
+			}
+		}
+
+		/// <summary>
+		/// Property gets/sets the cardinality of the restriction. This restriction
+		/// applies to its owner e.g. restricting a method to only expect/allow
+		/// 1 instance of a named input
+		/// </summary>
+		public int Cardinality
+		{
+			get
+			{ return this.m_nCardinality; }
+			set
+			{
+				if( value < 0 )
+					return;
+
+				this.m_nCardinality = value;
+			}
+		}
+
+		/// <summary>
+		/// Property gets/sets the HasValue of the restriction. Some restrictions may
+		/// specify what value a process attribute must be e.g. an input must have
+		/// value = "True".
+		/// </summary>
+		public string HasValue
+		{
+			get
+			{ return this.m_strHasValue; }
+			set
+			{
+				if( value == null || value.Length == 0 )
+					return;
+
+				this.m_strHasValue = value;
+			}
+		}
+
+		/// <summary>
+		/// Property gets/sets the name of the process attribute which this restriction
+		/// applies to.
+		/// </summary>
+		public string OnProperty
+		{
+			get
+			{ return this.m_strOnProperty; }
+			set
+			{
+				if( value == null || value.Length == 0 )
+					return;
+
+				this.m_strOnProperty = value;
+			}
+		}
+
+		/// <summary>
+		/// Function compares 2 DamlRestriction instances. The OnProperty property
+		/// is used for comparisons.
+		/// </summary>
+		/// <param name="obj"></param>
+		/// <returns>0 (equal), -1 (less than this instance)
+		/// or 1 (greater than this instance)</returns>
+		public int CompareTo( object obj )
+		{
+			DamlRestriction temp = (DamlRestriction) obj;
+
+			return this.m_strOnProperty.ToLower().CompareTo( temp.m_strOnProperty.ToLower() );
+		}
+	}
+}
diff --git a/csharpsrc/DAML/DamlTypeDefinition.cs b/csharpsrc/DAML/DamlTypeDefinition.cs
new file mode 100644
index 0000000..dddc0c1
--- /dev/null
+++ b/csharpsrc/DAML/DamlTypeDefinition.cs
@@ -0,0 +1,57 @@
+using System;
+using System.Collections;
+
+namespace PSL.DAML
+{
+	/// <summary>
+	/// Abstract base class of Daml Type Definitions
+	/// </summary>
+	public abstract class DamlTypeDefinition
+	{
+		protected string m_strName = "";
+		protected enuDamlType m_damlType = enuDamlType.rdfProperty;
+
+		/// <summary>
+		/// Property gets the Daml Type of an instance
+		/// </summary>
+		public virtual enuDamlType DamlType
+		{
+			get
+			{ return this.m_damlType; }
+		}
+
+		/// <summary>
+		/// Property gets/sets the name of a Daml Type
+		/// </summary>
+		public virtual string Name
+		{
+			get
+			{ return this.m_strName; }
+			set
+			{
+				if( value == null || value.Length == 0 )
+					return;
+
+				this.m_strName = value;
+			}
+		}
+
+		/// <summary>
+		/// Ctor.
+		/// </summary>
+		public DamlTypeDefinition()
+		{}
+
+		/// <summary>
+		/// Abstract method implemented by derived classes to reset an instance
+		/// </summary>
+		public abstract void Clear();
+
+		/// <summary>
+		/// Abstract method implemented by derived classes to convert an instance
+		/// to Xml
+		/// </summary>
+		/// <returns></returns>
+		public abstract string ToXml();
+	}
+}
diff --git a/csharpsrc/DAML/DamlUnionOf.cs b/csharpsrc/DAML/DamlUnionOf.cs
new file mode 100644
index 0000000..784a583
--- /dev/null
+++ b/csharpsrc/DAML/DamlUnionOf.cs
@@ -0,0 +1,80 @@
+using System;
+using System.Xml;
+using System.Collections;
+
+namespace PSL.DAML
+{
+	/// <summary>
+	/// DamlUnionOf is a specialized version of a DamlClass
+	/// </summary>
+	public class DamlUnionOf:DamlClass
+	{
+		/// <summary>
+		/// Ctor.
+		/// </summary>
+		public DamlUnionOf()
+		{
+			this.m_damlClassType = enuDamlClassType.damlUnionOf;
+		}
+
+		/// <summary>
+		/// Function converts an instance to and xml string
+		/// </summary>
+		/// <returns>The xml string representing the instance</returns>
+		public override string ToXml()
+		{
+			XmlDocument doc = DamlContainer.BuildDamlDocumentTemplate( false );
+			XmlNode root = doc.DocumentElement;
+
+			// Create the document root
+			XmlNode damlClassNode = doc.CreateNode( XmlNodeType.Element, DamlConstants.DAML_CLASS, DamlConstants.DAML_NS_URI );
+			// Create an attribute to hold the name of the damlClass
+			XmlAttribute damlClassAtt = doc.CreateAttribute( DamlConstants.RDF_ID, DamlConstants.RDF_NS_URI );
+			// Set attribute value
+			damlClassAtt.Value = this.m_strName;
+			// Append attribute to damlClass node
+			damlClassNode.Attributes.Append( damlClassAtt );
+
+			// Create daml:UnionOf node
+			XmlNode damlTypeNode = doc.CreateNode( XmlNodeType.Element, DamlConstants.DAML_UNION_OF, DamlConstants.DAML_NS_URI );
+			// Create attribute to set the parseType
+			XmlAttribute damlTypeNodeAtt = doc.CreateAttribute( DamlConstants.RDF_PARSE_TYPE, DamlConstants.RDF_NS_URI );
+			// Set attribute value
+			switch( this.m_parseType )
+			{
+				case enuRdfParseType.damlCollection:
+					damlTypeNodeAtt.Value = DamlConstants.DAML_COLLECTION;
+					break;
+
+				default: throw new Exception( "Unknown rdfParseType" );
+			}
+			// Append attribute to node
+			damlTypeNode.Attributes.Append( damlTypeNodeAtt );
+
+			// Scroll thru the options creating a daml:Class rdf:about node
+			// adding each one to the damlTypeNode
+			IDictionaryEnumerator it = this.m_options.GetEnumerator();
+
+			while( it.MoveNext() )
+			{
+				// Create node
+				XmlNode rdfAboutNode = doc.CreateNode( XmlNodeType.Element, DamlConstants.DAML_CLASS, DamlConstants.DAML_NS_URI );
+				// Create attribute
+				XmlAttribute rdfAboutAtt = doc.CreateAttribute( DamlConstants.RDF_ABOUT, DamlConstants.RDF_NS_URI );
+				// Set attribute value
+				rdfAboutAtt.Value = (string) it.Key;
+				// Add attribute to node
+				rdfAboutNode.Attributes.Append( rdfAboutAtt );
+
+				// Add node to the damlTypeNode
+				damlTypeNode.AppendChild( rdfAboutNode );
+
+			}
+
+			damlClassNode.AppendChild( damlTypeNode );
+			root.AppendChild( damlClassNode );
+			// Return xml string
+			return doc.OuterXml;
+		}
+	}
+}
diff --git a/csharpsrc/DAML/RdfProperty.cs b/csharpsrc/DAML/RdfProperty.cs
new file mode 100644
index 0000000..76d18cf
--- /dev/null
+++ b/csharpsrc/DAML/RdfProperty.cs
@@ -0,0 +1,175 @@
+using System;
+using System.Collections;
+using System.Xml;
+
+namespace PSL.DAML
+{
+	/// <summary>
+	/// RdfProperty class
+	/// </summary>
+	public class RdfProperty:DamlTypeDefinition
+	{
+		private string m_strSubPropertyOf = "";
+		private string m_strDomain = "";
+		private string m_strRange = "";
+		private string m_strSameValueAs = "";
+
+		/// <summary>
+		/// Ctor.
+		/// </summary>
+		public RdfProperty()
+		{
+			this.m_damlType = enuDamlType.rdfProperty;
+		}
+
+		/// <summary>
+		/// Property gets/sets the SubPropertyOf value of the instance
+		/// </summary>
+		public string SubPropertyOf
+		{
+			get
+			{ return m_strSubPropertyOf; }
+			set
+			{
+				if( value == null || value.Length == 0 )
+					return;
+
+				m_strSubPropertyOf = value;
+			}
+		}
+
+		/// <summary>
+		/// Property gets/sets the Domain value of the instance
+		/// </summary>
+		public string Domain
+		{
+			get
+			{ return m_strDomain; }
+			set
+			{
+				if( value == null || value.Length == 0 )
+					return;
+
+				m_strDomain = value;
+			}
+		}
+
+		/// <summary>
+		/// Property gets/sets the Range value of the instance
+		/// </summary>
+		public string Range
+		{
+			get
+			{ return m_strRange; }
+			set
+			{
+				if( value == null || value.Length == 0 )
+					return;
+
+				m_strRange = value;
+			}
+		}
+
+		/// <summary>
+		/// Property gets/sets the SameValueAs value of the instance
+		/// </summary>
+		public string SameValueAs
+		{
+			get
+			{ return m_strSameValueAs; }
+			set
+			{
+				if( value == null || value.Length == 0 )
+					return;
+
+				m_strSameValueAs = value;
+			}
+		}
+
+		/// <summary>
+		/// Procedure resets the instance
+		/// </summary>
+		public override void Clear()
+		{
+			this.m_strName = "";
+
+			this.m_strDomain = "";
+			this.m_strRange = "";
+			this.m_strSameValueAs = "";
+			this.m_strSubPropertyOf = "";
+		}
+
+		/// <summary>
+		/// Function converts an instance to and xml string
+		/// </summary>
+		/// <returns>The xml string representing the instance</returns>
+		public override string ToXml()
+		{
+			XmlDocument doc = DamlContainer.BuildDamlDocumentTemplate( false );
+			XmlNode root = doc.DocumentElement;
+
+			// Create rdfPropertyNode
+			XmlNode rdfPropertyNode = doc.CreateNode( XmlNodeType.Element, DamlConstants.RDF_PROPERTY, DamlConstants.RDF_NS_URI );
+			// Create attribute
+			XmlAttribute rdfPropertyAtt = doc.CreateAttribute( DamlConstants.RDF_ID, DamlConstants.RDF_NS_URI );
+			// Set attribute value
+			rdfPropertyAtt.Value = this.m_strName;
+			// Add attribute to node
+			rdfPropertyNode.Attributes.Append( rdfPropertyAtt );
+
+			// Create node for subPropertyOf (only if it has been set)
+			if( this.m_strSubPropertyOf.Length > 0 )
+			{
+				XmlNode subPropertyOfNode = doc.CreateNode( XmlNodeType.Element, DamlConstants.RDFS_SUBPROPERTYOF, DamlConstants.RDFS_NS_URI );
+				// Create attribute
+				XmlAttribute subPropertyOfAtt = doc.CreateAttribute( DamlConstants.RDF_RESOURCE, DamlConstants.RDF_NS_URI );
+				// Set attribute value
+				subPropertyOfAtt.Value = this.m_strSubPropertyOf;
+				// Add attribute to node
+				subPropertyOfNode.Attributes.Append( subPropertyOfAtt );
+
+				rdfPropertyNode.AppendChild( subPropertyOfNode );
+			}
+
+			// Create node for domain
+			XmlNode domainNode = doc.CreateNode( XmlNodeType.Element, DamlConstants.RDFS_DOMAIN, DamlConstants.RDFS_NS_URI );
+			// Create attribute
+			XmlAttribute domainAtt = doc.CreateAttribute( DamlConstants.RDF_RESOURCE, DamlConstants.RDF_NS_URI );
+			// Set attribute value
+			domainAtt.Value = this.m_strDomain.StartsWith( "#" ) ? this.m_strDomain : "#" + this.m_strDomain;
+			// Add attribute to node
+			domainNode.Attributes.Append( domainAtt );
+
+			rdfPropertyNode.AppendChild( domainNode );
+
+			// Create node for range
+			XmlNode rangeNode = doc.CreateNode( XmlNodeType.Element, DamlConstants.RDFS_RANGE, DamlConstants.RDFS_NS_URI );
+			// Create attribute
+			XmlAttribute rangeAtt = doc.CreateAttribute( DamlConstants.RDF_RESOURCE, DamlConstants.RDF_NS_URI );
+			// Set attribute value
+			rangeAtt.Value = this.m_strRange;
+			// Add attribute to node
+			rangeNode.Attributes.Append( rangeAtt );
+
+			rdfPropertyNode.AppendChild( rangeNode );
+
+			// Create node for sameValueAs (only if it has been set)
+			if( this.m_strSameValueAs.Length > 0 )
+			{
+				XmlNode sameValueAsNode = doc.CreateNode( XmlNodeType.Element, DamlConstants.DAML_SAMEVALUESAS, DamlConstants.DAML_NS_URI );
+				// Create attribute
+				XmlAttribute sameValueAsAtt = doc.CreateAttribute( DamlConstants.RDF_RESOURCE, DamlConstants.RDF_NS_URI );
+				// Set attribute value
+				sameValueAsAtt.Value = this.m_strSameValueAs;
+				// Add attribute to node
+				sameValueAsNode.Attributes.Append( sameValueAsAtt );
+
+				rdfPropertyNode.AppendChild( sameValueAsNode );
+			}
+
+			root.AppendChild( rdfPropertyNode );
+			// Return xml string
+			return doc.OuterXml;
+		}
+	}
+}
diff --git a/csharpsrc/DAML/RdfsSubClassOf.cs b/csharpsrc/DAML/RdfsSubClassOf.cs
new file mode 100644
index 0000000..900cb29
--- /dev/null
+++ b/csharpsrc/DAML/RdfsSubClassOf.cs
@@ -0,0 +1,98 @@
+using System;
+using System.Collections;
+using System.Xml;
+
+namespace PSL.DAML
+{
+	/// <summary>
+	/// RdfsSubClassOf is a specialized version of a DamlClass
+	/// </summary>
+	public class RdfsSubClassOf:DamlClass
+	{
+		/// <summary>
+		/// Ctor.
+		/// </summary>
+		public RdfsSubClassOf()
+		{
+			this.m_damlClassType = enuDamlClassType.rdfsSubClassOf;
+		}
+
+		/// <summary>
+		/// Property gets/sets the value of the instance
+		/// </summary>
+		public override string Value
+		{
+			get
+			{ return this.m_strValue; }
+			set
+			{
+				if( value == null || value.Length == 0 )
+					return;
+
+				this.m_strValue = value;
+			}
+		}
+
+		/// <summary>
+		/// Procedure resets the instance
+		/// </summary>
+		public override void Clear()
+		{
+			this.m_strName = "";
+			this.m_strValue = "";
+		}
+
+		/// <summary>
+		/// Procedure Not Supported on this class
+		/// </summary>
+		/// <param name="strOption"></param>
+		/// <exception cref="NotSupportedException"></exception>"
+		public override void AddOption( string strOption )
+		{
+			throw new NotSupportedException( "Adding Options not supported by RdfSubClassOf class" );
+		}
+
+		/// <summary>
+		/// Procedure Not Supported on this class
+		/// </summary>
+		/// <param name="strOption"></param>
+		/// <exception cref="NotSupportedException"></exception>"
+		public override void RemoveOption( string strOption )
+		{
+			throw new NotSupportedException( "Removing Options not supported by RdfSubClassOf class" );
+		}
+
+		/// <summary>
+		/// Function converts an instance to and xml string
+		/// </summary>
+		/// <returns>The xml string representing the instance</returns>
+		public override string ToXml()
+		{
+			XmlDocument doc = DamlContainer.BuildDamlDocumentTemplate( false );
+			XmlNode root = doc.DocumentElement;
+
+			// Create the document root
+			XmlNode damlClassNode = doc.CreateNode( XmlNodeType.Element, DamlConstants.DAML_CLASS, DamlConstants.DAML_NS_URI );
+			// Create an attribute to hold the name of the damlClass
+			XmlAttribute damlClassAtt = doc.CreateAttribute( DamlConstants.RDF_ID, DamlConstants.RDF_NS_URI );
+			// Set attribute value
+			damlClassAtt.Value = this.m_strName;
+			// Append attribute to damlClass node
+			damlClassNode.Attributes.Append( damlClassAtt );
+
+			// Create rdfsSubClassOf node
+			XmlNode damlTypeNode = doc.CreateNode( XmlNodeType.Element, DamlConstants.RDFS_SUBCLASSOF, DamlConstants.RDFS_NS_URI );
+			// Create attribute to set the value
+			XmlAttribute damlTypeNodeAtt = doc.CreateAttribute( DamlConstants.RDF_RESOURCE, DamlConstants.RDF_NS_URI );
+			// Set the value
+			damlTypeNodeAtt.Value = this.Value;
+			// Append attribute to node
+			damlTypeNode.Attributes.Append( damlTypeNodeAtt );
+
+			damlClassNode.AppendChild( damlTypeNode );
+			root.AppendChild( damlClassNode );
+			// Return xml document
+			return doc.OuterXml;
+		}
+	}
+}
diff --git a/csharpsrc/DAML/Wsdl2Daml.cs b/csharpsrc/DAML/Wsdl2Daml.cs
new file mode 100644
index 0000000..d8cae53
--- /dev/null
+++ b/csharpsrc/DAML/Wsdl2Daml.cs
@@ -0,0 +1,235 @@
+using System;
+using System.IO;
+using System.Net;
+using System.Web;
+using System.Web.Services;
+using System.Web.Services.Description;
+using System.Reflection;
+using System.CodeDom;
+using System.CodeDom.Compiler;
+using System.Collections;
+using System.Collections.Specialized;
+using Microsoft.CSharp;
+using PSL.DAML;
+
+namespace PSL.DAML.Tools
+{
+	/// <summary>
+	/// Given a wsdl file, build a daml process model consisting of
+	/// daml atomic processes
+	/// </summary>
+	public class Wsdl2DamlGen
+	{
+		public const string PROTOCOL = "SOAP";
+		public const string AUTO_GEN_NAMESPACE = "Wsdl2Daml";
+
+		public Wsdl2DamlGen()
+		{
+		}
+
+		public static string GenerateDaml( string strWsdlUrl )
+		{
+			// Read in Service Description from url
+			ServiceDescription svcDesc = ServiceDescription.Read( Wsdl2DamlGen.GetHttpStream( strWsdlUrl ) );
+
+			ServiceCollection svcColl = svcDesc.Services;
+
+			// Get the services in the service Description collection
+			// Expect only one
+			// for the first one create a DamlProcess instance (atomic process)
+			// for each method in the web service
+
+			if( svcColl.Count == 0 )
+				return "";
+
+			Service svc = svcColl[0];
+
+			// Generate assembly in memory representing web service proxy
+			// use reflection on it to get method data, inputs, outputs etc
+			// For each method we create a Daml atomic process
+			// and add data for its inputs, and outputs at least
+			// no provision to add data on preconditions etc.
+			// since more information would be needed than we get from
+			// the wsdl
+			Assembly proxyAssembly = GenerateAssembly( ref svcDesc );
+
+			if( proxyAssembly == null )
+				throw new Exception( "Error generating in memory web service proxy assembly" );
+
+			string strServiceName = Wsdl2DamlGen.AUTO_GEN_NAMESPACE + "." + svc.Name;
+
+			DamlProcessModelWriter damlWriter = new DamlProcessModelWriter();
+
+			// Get all the types defined in the assembly
+			Type[] arrTypes = proxyAssembly.GetTypes();
+			// Get the type representing the web service
+			Type proxyType = proxyAssembly.GetType( strServiceName, true );
+			// Ask for all its methods, these are our daml atomic process
+			// We only want the public instance methods declared at this type's level
+			// we are not interested in any inherited methods
+			MethodInfo[] arrMethods = proxyType.GetMethods( BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly );
+
+			for( int i = 0; i < arrMethods.Length; i++ )
+			{
+				// Get the current method
+				MethodInfo currMethod = arrMethods[i];
+				// Get the parameters expected by this method
+				ParameterInfo[] arrParams = currMethod.GetParameters();
+				// Get the return type of this method
+				Type returnType = currMethod.ReturnType;
+
+				// Flags whether we ignore or process this method
+				bool bIgnoreMethod = false;
+
+				// Ignore constructors and async methods
+				if( currMethod.IsConstructor || currMethod.ReturnType == typeof(System.IAsyncResult) )
+					continue;
+
+				for( int j = 0; j < arrParams.Length; j++ )
+				{
+					if( arrParams[j].ParameterType == typeof(System.IAsyncResult) )
+					{
+						bIgnoreMethod = true;
+						break;
+					}
+				}
+
+				if( bIgnoreMethod )
+					continue;
+
+				// We do not want any of the async methods
+				// filter based on paramters
+				// Basically any method that expects or returns
+				// System.IAsyncResult
+				// neither do we want the constructor(s)
+
+				DamlProcess process = new DamlProcess();
+				process.Name = currMethod.Name;
+
+				// Get the input and output types and add them to the process
+				for( int x = 0; x < arrParams.Length; x++ )
+				{
+					RdfProperty input = new RdfProperty();
+
+					// Set the name of the input
+					input.Name = arrParams[x].Name;
+					// Set domain - name of methd
+					input.Domain = process.Name;
+					// Set subproperty - set as a subProperty of Process Inputs
+					input.SubPropertyOf = DamlConstants.PROCESS_INPUT_URI;
+
+					// Map .NET type to DamlTypes - strings, decimals, daml+oil#Thing
+					input.Range = "http://www.daml.org/2001/03/daml+oil#Thing";
+
+					process.AddInput( input );
+
+					// Create input restriction
+					DamlRestriction restriction = new DamlRestriction();
+					// Set the cardinality
+					restriction.Cardinality = 1;
+					// Set the owner
+					restriction.Owner = input.Domain;
+					// Specify the property to which the restriction applies
+					restriction.OnProperty = "#" + input.Name;
+
+					// Add restriction to process
+					process.AddRestriction( enuIOPEType.Input, new DamlRestriction[] { restriction } );
+				}
+
+				// Add output to process
+				if( returnType.FullName != (typeof(void).FullName) )
+				{
+					RdfProperty output = new RdfProperty();
+
+					// Set the name of the input
+					output.Name = process.Name + "Out";
+					// Set domain - name of methd
+					output.Domain = process.Name;
+					// Set subproperty - set as a subProperty of Process Inputs
+					output.SubPropertyOf = DamlConstants.PROCESS_OUTPUT_URI;
+
+					// Map .NET type to DamlTypes - strings, decimals, daml+oil#Thing
+					output.Range = "http://www.daml.org/2001/03/daml+oil#Thing";
+
+					process.AddOutput( output );
+				}
+
+				// Add the process to the process model writer
+				damlWriter.AddDamlProcess( process );
+			}
+
+			return damlWriter.ToXml();
+		}
+
+		private static Assembly GenerateAssembly( ref ServiceDescription svcDesc )
+		{
+			try
+			{
+				ServiceDescriptionImporter sdImport = new ServiceDescriptionImporter();
+				// Set Protocol
+				sdImport.ProtocolName = PROTOCOL;
+				sdImport.AddServiceDescription( svcDesc, null, null );
+				// Set namespace for generated proxy
+				CodeNamespace cnSpace = new CodeNamespace( AUTO_GEN_NAMESPACE );
+				// Create new code compiled unit
+				CodeCompileUnit ccUnit = new CodeCompileUnit();
+				ServiceDescriptionImportWarnings sdiWarning = sdImport.Import( cnSpace, ccUnit );
+				// Pass CodeCOmpileUnit to a System.CodeDom.CodeProvder
+				// e.g. Microsoft.CSharp.CSharpCodeProvider to do the
+				// compilation.
+				CSharpCodeProvider cdp = new CSharpCodeProvider();
+				ICodeGenerator cg = cdp.CreateGenerator();
+				ICodeCompiler cc = cdp.CreateCompiler();
+
+				// Do compilation and proxy generation in memory
+				// Create stream writer that writes to a memory stream
+				// this will store the source we generate
+				MemoryStream sourceStream = new MemoryStream();
+				StreamWriter sw = new StreamWriter( sourceStream );
+
+				// Generate the code and put it in the stream writer
+				cg.GenerateCodeFromNamespace( cnSpace, sw, null );
+				// Flush the stream writer
+				sw.Flush();
+
+				TextReader reader = new StreamReader( sourceStream );
+				sourceStream.Seek( 0, System.IO.SeekOrigin.Begin );
+				string strSource = reader.ReadToEnd();
+
+				CompilerParameters cparams = new CompilerParameters( new String[] { "System.dll", "System.Xml.dll", "System.Web.Services.dll" } );
+
+				cparams.GenerateExecutable = false;
+				cparams.GenerateInMemory = true;
+				cparams.MainClass = svcDesc.Services[0].Name;
+				cparams.IncludeDebugInformation = true;
+
+				CompilerResults cr = cc.CompileAssemblyFromSource( cparams, strSource );
+				Assembly results = cr.CompiledAssembly;
+
+				sw.Close();
+
+				// If an empty assembly generated, return null
+				if( results.GetTypes().Length == 0 )
+					return null;
+
+				return results;
+			}
+			catch( Exception e )
+			{
+				string s = e.Message;
+			}
+
+			return null;
+		}
+
+		public static Stream GetHttpStream( string strURL )
+		{
+			// Create a web request
+			WebRequest objRequest = WebRequest.Create( strURL );
+			// Get the response
+			Stream objStream = objRequest.GetResponse().GetResponseStream();
+			// Return stream
+			return objStream;
+		}
+	}
+}
diff --git a/csharpsrc/DAML/XPathExprBuilders.cs b/csharpsrc/DAML/XPathExprBuilders.cs
index ef0cfaf..293bab4 100644
--- a/csharpsrc/DAML/XPathExprBuilders.cs
+++ b/csharpsrc/DAML/XPathExprBuilders.cs
@@ -14,11 +14,11 @@ namespace PSL.DAML
 		{
 			switch( filter )
 			{
-				case enuIOPESearchBy.PARAM_DESC: return  "/" + DAMLConstants.DEFAULT_NS + ":" + DAMLConstants.INPUT + "/" + DAMLConstants.PROFILE_PARAM_DESC;
+				case enuIOPESearchBy.PARAM_DESC: return  "/" + DamlConstants.DEFAULT_NS + ":" + DamlConstants.INPUT + "/" + DamlConstants.PROFILE_PARAM_DESC;

-				case enuIOPESearchBy.PARAM_NAME: return "/" + DAMLConstants.DEFAULT_NS + ":" + DAMLConstants.INPUT + "/" + DAMLConstants.PROFILE_PARAM_DESC + "[@" + DAMLConstants.RDF_ID + "]" + "/" + DAMLConstants.PROFILE_PARAM_NAME;
+				case enuIOPESearchBy.PARAM_NAME: return "/" + DamlConstants.DEFAULT_NS + ":" + DamlConstants.INPUT + "/" + DamlConstants.PROFILE_PARAM_DESC + "[@" + DamlConstants.RDF_ID + "]" + "/" + DamlConstants.PROFILE_PARAM_NAME;

-				case enuIOPESearchBy.REFERS_TO: return "/" + DAMLConstants.DEFAULT_NS + ":" + DAMLConstants.INPUT + "/" + DAMLConstants.PROFILE_PARAM_DESC + "[@" + DAMLConstants.RDF_ID + "]" + "/" + DAMLConstants.PROFILE_REFERS_TO;
+				case enuIOPESearchBy.REFERS_TO: return "/" + DamlConstants.DEFAULT_NS + ":" + DamlConstants.INPUT + "/" + DamlConstants.PROFILE_PARAM_DESC + "[@" + DamlConstants.RDF_ID + "]" + "/" + DamlConstants.PROFILE_REFERS_TO;

 				default: throw new ArgumentException( "Invalid filter value" );
 			};
@@ -31,7 +31,7 @@ namespace PSL.DAML
 			switch( filter )
 			{
 				case enuIOPESearchBy.PARAM_DESC: strXPath = BuildExpression( filter );
-												 strXPath += "[@" + DAMLConstants.RDF_ID + "='" + strSearchKey + "']";
+												 strXPath += "[@" + DamlConstants.RDF_ID + "='" + strSearchKey + "']";
 												 return strXPath;

 				case enuIOPESearchBy.PARAM_NAME: strXPath = BuildExpression( filter );
@@ -39,7 +39,7 @@ namespace PSL.DAML
 												 return strXPath;

 				case enuIOPESearchBy.REFERS_TO: strXPath = BuildExpression( filter );
-					strXPath += "[@" + DAMLConstants.RDF_RESOURCE + "='" + strSearchKey + "']";
+					strXPath += "[@" + DamlConstants.RDF_RESOURCE + "='" + strSearchKey + "']";
 					return strXPath;


@@ -58,11 +58,11 @@ namespace PSL.DAML
 		{
 			switch( filter )
 			{
-				case enuIOPESearchBy.PARAM_DESC: return  "/" + DAMLConstants.DEFAULT_NS + ":" + DAMLConstants.OUTPUT + "/" + DAMLConstants.PROFILE_PARAM_DESC;
+				case enuIOPESearchBy.PARAM_DESC: return  "/" + DamlConstants.DEFAULT_NS + ":" + DamlConstants.OUTPUT + "/" + DamlConstants.PROFILE_PARAM_DESC;

-				case enuIOPESearchBy.PARAM_NAME: return "/" + DAMLConstants.DEFAULT_NS + ":" + DAMLConstants.OUTPUT + "/" + DAMLConstants.PROFILE_PARAM_DESC + "[@" + DAMLConstants.RDF_ID + "]" + "/" + DAMLConstants.PROFILE_PARAM_NAME;
+				case enuIOPESearchBy.PARAM_NAME: return "/" + DamlConstants.DEFAULT_NS + ":" + DamlConstants.OUTPUT + "/" + DamlConstants.PROFILE_PARAM_DESC + "[@" + DamlConstants.RDF_ID + "]" + "/" + DamlConstants.PROFILE_PARAM_NAME;

-				case enuIOPESearchBy.REFERS_TO: return "/" + DAMLConstants.DEFAULT_NS + ":" + DAMLConstants.OUTPUT + "/" + DAMLConstants.PROFILE_PARAM_DESC + "[@" + DAMLConstants.RDF_ID + "]" + "/" + DAMLConstants.PROFILE_REFERS_TO;
+				case enuIOPESearchBy.REFERS_TO: return "/" + DamlConstants.DEFAULT_NS + ":" + DamlConstants.OUTPUT + "/" + DamlConstants.PROFILE_PARAM_DESC + "[@" + DamlConstants.RDF_ID + "]" + "/" + DamlConstants.PROFILE_REFERS_TO;

 				default: throw new ArgumentException( "Invalid filter value" );
 			};
@@ -75,7 +75,7 @@ namespace PSL.DAML
 			switch( filter )
 			{
 				case enuIOPESearchBy.PARAM_DESC: strXPath = BuildExpression( filter );
-					strXPath += "[@" + DAMLConstants.RDF_ID + "='" + strSearchKey + "']";
+					strXPath += "[@" + DamlConstants.RDF_ID + "='" + strSearchKey + "']";
 					return strXPath;

 				case enuIOPESearchBy.PARAM_NAME: strXPath = BuildExpression( filter );
@@ -83,7 +83,7 @@ namespace PSL.DAML
 					return strXPath;

 				case enuIOPESearchBy.REFERS_TO: strXPath = BuildExpression( filter );
-					strXPath += "[@" + DAMLConstants.RDF_RESOURCE + "='" + strSearchKey + "']";
+					strXPath += "[@" + DamlConstants.RDF_RESOURCE + "='" + strSearchKey + "']";
 					return strXPath;

 				default: throw new ArgumentException( "Invalid filter value" );
@@ -102,11 +102,11 @@ namespace PSL.DAML
 		{
 			switch( filter )
 			{
-				case enuIOPESearchBy.COND_DESC: return  "/" + DAMLConstants.DEFAULT_NS + ":" + DAMLConstants.PRECONDITION + "/" + DAMLConstants.PROFILE_CONDITION_DESC;
+				case enuIOPESearchBy.COND_DESC: return  "/" + DamlConstants.DEFAULT_NS + ":" + DamlConstants.PRECONDITION + "/" + DamlConstants.PROFILE_CONDITION_DESC;

-				case enuIOPESearchBy.COND_NAME: return "/" + DAMLConstants.DEFAULT_NS + ":" + DAMLConstants.PRECONDITION + "/" + DAMLConstants.PROFILE_CONDITION_DESC + "[@" + DAMLConstants.RDF_ID + "]" + "/" + DAMLConstants.PROFILE_CONDITION_NAME;
+				case enuIOPESearchBy.COND_NAME: return "/" + DamlConstants.DEFAULT_NS + ":" + DamlConstants.PRECONDITION + "/" + DamlConstants.PROFILE_CONDITION_DESC + "[@" + DamlConstants.RDF_ID + "]" + "/" + DamlConstants.PROFILE_CONDITION_NAME;

-				case enuIOPESearchBy.REFERS_TO: return "/" + DAMLConstants.DEFAULT_NS + ":" + DAMLConstants.PRECONDITION + "/" + DAMLConstants.PROFILE_CONDITION_DESC + "[@" + DAMLConstants.RDF_ID + "]" + "/" + DAMLConstants.PROFILE_REFERS_TO;
+				case enuIOPESearchBy.REFERS_TO: return "/" + DamlConstants.DEFAULT_NS + ":" + DamlConstants.PRECONDITION + "/" + DamlConstants.PROFILE_CONDITION_DESC + "[@" + DamlConstants.RDF_ID + "]" + "/" + DamlConstants.PROFILE_REFERS_TO;

 				default: throw new ArgumentException( "Invalid filter value" );
 			};
@@ -119,7 +119,7 @@ namespace PSL.DAML
 			switch( filter )
 			{
 				case enuIOPESearchBy.COND_DESC: strXPath = BuildExpression( filter );
-					strXPath += "[@" + DAMLConstants.RDF_ID + "='" + strSearchKey + "']";
+					strXPath += "[@" + DamlConstants.RDF_ID + "='" + strSearchKey + "']";
 					return strXPath;

 				case enuIOPESearchBy.COND_NAME: strXPath = BuildExpression( filter );
@@ -127,7 +127,7 @@ namespace PSL.DAML
 					return strXPath;

 				case enuIOPESearchBy.REFERS_TO: strXPath = BuildExpression( filter );
-					strXPath += "[@" + DAMLConstants.RDF_RESOURCE + "='" + strSearchKey + "']";
+					strXPath += "[@" + DamlConstants.RDF_RESOURCE + "='" + strSearchKey + "']";
 					return strXPath;

 				default: throw new ArgumentException( "Invalid filter value" );
@@ -145,11 +145,11 @@ namespace PSL.DAML
 		{
 			switch( filter )
 			{
-				case enuIOPESearchBy.COND_DESC: return  "/" + DAMLConstants.DEFAULT_NS + ":" + DAMLConstants.EFFECT + "/" + DAMLConstants.PROFILE_CONDITION_DESC;
+				case enuIOPESearchBy.COND_DESC: return  "/" + DamlConstants.DEFAULT_NS + ":" + DamlConstants.EFFECT + "/" + DamlConstants.PROFILE_CONDITION_DESC;

-				case enuIOPESearchBy.COND_NAME: return "/" + DAMLConstants.DEFAULT_NS + ":" + DAMLConstants.EFFECT + "/" + DAMLConstants.PROFILE_CONDITION_DESC + "[@" + DAMLConstants.RDF_ID + "]" + "/" + DAMLConstants.PROFILE_CONDITION_NAME;
+				case enuIOPESearchBy.COND_NAME: return "/" + DamlConstants.DEFAULT_NS + ":" + DamlConstants.EFFECT + "/" + DamlConstants.PROFILE_CONDITION_DESC + "[@" + DamlConstants.RDF_ID + "]" + "/" + DamlConstants.PROFILE_CONDITION_NAME;

-				case enuIOPESearchBy.REFERS_TO: return "/" + DAMLConstants.DEFAULT_NS + ":" + DAMLConstants.EFFECT + "/" + DAMLConstants.PROFILE_CONDITION_DESC + "[@" + DAMLConstants.RDF_ID + "]" + "/" + DAMLConstants.PROFILE_REFERS_TO;
+				case enuIOPESearchBy.REFERS_TO: return "/" + DamlConstants.DEFAULT_NS + ":" + DamlConstants.EFFECT + "/" + DamlConstants.PROFILE_CONDITION_DESC + "[@" + DamlConstants.RDF_ID + "]" + "/" + DamlConstants.PROFILE_REFERS_TO;

 				default: throw new ArgumentException( "Invalid filter value" );
 			};
@@ -161,7 +161,7 @@ namespace PSL.DAML
 			switch( filter )
 			{
 				case enuIOPESearchBy.COND_DESC: strXPath = BuildExpression( filter );
-					strXPath += "[@" + DAMLConstants.RDF_ID + "='" + strSearchKey + "']";
+					strXPath += "[@" + DamlConstants.RDF_ID + "='" + strSearchKey + "']";
 					return strXPath;

 				case enuIOPESearchBy.COND_NAME: strXPath = BuildExpression( filter );
@@ -169,7 +169,7 @@ namespace PSL.DAML
 					return strXPath;

 				case enuIOPESearchBy.REFERS_TO: strXPath = BuildExpression( filter );
-					strXPath += "[@" + DAMLConstants.RDF_RESOURCE + "='" + strSearchKey + "']";
+					strXPath += "[@" + DamlConstants.RDF_RESOURCE + "='" + strSearchKey + "']";
 					return strXPath;

 				default: throw new ArgumentException( "Invalid filter value" );