<?xml version='1.0'?>

<!-- XML schema for XGMML 1.0 -->
<!-- Authors: John Punin and Mukkai Krishnamoorthy -->
<!-- Computer Science Department -->
<!-- Rensselaer Polytechnic Institute -->
<!-- xgmml.xsd,v 1.0 03/02/2000 -->

<!DOCTYPE schema PUBLIC "-//W3C//DTD XMLSCHEMA 19991216//EN" "structures.dtd" [
<!ATTLIST schema xmlns:xml CDATA #IMPLIED
		 xmlns:xlink CDATA #IMPLIED
		 xmlns:xgmml CDATA #IMPLIED> 
                 <!-- keep this schema XML1.0 valid -->
]>

<schema xmlns="http://www.w3.org/1999/XMLSchema" 
	targetNamespace="http://www.cs.rpi.edu/XGMML" 
	xmlns:xml="http://www.w3.org/XML/1998/namespace"
	xmlns:xlink="http://www.w3.org/1999/xlink"
	xmlns:xgmml="http://www.cs.rpi.edu/XGMML" 
	version="xgmml 1.0">

<!-- get access to the xml: attribute groups for xml:lang -->
<import namespace="http://www.w3.org/XML/1998/namespace" 
	schemaLocation="http://www.w3.org/XML/1998/xml.xsd"/>

<!-- Boolean type -->
<simpleType name="boolean.type" base="non-negative-integer">
	  <enumeration value="0"/>
	  <enumeration value="1"/>
</simpleType>

<!-- Positive number type -->
<simpleType name="number.type" base="non-negative-integer"/>

<!-- String type -->
<simpleType name="string.type" base="string"/>

<!-- URI type -->
<simpleType name="uri.type" base="uri-reference"/>

<!-- Anchor type -->
<simpleType name="anchor.type" base="NMTOKEN">
	  <enumeration value="c"/>
	  <enumeration value="n"/>
	  <enumeration value="ne"/>
	  <enumeration value="e"/>
	  <enumeration value="se"/>
	  <enumeration value="s"/>
	  <enumeration value="sw"/>
	  <enumeration value="w"/>
	  <enumeration value="nw"/>
</simpleType>

<!-- Graphics Type  -->
<simpleType name="type-graphics.type" base="NMTOKEN">

<!-- Type of Graphics (GML types) type-graphics-gml.type -->
	  <enumeration value="arc"/>
	  <enumeration value="bitmap"/>
	  <enumeration value="image"/>
	  <enumeration value="line"/>
	  <enumeration value="oval"/>
	  <enumeration value="polygon"/>
	  <enumeration value="rectangle"/>
	  <enumeration value="text"/>

<!-- Type of Graphics (New types) type-graphics-app.type -->
	  <enumeration value="box"/>
	  <enumeration value="circle"/>
	  <enumeration value="ver_ellipsis"/>
	  <enumeration value="hor_ellipsis"/>
	  <enumeration value="rhombus"/>
	  <enumeration value="triangle"/>
	  <enumeration value="pentagon"/>
	  <enumeration value="hexagon"/>
	  <enumeration value="octagon"/>
</simpleType>

<!-- Line types -->
<!-- Arrow type -->
<simpleType name="arrow.type" base="NMTOKEN">
	  <enumeration value="none"/>
	  <enumeration value="first"/>
	  <enumeration value="last"/>
	  <enumeration value="both"/>
</simpleType>

<!-- Capstyle type -->
<simpleType name="capstyle.type" base="NMTOKEN">
	  <enumeration value="butt"/>
	  <enumeration value="projecting"/>
	  <enumeration value="round"/>
</simpleType>

<!-- Joinstyle type -->
<simpleType name="joinstyle.type" base="NMTOKEN">
	  <enumeration value="bevel"/>
	  <enumeration value="miter"/>
	  <enumeration value="round"/>
</simpleType>

<!-- Arc style  type -->
<simpleType name="arcstyle.type" base="NMTOKEN">
	  <enumeration value="pieslice"/>
	  <enumeration value="chord"/>
	  <enumeration value="arc"/>
</simpleType>

<!-- Text types -->
<!-- Text justification type -->
<simpleType name="justify.type" base="NMTOKEN">
	  <enumeration value="left"/>
	  <enumeration value="right"/>
	  <enumeration value="center"/>
</simpleType>

<!-- Font type -->
<simpleType name="font.type" base="string"/>

<!-- Color type -->
<simpleType name="color.type" base="string"/>

<!-- Angle type -->
<!-- Number followed by unit identifier (deg, grad or rad)  -->
<simpleType name="angle.type" base="string">
	  <pattern value="(\+|-)?\d*(deg|grad|rad)?"/>
</simpleType>

<!-- Object type -->
<simpleType name="object.type" base="NMTOKEN">
	  <enumeration value="list"/>
	  <enumeration value="string"/>
	  <enumeration value="real"/>
	  <enumeration value="integer"/>
</simpleType>

<!-- Global Attributes -->
<attributeGroup name="global-atts">
		<attribute name="id" type="xgmml:number.type"/>
		<attribute name="name" type="xgmml:string.type"/>
		<attribute name="label" type="xgmml:string.type"/>
		<attribute name="labelanchor" type="xgmml:string.type"/>
</attributeGroup>

<!-- Standard XML Attributes -->
<attributeGroup name="xml-atts">
		<attribute name="xmlns" type="string" 
		           fixed="http://www.cs.rpi.edu/XGMML"/>
		<attributeGroup ref="xml:lang"/>
		<attributeGroup ref="xml:space"/>
</attributeGroup>

<!-- Standard XLink Attributes -->
<!-- XLink type values -->
<simpleType name="xlink.type" base="NMTOKEN">
	  <enumeration value="simple"/>
	  <enumeration value="extended"/>
	  <enumeration value="locator"/>
	  <enumeration value="arc"/>
</simpleType>

<!-- XLink show values -->
<simpleType name="xlink.show" base="NMTOKEN">
	  <enumeration value="new"/>
	  <enumeration value="embed"/>
	  <enumeration value="replace"/>
</simpleType>

<!-- XLink actuate values -->
<simpleType name="xlink.actuate" base="NMTOKEN">
	  <enumeration value="onLoad"/>
	  <enumeration value="onRequest"/>
</simpleType>

<!-- Attributes of XLink -->
<attributeGroup name="xlink-atts">
		<attribute name="xmlns:xlink" type="string" 
		           fixed="http://www.w3.org/1999/xlink"/>
		<attribute name="xlink:type" type="xgmml:xlink.type" 
		           default="simple"/>
		<attribute name="xlink:role" type="string"/>
		<attribute name="xlink:title" type="string"/>
		<attribute name="xlink:show" type="xgmml:xlink.show" 
		           default="replace"/>
		<attribute name="xlink:actuate" type="xgmml:xlink.actuate" 
		           default="onRequest"/>
		<attribute name="xlink:href" type="xgmml:uri.type"/>
</attributeGroup>

<!-- Safe Graph Attributes -->
<attributeGroup name="graph-atts-safe">
		<attribute name="directed" type="xgmml:boolean.type" default="0"/>
</attributeGroup>

<!-- Unsafe Graph Attributes (GML) -->
<attributeGroup name="graph-atts-gml-unsafe">
		<attribute name="Vendor" type="xgmml:string.type"/>
</attributeGroup>

<!-- Unsafe Graph Attributes (new attributes) (Graphics attributes) -->
<attributeGroup name="graph-atts-app-unsafe-gr">
		<attribute name="Scale" type="integer"/>
		<attribute name="Layout" type="xgmml:string.type"/>
		<attribute name="Graphic" type="xgmml:boolean.type"/>
</attributeGroup>

<!-- Unsafe Graph Attributes (new attributes) (Structural attributes) -->
<attributeGroup name="graph-atts-app-unsafe-ngr">
		<attribute name="Rootnode" type="xgmml:number.type"/>
</attributeGroup>

<!-- Simple Graph (Structural graph) -->
<complexType name="simpleGraph">
      <element name="att" minOccurs="0" maxOccurs="*"/>
      <group>
        <choice minOccurs="0" maxOccurs="*">
            <element name="node"/>
	    <element name="edge"/>
	</choice>
      </group>
      <element name="att" minOccurs="0" maxOccurs="*"/>
      <attributeGroup ref="xgmml:global-atts"/>
      <attributeGroup ref="xgmml:graph-atts-safe"/>
      <attributeGroup ref="xgmml:graph-atts-gml-unsafe"/>
      <attributeGroup ref="xgmml:graph-atts-app-unsafe-ngr"/>
</complexType>

<!-- Graphical Graph "is a" Simple Graph -->
<complexType name="graphicGraph" base="xgmml:simpleGraph" 
	     derivedBy="extension">
      <attributeGroup ref="xgmml:graph-atts-app-unsafe-gr"/>
</complexType>

<!-- Graph Element -->
<element name="graph" type="xgmml:graphicGraph"/>

<!-- Safe Node Attributes (GML) -->
<attributeGroup name="node-atts-gml-safe">
		<attribute name="edgeanchor" type="xgmml:string.type"/>
</attributeGroup>

<!-- Safe Node Attributes (new attributes) -->
<attributeGroup name="node-atts-app-safe">
		<attribute name="weight" type="xgmml:string.type"/>
</attributeGroup>

<!-- Simple Node (Structural Node) -->
<complexType name="simpleNode">
      <element name="att" minOccurs="0" maxOccurs="*"/>
      <attributeGroup ref="xgmml:global-atts"/>
      <attributeGroup ref="xgmml:node-atts-app-safe"/>
</complexType>

<!-- Graphical Node "is a" Simple Node -->
<complexType name="graphicNode" base="xgmml:simpleNode" derivedBy="extension">
      <element name="graphics" minOccurs="0"/>
      <attributeGroup ref="xgmml:node-atts-gml-safe"/>
</complexType>

<!-- Node Element -->
<element name="node" type="xgmml:graphicNode"/>

<!-- Safe Edge Attributes (GML) -->
<attributeGroup name="edge-atts-gml-safe">
    <attribute name="source" type="xgmml:number.type" minOccurs="1" 
               maxOccurs="1"/>
    <attribute name="target" type="xgmml:number.type" minOccurs="1" 
               maxOccurs="1"/>
</attributeGroup>

<!-- Safe Edge Attributes (new attributes) -->
<attributeGroup name="edge-atts-app-safe">
		<attribute name="weight" type="xgmml:string.type"/>
</attributeGroup>

<!-- Simple Edge (Structural Edge) -->
<complexType name="simpleEdge">
      <element name="att" minOccurs="0" maxOccurs="*"/>
      <attributeGroup ref="xgmml:global-atts"/>
      <attributeGroup ref="xgmml:edge-atts-gml-safe"/>
      <attributeGroup ref="xgmml:edge-atts-app-safe"/>
</complexType>

<!-- Graphical Edge "is a" Simple Edge -->
<complexType name="graphicEdge" base="xgmml:simpleEdge" derivedBy="extension">
      <element name="graphics" minOccurs="0"/>
</complexType>

<!-- Edge Element -->
<element name="edge" type="xgmml:graphicEdge"/>

<!-- Graphics Type  -->
<attributeGroup name="graphics-type-att">
		<attribute name="type" type="xgmml:type-graphics.type"/>
</attributeGroup>

<!-- Point Attributes (x,y,z)  -->
<attributeGroup name="point-atts">
		<attribute name="x" type="double"/>
		<attribute name="y" type="double"/>
		<attribute name="z" type="double"/>
</attributeGroup>

<!-- Dimension Attributes (width,height,depth)  -->
<attributeGroup name="dimension-atts">
		<attribute name="w" type="double"/>
		<attribute name="h" type="double"/>
		<attribute name="d" type="double"/>
</attributeGroup>

<!-- External Attributes (Image and Bitmap)  -->
<attributeGroup name="external-atts">
		<attribute name="image" type="xgmml:uri.type"/>
		<attribute name="bitmap" type="xgmml:uri.type"/>
</attributeGroup>

<!-- Line Attributes -->
<attributeGroup name="line-atts">
		<attribute name="width" type="xgmml:number.type"/>
		<attribute name="arrow" type="xgmml:arrow.type"/>
		<attribute name="capstyle" type="xgmml:capstyle.type"/>
		<attribute name="joinstyle" type="xgmml:joinstyle.type"/>
		<attribute name="smooth" type="xgmml:boolean.type"/>
		<attribute name="splinesteps" type="xgmml:number.type"/>
</attributeGroup>

<!-- Text Attributes -->
<attributeGroup name="text-atts">
		<attribute name="justify" type="xgmml:justify.type"/>
		<attribute name="font" type="xgmml:font.type"/>
</attributeGroup>

<!-- Bitmap Attributes -->
<attributeGroup name="bitmap-atts">
		<attribute name="background" type="xgmml:color.type"/>
		<attribute name="foreground" type="xgmml:color.type"/>
</attributeGroup>

<!-- Arc Attributes -->
<attributeGroup name="arc-atts">
		<attribute name="extent" type="integer"/>
		<attribute name="start" type="integer"/>
		<attribute name="style" type="xgmml:arcstyle.type"/>
</attributeGroup>

<!-- Graphical Object Attributes -->
<attributeGroup name="object-atts">
		<attribute name="stipple" type="xgmml:string.type"/>
		<attribute name="visible" type="xgmml:boolean.type"/>
		<attribute name="fill" type="xgmml:color.type"/>
		<attribute name="outline" type="xgmml:color.type"/>
		<attribute name="anchor" type="xgmml:anchor.type"/>
</attributeGroup>

<!-- Graphics Element -->
<element name="graphics">
     <complexType>
	 <group>
	    <choice minOccurs="0" maxOccurs="1">
	        <element ref="xgmml:Line"/>
                <element ref="xgmml:center"/>
	    </choice>
	 </group>
	 <element name="att" minOccurs="0" maxOccurs="*"/>
	 <attributeGroup ref="xgmml:graphics-type-att"/>
	 <attributeGroup ref="xgmml:point-atts"/>
	 <attributeGroup ref="xgmml:dimension-atts"/>
	 <attributeGroup ref="xgmml:external-atts"/>
	 <attributeGroup ref="xgmml:line-atts"/>
	 <attributeGroup ref="xgmml:text-atts"/>
	 <attributeGroup ref="xgmml:bitmap-atts"/>
	 <attributeGroup ref="xgmml:arc-atts"/>
	 <attributeGroup ref="xgmml:object-atts"/>
     </complexType>
</element>

<!-- Center Point Element -->
<element name="center">
     <complexType content="empty">
	 <attributeGroup ref="xgmml:point-atts"/>
     </complexType>
</element>

<!-- Line Element -->
<element name="Line">
     <complexType content="empty">
	 <element name="point" minOccurs="2" maxOccurs="*"/>
     </complexType>
</element>

<!-- Point Element -->
<element name="point">
     <complexType content="empty">	 
	 <attributeGroup ref="xgmml:point-atts"/>
     </complexType>
</element>

<!-- Value Attribute -->
<attributeGroup name="attribute-value">
		<attribute name="value" type="xgmml:string.type"/>
</attributeGroup>

<!-- Type Attribute -->
<attributeGroup name="attribute-type">
		<attribute name="type" type="xgmml:object.type"/>
</attributeGroup>

<!-- Att Element -->
<element name="att">
     <complexType content="mixed">
	 <element name="att" minOccurs="0" maxOccurs="*"/>
	 <element name="graph" minOccurs="0" maxOccurs="*"/>
	 <attributeGroup ref="xgmml:global-atts"/>
	 <attributeGroup ref="xgmml:attribute-value"/>
	 <attributeGroup ref="xgmml:attribute-value"/>
     </complexType>
</element>

</schema>



