Click here to Skip to main content
15,896,606 members
Articles / Programming Languages / XSLT

XEML (Entity Markup Language) for Code Generation

Rate me:
Please Sign up or sign in to vote.
3.35/5 (9 votes)
13 Feb 2009GPL39 min read 50.2K   311   35  
XEML (Entity Markup Language) for Code Generation
<schema>
	<entities>
		<entity name="Categories" tableschema="dbo">
			<attributes>
				<attribute name="CategoryID" type="integer" sqltype="int" nullable="false" identity="true" pkey="true" />
				<attribute name="CategoryName" type="string" sqltype="nvarchar" length="15" nullable="false" />
				<attribute name="Description" type="text" sqltype="ntext" nullable="true" />
				<attribute name="Picture" type="binary" sqltype="image" nullable="true" />
			</attributes>
			<keys>
				<pkey name="PK_Categories">
					<key name="CategoryID" sqltype="int" />
				</pkey>
			</keys>
			<relationships>
				<relationship source="Categories" target="Products" type="0..*" />
			</relationships>
		</entity>
		<entity name="CustomerCustomerDemo" tableschema="dbo">
			<attributes>
				<attribute name="CustomerID" type="string" sqltype="nchar" length="5" nullable="false" pkey="true" fkey="true" />
				<attribute name="CustomerTypeID" type="string" sqltype="nchar" length="10" nullable="false" pkey="true" fkey="true" />
			</attributes>
			<keys>
				<pkey name="PK_CustomerCustomerDemo">
					<key name="CustomerID" sqltype="nchar" length="5" />
					<key name="CustomerTypeID" sqltype="nchar" length="10" />
				</pkey>
				<fkey name="FK_CustomerCustomerDemo">
					<key name="CustomerTypeID" parent="CustomerDemographics" sqltype="nchar" length="10" />
				</fkey>
				<fkey name="FK_CustomerCustomerDemo_Customers">
					<key name="CustomerID" parent="Customers" sqltype="nchar" length="5" />
				</fkey>
			</keys>
		</entity>
		<entity name="CustomerDemographics" tableschema="dbo">
			<attributes>
				<attribute name="CustomerTypeID" type="string" sqltype="nchar" length="10" nullable="false" pkey="true" />
				<attribute name="CustomerDesc" type="text" sqltype="ntext" nullable="true" />
			</attributes>
			<keys>
				<pkey name="PK_CustomerDemographics">
					<key name="CustomerTypeID" sqltype="nchar" length="10" />
				</pkey>
			</keys>
			<relationships>
				<relationship source="CustomerDemographics" target="CustomerCustomerDemo" type="0..*" />
			</relationships>
		</entity>
		<entity name="Customers" tableschema="dbo">
			<attributes>
				<attribute name="CustomerID" type="string" sqltype="nchar" length="5" nullable="false" pkey="true" />
				<attribute name="CompanyName" type="string" sqltype="nvarchar" length="40" nullable="false" />
				<attribute name="ContactName" type="string" sqltype="nvarchar" length="30" nullable="true" />
				<attribute name="ContactTitle" type="string" sqltype="nvarchar" length="30" nullable="true" />
				<attribute name="Address" type="string" sqltype="nvarchar" length="60" nullable="true" />
				<attribute name="City" type="string" sqltype="nvarchar" length="15" nullable="true" />
				<attribute name="Region" type="string" sqltype="nvarchar" length="15" nullable="true" />
				<attribute name="PostalCode" type="string" sqltype="nvarchar" length="10" nullable="true" />
				<attribute name="Country" type="string" sqltype="nvarchar" length="15" nullable="true" />
				<attribute name="Phone" type="string" sqltype="nvarchar" length="24" nullable="true" />
				<attribute name="Fax" type="string" sqltype="nvarchar" length="24" nullable="true" />
			</attributes>
			<keys>
				<pkey name="PK_Customers">
					<key name="CustomerID" sqltype="nchar" length="5" />
				</pkey>
			</keys>
			<relationships>
				<relationship source="Customers" target="CustomerCustomerDemo" type="0..*" />
				<relationship source="Customers" target="Orders" type="0..*" />
			</relationships>
		</entity>
		<entity name="Employees" tableschema="dbo">
			<attributes>
				<attribute name="EmployeeID" type="integer" sqltype="int" nullable="false" identity="true" pkey="true" />
				<attribute name="LastName" type="string" sqltype="nvarchar" length="20" nullable="false" />
				<attribute name="FirstName" type="string" sqltype="nvarchar" length="10" nullable="false" />
				<attribute name="Title" type="string" sqltype="nvarchar" length="30" nullable="true" />
				<attribute name="TitleOfCourtesy" type="string" sqltype="nvarchar" length="25" nullable="true" />
				<attribute name="BirthDate" type="datetime" sqltype="datetime" nullable="true" />
				<attribute name="HireDate" type="datetime" sqltype="datetime" nullable="true" />
				<attribute name="Address" type="string" sqltype="nvarchar" length="60" nullable="true" />
				<attribute name="City" type="string" sqltype="nvarchar" length="15" nullable="true" />
				<attribute name="Region" type="string" sqltype="nvarchar" length="15" nullable="true" />
				<attribute name="PostalCode" type="string" sqltype="nvarchar" length="10" nullable="true" />
				<attribute name="Country" type="string" sqltype="nvarchar" length="15" nullable="true" />
				<attribute name="HomePhone" type="string" sqltype="nvarchar" length="24" nullable="true" />
				<attribute name="Extension" type="string" sqltype="nvarchar" length="4" nullable="true" />
				<attribute name="Photo" type="binary" sqltype="image" nullable="true" />
				<attribute name="Notes" type="text" sqltype="ntext" nullable="true" />
				<attribute name="ReportsTo" type="integer" sqltype="int" nullable="true" fkey="true" />
				<attribute name="PhotoPath" type="string" sqltype="nvarchar" length="255" nullable="true" />
			</attributes>
			<keys>
				<pkey name="PK_Employees">
					<key name="EmployeeID" sqltype="int" />
				</pkey>
				<fkey name="FK_Employees_Employees">
					<key name="ReportsTo" parent="Employees" sqltype="int" />
				</fkey>
			</keys>
			<relationships>
				<relationship source="Employees" target="Employees" type="0..*" />
				<relationship source="Employees" target="EmployeeTerritories" type="0..*" />
				<relationship source="Employees" target="Orders" type="0..*" />
			</relationships>
		</entity>
		<entity name="EmployeeTerritories" tableschema="dbo">
			<attributes>
				<attribute name="EmployeeID" type="integer" sqltype="int" nullable="false" pkey="true" fkey="true" />
				<attribute name="TerritoryID" type="string" sqltype="nvarchar" length="20" nullable="false" pkey="true" fkey="true" />
			</attributes>
			<keys>
				<pkey name="PK_EmployeeTerritories">
					<key name="EmployeeID" sqltype="int" />
					<key name="TerritoryID" sqltype="nvarchar" length="20" />
				</pkey>
				<fkey name="FK_EmployeeTerritories_Employees">
					<key name="EmployeeID" parent="Employees" sqltype="int" />
				</fkey>
				<fkey name="FK_EmployeeTerritories_Territories">
					<key name="TerritoryID" parent="Territories" sqltype="nvarchar" length="20" />
				</fkey>
			</keys>
		</entity>
		<entity name="Order Details" tableschema="dbo">
			<attributes>
				<attribute name="OrderID" type="integer" sqltype="int" nullable="false" pkey="true" fkey="true" />
				<attribute name="ProductID" type="integer" sqltype="int" nullable="false" pkey="true" fkey="true" />
				<attribute name="UnitPrice" type="decimal" sqltype="money" nullable="false" precision="19" scale="4" />
				<attribute name="Quantity" type="integer" sqltype="smallint" nullable="false" />
				<attribute name="Discount" type="float" sqltype="real" nullable="false" />
			</attributes>
			<keys>
				<pkey name="PK_Order_Details">
					<key name="OrderID" sqltype="int" />
					<key name="ProductID" sqltype="int" />
				</pkey>
				<fkey name="FK_Order_Details_Orders">
					<key name="OrderID" parent="Orders" sqltype="int" />
				</fkey>
				<fkey name="FK_Order_Details_Products">
					<key name="ProductID" parent="Products" sqltype="int" />
				</fkey>
			</keys>
		</entity>
		<entity name="Orders" tableschema="dbo">
			<attributes>
				<attribute name="OrderID" type="integer" sqltype="int" nullable="false" identity="true" pkey="true" />
				<attribute name="CustomerID" type="string" sqltype="nchar" length="5" nullable="true" fkey="true" />
				<attribute name="EmployeeID" type="integer" sqltype="int" nullable="true" fkey="true" />
				<attribute name="OrderDate" type="datetime" sqltype="datetime" nullable="true" />
				<attribute name="RequiredDate" type="datetime" sqltype="datetime" nullable="true" />
				<attribute name="ShippedDate" type="datetime" sqltype="datetime" nullable="true" />
				<attribute name="ShipVia" type="integer" sqltype="int" nullable="true" fkey="true" />
				<attribute name="Freight" type="decimal" sqltype="money" nullable="true" precision="19" scale="4" />
				<attribute name="ShipName" type="string" sqltype="nvarchar" length="40" nullable="true" />
				<attribute name="ShipAddress" type="string" sqltype="nvarchar" length="60" nullable="true" />
				<attribute name="ShipCity" type="string" sqltype="nvarchar" length="15" nullable="true" />
				<attribute name="ShipRegion" type="string" sqltype="nvarchar" length="15" nullable="true" />
				<attribute name="ShipPostalCode" type="string" sqltype="nvarchar" length="10" nullable="true" />
				<attribute name="ShipCountry" type="string" sqltype="nvarchar" length="15" nullable="true" />
			</attributes>
			<keys>
				<pkey name="PK_Orders">
					<key name="OrderID" sqltype="int" />
				</pkey>
				<fkey name="FK_Orders_Customers">
					<key name="CustomerID" parent="Customers" sqltype="nchar" length="5" />
				</fkey>
				<fkey name="FK_Orders_Employees">
					<key name="EmployeeID" parent="Employees" sqltype="int" />
				</fkey>
				<fkey name="FK_Orders_Shippers">
					<key name="ShipVia" parent="Shippers" sqltype="int" />
				</fkey>
			</keys>
			<relationships>
				<relationship source="Orders" target="Order Details" type="0..*" />
			</relationships>
		</entity>
		<entity name="Products" tableschema="dbo">
			<attributes>
				<attribute name="ProductID" type="integer" sqltype="int" nullable="false" identity="true" pkey="true" />
				<attribute name="ProductName" type="string" sqltype="nvarchar" length="40" nullable="false" />
				<attribute name="SupplierID" type="integer" sqltype="int" nullable="true" fkey="true" />
				<attribute name="CategoryID" type="integer" sqltype="int" nullable="true" fkey="true" />
				<attribute name="QuantityPerUnit" type="string" sqltype="nvarchar" length="20" nullable="true" />
				<attribute name="UnitPrice" type="decimal" sqltype="money" nullable="true" precision="19" scale="4" />
				<attribute name="UnitsInStock" type="integer" sqltype="smallint" nullable="true" />
				<attribute name="UnitsOnOrder" type="integer" sqltype="smallint" nullable="true" />
				<attribute name="ReorderLevel" type="integer" sqltype="smallint" nullable="true" />
				<attribute name="Discontinued" type="boolean" sqltype="bit" nullable="false" />
			</attributes>
			<keys>
				<pkey name="PK_Products">
					<key name="ProductID" sqltype="int" />
				</pkey>
				<fkey name="FK_Products_Categories">
					<key name="CategoryID" parent="Categories" sqltype="int" />
				</fkey>
				<fkey name="FK_Products_Suppliers">
					<key name="SupplierID" parent="Suppliers" sqltype="int" />
				</fkey>
			</keys>
			<relationships>
				<relationship source="Products" target="Order Details" type="0..*" />
			</relationships>
		</entity>
		<entity name="Region" tableschema="dbo">
			<attributes>
				<attribute name="RegionID" type="integer" sqltype="int" nullable="false" pkey="true" />
				<attribute name="RegionDescription" type="string" sqltype="nchar" length="50" nullable="false" />
			</attributes>
			<keys>
				<pkey name="PK_Region">
					<key name="RegionID" sqltype="int" />
				</pkey>
			</keys>
			<relationships>
				<relationship source="Region" target="Territories" type="0..*" />
			</relationships>
		</entity>
		<entity name="Shippers" tableschema="dbo">
			<attributes>
				<attribute name="ShipperID" type="integer" sqltype="int" nullable="false" identity="true" pkey="true" />
				<attribute name="CompanyName" type="string" sqltype="nvarchar" length="40" nullable="false" />
				<attribute name="Phone" type="string" sqltype="nvarchar" length="24" nullable="true" />
			</attributes>
			<keys>
				<pkey name="PK_Shippers">
					<key name="ShipperID" sqltype="int" />
				</pkey>
			</keys>
			<relationships>
				<relationship source="Shippers" target="Orders" type="0..*" />
			</relationships>
		</entity>
		<entity name="Suppliers" tableschema="dbo">
			<attributes>
				<attribute name="SupplierID" type="integer" sqltype="int" nullable="false" identity="true" pkey="true" />
				<attribute name="CompanyName" type="string" sqltype="nvarchar" length="40" nullable="false" />
				<attribute name="ContactName" type="string" sqltype="nvarchar" length="30" nullable="true" />
				<attribute name="ContactTitle" type="string" sqltype="nvarchar" length="30" nullable="true" />
				<attribute name="Address" type="string" sqltype="nvarchar" length="60" nullable="true" />
				<attribute name="City" type="string" sqltype="nvarchar" length="15" nullable="true" />
				<attribute name="Region" type="string" sqltype="nvarchar" length="15" nullable="true" />
				<attribute name="PostalCode" type="string" sqltype="nvarchar" length="10" nullable="true" />
				<attribute name="Country" type="string" sqltype="nvarchar" length="15" nullable="true" />
				<attribute name="Phone" type="string" sqltype="nvarchar" length="24" nullable="true" />
				<attribute name="Fax" type="string" sqltype="nvarchar" length="24" nullable="true" />
				<attribute name="HomePage" type="text" sqltype="ntext" nullable="true" />
			</attributes>
			<keys>
				<pkey name="PK_Suppliers">
					<key name="SupplierID" sqltype="int" />
				</pkey>
			</keys>
			<relationships>
				<relationship source="Suppliers" target="Products" type="0..*" />
			</relationships>
		</entity>
		<entity name="Territories" tableschema="dbo">
			<attributes>
				<attribute name="TerritoryID" type="string" sqltype="nvarchar" length="20" nullable="false" pkey="true" />
				<attribute name="TerritoryDescription" type="string" sqltype="nchar" length="50" nullable="false" />
				<attribute name="RegionID" type="integer" sqltype="int" nullable="false" fkey="true" />
			</attributes>
			<keys>
				<pkey name="PK_Territories">
					<key name="TerritoryID" sqltype="nvarchar" length="20" />
				</pkey>
				<fkey name="FK_Territories_Region">
					<key name="RegionID" parent="Region" sqltype="int" />
				</fkey>
			</keys>
			<relationships>
				<relationship source="Territories" target="EmployeeTerritories" type="0..*" />
			</relationships>
		</entity>
	</entities>
</schema>

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The GNU General Public License (GPLv3)


Written By
Software Developer (Senior) Lattice Business Software
United States United States
I am developer of LatticeFramework Studio, fully implemented in C#, a model-driven rapid application development tool.

Comments and Discussions