Object-Oriented VPF/DNC Database Modeling

Download Report

Transcript Object-Oriented VPF/DNC Database Modeling

Object-Oriented VPF/DNC
Database Modeling
Hong and Rahael
VPF vs DNC
• VPF is a vector formatted database storage
for GIS data (Vector product format)
• DNC implements VPF, Digital Nautical
Chart
• They are plain file structure
Introduction to DNC
• The whole earth could be divided into small
parts for mapping
• A DNC database only maps to a small
portion of the earth map
Introduction to DNC
Database
DNC LIB Dir
1 Browse Lib Dir
14 Coverages
3 coverages
Primitive Dirs
Primitives
Intro to DNC
• DNC03: 03 represents the disc number
geographically. At the database level, only
Database Header Table and Library
Attribute Table
• A library is a collection of coverages
sharing the same tiling structure and
coordinate system.
Intro to DNC
• DNC has 4 Libs: Harbor (H), Approach (A), Coastal
(COA), General (GEN). In addition, there is a single
BROWSE library.
• Each Lib except BROWSE contains up to 14 Coverages.
• At Lib level, only Library Header Table (LHT),
Geographic reference table and Coverage Attribute table
• A coverage is composed of one or more feature class types
stored in a coverage directory. Features: area, line, point
and text -> face, ring, edge, nodes, text
Intro To DNC
• In non-browse Libs, there may have: CUL, ECR, ENV,
HYD, IWY, LCR, LIM, NAV, OBS, POR, REL, DQY,
TILEREF, and LIBREF coverages
• Tables: FCS, .FIT, FCA, NOTES.RAT, *.NJT, *.AJT,
*.LJT, CHAR.VDT, INT.VDT, and tables for primitives
• The topology level of each coverage is defined by the
types of the feature classes present: 0, 1, 2, 3.
• We only concern the topology level 3
Intro To DNC
• Tileref and Libref are mandatory for tiled libraries. Tileref
contains an area feature table and primitive tables which
relate the tile names and areas.
• Libref contains a line feature table and primitive tables
needed to draw a small scale depiction of the coverage
• So, these two coverages have to be taken into
consideration first before all other coverages for a Lib
Intro to DNC
• So, a database is composed of five types of Libraries each
of which is composed of upto 14 coverages that layer over
each other
• Inside each coverage, features are the core part that depict
each coverage
• Features are grouped into different classes: point, line, area
and text.
• Each feature is a collection of primitives in geographic
order
DNC File Structure
Database
Library
…
Coverage
…..
[Tile] and Feature Class
Feature & Primitives
……...
………...
DNC OOM
• DNC file structure is a tree
• Perfectly matches to Object-oriented tree
navigation model
• OOM is a navigation architecture in which
each object is identified by an unique ID
• Different OOMs may have different
architectures
What We Need?
interface
access
agents
Database
Data
retrieved
What We Need?
• We need an interface to bridge the agents
and the database no matter in what form the
database is. The interface is actually a
simple DBMS
• The interface could either arm the agents
with XML format data, or simply assign
objects to agents for later usage
What We Need
• For database compatibility, we do not want
to modify the DNC database structure
• For better usage and future enhancements, it
is ok to store everything in Object forms -requires to build our own database structure
• Which way to go?
What We Need
• Of course the easiest way is to build our
DBMS on the existing file structure
• The DBMS interface is OOD
• The DBMS underline implementation is
then Object-Oriented-Relational
• Temporarily for easy illustration, let’s give
it a name: “OOH”
Architecture of OOH
Clients
OO Interface
OO-Relational Impl
DNC File System
OOH Package Architecture
org.usm.vpf.dnc
exception
database
.impl
internal
.impl
DNC File Structure
Database
Library
…
Coverage
…..
[Tile] and Feature Class
Feature & Primitives
……...
………...
Database
Library
Coverage
VirtualTile
FeatureManager
Primitives
Features
Class DatabaseTreeNode
•
•
•
public interface DatabaseTreeNode extends
java.io.Serializable
{
– public DatabaseTreeNode findNode(NodeID ID);
– public NodeID getIDObject();
– public Object getParentObject();
– public MetaData getMetaData();
– public XMLObject toXML();
– public void noParent(boolean noParent);
– public NodeConstraint getConstraint();
– public void validate() throws
ConstraintViolatedException;
}
DataManager
• A database manager manages a group of DatabaseTreeNodes that are
of the same level and same type. For example, a group of Features in a
coverage is organized as a Feature class, which could be managed by a
FeatureManager.
• The basic functions of a DataManager are:
1. Find a Node that is managed by it
2. On finding, return a proxy of the Node for RW. However, since
RW happens on proxy, no affect on the original
FeatureManager, PrimitiveManager, EntityNodeManager,
ConnectedNodeManager, EdgeManager, FaceManager, TextManager,
NotesManager
Class DataManager
• public interface DataManager extends
java.io.Serializable
• {
– public Object findData(NodeID ID);
– public void commit() throws
InvalidTableUpdateException,Constrain
tViolatedException;
• }
Class Database
• public interface Database extends DatabaseTreeNode
• {
– public DatabaseMetaData getDatabaseMetaData();
– public Vector getAllLibraries();
– public String getRootDir();
– public void setRootDir(String root);
– public void dbStart() throws
DatabaseDefectException,DatabaseFailedException;
– public void dbStop() throws
DatabaseFailedException;
• }
Class Library
•
•
public interface Library extends DatabaseTreeNode
{
–
–
–
–
–
–
–
–
–
–
–
–
•
}
public String getName();
public LibraryMetaData getLibraryMetaData();
public Database getDatabaseObject();
public GeographicExtent getGeographicExtent();
public boolean isTiled();
public boolean isBrowseLibrary();
public GeographicReference getGeographicReference();
public TileScheme getTileScheme();
public LibrefScheme getLibrefScheme();
public Vector getAllCoverages();
public Coverage find(String coverageName) throws
CoverageNotExistException;
public String getFilePath();
Class Coverage
•
•
public interface Coverage extends DatabaseTreeNode
{
–
–
–
–
–
–
–
–
–
–
–
•
}
public String getFilePath();
public Vector getFeatureManagers();
public FeatureManager find(String name);
public FeatureManager find(NodeID featureManagerID);
public CoverageMetaData getCoverageMetaData();
public Library getLibrary();
public VirtualTile getTile(int tileID);
public VirtualTile getTile();
public void load() throws CoverageNotExistException,
TileSchemeConflictException;
public void unload();
public boolean isLoaded();
Class VirtualTile
• public interface VirtualTile extends DatabaseTreeNode
• {
– public Coverage getCoverage();
– public EntityNodeManager getEntityNodeManager();
– public ConnectedNodeManager
getConnectedNodeManager();
– public EdgeManager getEdgeManager();
– public FaceManager getFaceManager();
– public TextManager getTextManager();
– public String getFilePath();
• }
Class FeatureManager
•
•
•
public abstract class FeatureManager implements
DatabaseTreeNode,DataManager
{
– public abstract Coverage getCoverage();
– public abstract Feature findFeature(int ID);
– public abstract Vector getAllFeatures();
– public abstract byte getFeatureType();
– public abstract String getName();
– public abstract String getDescription();
}
Class Feature
•
•
•
•
•
•
public abstract class Feature implements DatabaseTreeNode
{
public final static byte POINT_FEATURE = 1;
public final static byte LINE_FEATURE = 2;
public final static byte AREA_FEATURE = 3;
public final static byte TEXT_FEATURE = 0;
–
–
–
–
–
–
–
–
–
–
–
•
}
public
public
public
public
public
public
public
public
public
public
abstract
abstract
abstract
abstract
abstract
abstract
abstract
abstract
abstract
abstract
FeatureManager getMyManager();
byte getFeatureType();
int getCurrentLevelID();
String getName();
Vector getPrimitives();
void updatePrim(Primitive previous, Primitive current);
Object[][] getAttributeAndValues();
Vector getReferencedNotes();
ComparableFeature getComparable(boolean noTopology);
ComparableFeature getComparable(boolean noTopology,
FeatureComparisonAlgorithm myAlgorithm);
Class Primitive
•
•
•
•
•
•
•
•
•
•
public abstract class Primitive
{
public final static byte ENTITYNODE = 0;
public final static byte CONNECTEDNODE = 1;
public final static byte EDGE = 2;
public final static byte FACE = 3;
public final static byte text = 10;
protected byte m_type;
– public byte getType(){
return m_type;
}
–
–
–
–
–
•
}
protected void setType(byte type){
this.m_type = type;
}
public abstract DataManager getDataManager();
public abstract Vector getReferencedFeatures();
Class EntityNode
• public abstract class EntityNode extends
Primitive implements DatabaseTreeNode
• {
– public abstract EntityNodeManager
getMyManager();
– public abstract Face getContainingFace();
–
public abstract void
setContainingFace(Face f);
– public abstract double[] getCordinates();
– public abstract void setCordinates(double[]
cordinates);
• }
ConnectedNode
• public abstract class ConnectedNode
extends Primitive implements
DatabaseTreeNode
• {
– public abstract
getMyManager();
– public abstract
– public abstract
– public abstract
– public abstract
cordinates);
• }
ConnectedNodeManager
Face getFirstEdge();
void setFirstEdge(Edge e);
double[] getCordinates();
void setCordinates(double[]
Edge
•
•
•
•
•
•
•
•
•
•
public abstract class Edge extends Primitive implements
DatabaseTreeNode
{
– public abstract EdgeManager getMyManager();
public abstract ConnectedNode getStartNode();
public abstract ConnectedNode getEndNode();
public abstract Face getRightFace();
– public abstract Face getNearbyRightFace();
public abstract Face getLeftFace();
– public abstract Face getNearbyLeftFace();
public abstract Edge getRightEdge();
– public abstract Edge getNearbyRightEdge();
public abstract Edge getLeftEdge();
– public abstract Edge getNearbyLeftEdge();
– public abstract double[][] getCordinates();
public abstract void setCordinates(double[][] cordinates);
– public abstract GeographicExtent getGeographicExtent();
}
Class Face
• public abstract class Face extends Primitive
implements DatabaseTreeNode
• {
– public abstract FaceManager getMyManager();
– public abstract Vector getAllEdges();
– public abstract Vector getInnerFaces();
– public abstract GeographicExtent
getGeographicExtent();
• }
Class LineFeature
• public abstract class LineFeature extends
Feature
• {
•
public byte getType()
•
{
•
return Feature.LINE_FEATURE;
•
}
– public abstract Vector getEdges();
– public abstract Vector getConnectedNodes();
• }
Class TopologyManager
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
public
{
public
public
public
public
public
public
public
public
public
public
}
interface TopologyManager extends java.io.Serializable
boolean deleteFeature(Feature f) throws ConstraintViolatedException;
boolean deletePrimitive(Primitive p)throws ConstraintViolatedException;
Feature addPrimitive(Primitive p)
throws ConstraintViolatedException, InvalidParameterException;
Feature addPrimitive(Primitive p, boolean asFeature)
throws ConstraintViolatedException, InvalidParameterException;
void addPrimitive(Primitive p, Feature f)
throws ConstraintViolatedException, InvalidParameterException;
boolean updatePrimitive(Primitive p)
throws ConstraintViolatedException, InvalidParameterException;
void begin();
void end();
void commit();
Coverage getCoverage();
Class Topology
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
The class TopologyManager is dedicated for Feature & Primitive updates. Since
the topology of each coverage has be kept after the updates of a feature or a
primitive, and the update of a feature or primitive affect others, we then
have to go through a complicated process to keep the topology.
The basic algorithm is from the paper "An Object-Oriented Approach For
Handling Topology in VPF Products", though there are something different.
<p>It has to be mentioned that all changes you want to make have to be
through this class. Also, for any changes permanently happen in the
database, you have to call the commit() method. The usage of this class
is similiar to ODMG's Java Binding:
TopologyManager t = myCoverage.getTopologyManager();
t.begin();
t.update ...
t.delete ...
t.add ...
t.commit();
t.end();
Here, t.begin means that a transaction begins, and t.end() states that
this transaction ends. t.commit() states that the above modifications are
requested to be made permanently to the database now.
Class Table
•
•
public interface Table extends java.io.Serializable
{
– public String getFileName();
– public void bindFile(String fileName);
– public void load() throws NoSuchTableFileException;
– public RowSet findByPrimaryKey(IDObject id);
– public void update() throws NoSuchTableFileException,
InvalidTableUpdateException;
– Public String getTableName();
– Public Object getRows();
– ------
• }
Class RowSet
•
•
•
public interface RowSet extends java.io.Serializable
{
– public int getPrimaryKey() throws NoSuchColumnException;
– public Object get(String key) throws
NoSuchColumnException;
– public byte getDataType(String key);
– public Object get(int position) throws
NoSuchColumnException;
– public byte getDataType(int position);
– public void set(String key, Object value) throws
NoSuchColumnException;
– public void set(int position, Object value) throws
NoSuchColumnException;
– public int getColumnCount();
}
LogManager
• A good way to control log message
systematically.
• Static methods
• Anytime when there should be debug
messages, must use LogManager
What have been done
• The implementation of
org.usm.vpf.dnc.internal.impl has been
finished. Next step is to implement
org.usm.vpf.dnc.internal which is a easy
task. Later, org.usm.vpf.dnc.impl which is
the real part.
• Job done by: Hong, Rahael, Johan. Thanks.