Hello,

            I am a student at Queen Mary & Westfield College University of London. We have been set a group project work to create a Vector-based Graphical Editor Component Suite. One of my tasks is to save and load a graph to an xml file. I read you sight but don’t quiet understand it, but had a go at creating mapping.xml file and tried to fill in the class and fields for our API package classes. I have included class diagrams of API and GUI packages, a zipped up version of our project so far in Together J 5.5 and Builder 5.0.296 and my attempt at mapping XML.

 

I would like to know if I am going about this in the right way if not, can you suggests a easer or better way, oh and have I correctly understood the syntax that I am suppose to be using in the mapping.xml file.

 

Lisa

Attachment: GraphCollection.java
Description: Binary data

Attachment: Node.java
Description: Binary data

Attachment: Graph.java
Description: Binary data

Attachment: Edge.java
Description: Binary data

<?xml version="1.0"?>
<!DOCTYPE mapping PUBLIC "-//EXOLAB/Castor Object Mapping DTD Version 1.0//EN" "http://Castor.exolab.org/mapping.dtd";> 
<mapping>
	<description>Description of the mapping</description>

                <include href="other_mapping_file.xml"/>

                <class name="API.Edge">
			<map-to xml = "Edge"/>
				<field name = "edgeID"
					type = "integer"
					requied = "true"
					direct  = "true"
					lazy = "false" 
					transient  = "false" 
					get-method = "getEdgeID()"
					set-method = "setEdgeID(int id)">
					<bind-xml name="edgeID" node="element"/>
				</field>

				<field name = "sourceNode"
					type = "API.Node"
					requied = "true"
					direct  = "false"
					lazy = "false" 
					transient  = "false" 
					get-method = "getSourceNode()"
					set-method = "setSourceNode(Node sn)">
					<bind-xml name="souceNode"/>
				</field>
				<field name = "destNode"
					type = "Node"
					requied = "true"
					direct  = "false"
					lazy = "false" 
					transient  = "false" 
					get-method = "getDestNode()"
					set-method = "setdestNode(Node dn)">
					<bind-xml name="destNode"/>
				</field>
                </class>

                <class name="API.Graph">
			<map-to xml = "Graph"/>
				<field name = "graphID"
					type = "integer"
					requied = "true"
					direct  = "true"
					lazy = "false" 
					transient  = "false" 
					get-method = "getGraphID()"
					set-method = "setGraphID(int id)">
					<bind-xml name="GraphID" node="element"/>
				</field>
				<field name = "edgeSet"
					type = "API.Edge"
					requied = "true"
					direct  = "false"
					lazy = "false" 
					transient  = "false" 
					get-method = "getEdgeSet()"
					set-method = "setEdgeSet(Vector e)"
					collection = "vector">
					<bind-xml name="edgeSet"/>
				</field>
				<field name = "nodeSet"
					type = "Node"
					requied = "true"
					direct  = "false"
					lazy = "false" 
					transient  = "false" 
					get-method = "getDestNode()"
					set-method = "setdestNode(Node n)"
					collection = "vector">
					<bind-xml name="destNode"/>
				</field>
                </class>

                <class name="API.GraphCollection">
			<map-to xml = "GraphCollection"/>
				<field name = "noOfGraphs"
					type = "integer"
					requied = "true"
					direct  = "true"
					lazy = "false" 
					transient  = "false" 
					get-method = "getNoOfGraphs()"
					set-method = "setNoOfGraphs(int n)">
					<bind-xml name="noOfGraphs" node="element"/>
				</field>
				<field name = "GraphList"
					type = "API.Graph"
					requied = "true"
					direct  = "false"
					lazy = "false" 
					transient  = "false" 
					get-method = "getGraphList()"
					set-method = "setGraphList()"
					collection = "vector">
					<bind-xml name="GraphList"/>
				</field>
                </class>

                <class name="API.Node">
				<field name= "NodeID"
					type = "integer"
					requied = "true"
					direct  = "true"
					lazy = "false" 
					transient  = "false" 
					get-method = "getNodeID()"
					set-method = "setNodeID(int id)">
					<bind-xml name="NodeID" node="element"/>
				</field>
				<field name= "edges"
					type = "API.Edge"
					requied = "true"
					direct  = "false"
					lazy = "false" 
					transient  = "false" 
					get-method = "getEdges()"
					set-method = "setEdges(Vector e)"
					collection = "vector">
					<bind-xml name="edges"/>
				</field>
				<field name= "neighbours"
					type = "API.Node"
					requied = "true"
					direct  = "false"
					lazy = "false" 
					transient  = "false" 
					get-method = "getNeighbours()"
					set-method = "setNeighbours(Vector e)"
					collection = "vector">
					<bind-xml name="neighbours"/>
				</field>
                </class>

                <class name="GUI.AllGraphDisplays">
                        .........
                </class>

                <class name="GUI.EdgeDisplay">
                        .........
                </class>

                <class name="GUI.GraphDisplay">
                        .........
                </class>

                <class name="GUI.LabelDisplay">
                        .........
                </class>

                <class name="GUI.NodeDisplay">
                        .........
                </class>

                <class name="GUI.Position">
                        .........
                </class>

</mapping>

Reply via email to