object-oriented vpf/dnc database modeling

40
Object-Oriented VPF/DNC Database Modeling Hong and Rahael

Upload: akira

Post on 31-Jan-2016

55 views

Category:

Documents


0 download

DESCRIPTION

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. - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: Object-Oriented VPF/DNC Database Modeling

Object-Oriented VPF/DNC Database Modeling

Hong and Rahael

Page 2: Object-Oriented VPF/DNC Database Modeling

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

Page 3: Object-Oriented VPF/DNC Database Modeling

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

Page 4: Object-Oriented VPF/DNC Database Modeling

Introduction to DNC

Database

DNC LIB Dir 1 Browse Lib Dir

14 Coverages 3 coverages

Primitive Dirs Primitives

Page 5: Object-Oriented VPF/DNC Database Modeling

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.

Page 6: Object-Oriented VPF/DNC Database Modeling

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

Page 7: Object-Oriented VPF/DNC Database Modeling

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

Page 8: Object-Oriented VPF/DNC Database Modeling

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

Page 9: Object-Oriented VPF/DNC Database Modeling

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

Page 10: Object-Oriented VPF/DNC Database Modeling

DNC File Structure

Database

Library …

Coverage …..

[Tile] and Feature Class ……...

Feature & Primitives ………...

Page 11: Object-Oriented VPF/DNC Database Modeling

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

Page 12: Object-Oriented VPF/DNC Database Modeling

What We Need?

agents

Database

access

Data retrieved

interface

Page 13: Object-Oriented VPF/DNC Database Modeling

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

Page 14: Object-Oriented VPF/DNC Database Modeling

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?

Page 15: Object-Oriented VPF/DNC Database Modeling

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”

Page 16: Object-Oriented VPF/DNC Database Modeling

Architecture of OOH

OO Interface

OO-Relational Impl

DNC File System

Clients

Page 17: Object-Oriented VPF/DNC Database Modeling

OOH Package Architecture

org.usm.vpf.dnc

databaseexception

.impl

internal

.impl

Page 18: Object-Oriented VPF/DNC Database Modeling

DNC File Structure

Database

Library …

Coverage …..

[Tile] and Feature Class ……...

Feature & Primitives ………...

Page 19: Object-Oriented VPF/DNC Database Modeling

Database

Library

Coverage

VirtualTile FeatureManager

Primitives Features

Page 20: Object-Oriented VPF/DNC Database Modeling

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;• }

Page 21: Object-Oriented VPF/DNC Database Modeling

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

Page 22: Object-Oriented VPF/DNC Database Modeling

Class DataManager

• public interface DataManager extends java.io.Serializable

• {– public Object findData(NodeID ID);– public void commit() throws InvalidTableUpdateException,ConstraintViolatedException;

• }

Page 23: Object-Oriented VPF/DNC Database Modeling

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;• }

Page 24: Object-Oriented VPF/DNC Database Modeling

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();

• }

Page 25: Object-Oriented VPF/DNC Database Modeling

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();

• }

Page 26: Object-Oriented VPF/DNC Database Modeling

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();

• }

Page 27: Object-Oriented VPF/DNC Database Modeling

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();

• }

Page 28: Object-Oriented VPF/DNC Database Modeling

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 abstract FeatureManager getMyManager();– public abstract byte getFeatureType();– public abstract int getCurrentLevelID();– public abstract String getName();– public abstract Vector getPrimitives();– public abstract void updatePrim(Primitive previous, Primitive current);– public abstract Object[][] getAttributeAndValues();– public abstract Vector getReferencedNotes();– public abstract ComparableFeature getComparable(boolean noTopology);– public abstract ComparableFeature getComparable(boolean noTopology,– FeatureComparisonAlgorithm myAlgorithm);

• }

Page 29: Object-Oriented VPF/DNC Database Modeling

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();

• }

Page 30: Object-Oriented VPF/DNC Database Modeling

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);

• }

Page 31: Object-Oriented VPF/DNC Database Modeling

ConnectedNode

• public abstract class ConnectedNode extends Primitive implements DatabaseTreeNode

• {– public abstract ConnectedNodeManager getMyManager();

– public abstract Face getFirstEdge();– public abstract void setFirstEdge(Edge e);– public abstract double[] getCordinates();– public abstract void setCordinates(double[] cordinates);

• }

Page 32: Object-Oriented VPF/DNC Database Modeling

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();

• }

Page 33: Object-Oriented VPF/DNC Database Modeling

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();

• }

Page 34: Object-Oriented VPF/DNC Database Modeling

Class LineFeature

• public abstract class LineFeature extends Feature

• {• public byte getType()• {• return Feature.LINE_FEATURE;• }

– public abstract Vector getEdges();– public abstract Vector getConnectedNodes();

• }

Page 35: Object-Oriented VPF/DNC Database Modeling

Class TopologyManager• public interface TopologyManager extends java.io.Serializable• {• public boolean deleteFeature(Feature f) throws ConstraintViolatedException;• public boolean deletePrimitive(Primitive p)throws ConstraintViolatedException;• public Feature addPrimitive(Primitive p)• throws ConstraintViolatedException, InvalidParameterException;• public Feature addPrimitive(Primitive p, boolean asFeature)• throws ConstraintViolatedException, InvalidParameterException;• public void addPrimitive(Primitive p, Feature f)• throws ConstraintViolatedException, InvalidParameterException;• public boolean updatePrimitive(Primitive p)• throws ConstraintViolatedException, InvalidParameterException;• public void begin();• public void end();• public void commit();• public Coverage getCoverage();• }

Page 36: Object-Oriented VPF/DNC Database Modeling

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.

Page 37: Object-Oriented VPF/DNC Database Modeling

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();– ------

• }

Page 38: Object-Oriented VPF/DNC Database Modeling

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();

• }

Page 39: Object-Oriented VPF/DNC Database Modeling

LogManager

• A good way to control log message systematically.

• Static methods

• Anytime when there should be debug messages, must use LogManager

Page 40: Object-Oriented VPF/DNC Database Modeling

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.