Download presentation
Presentation is loading. Please wait.
Published byGinger Simmons Modified over 9 years ago
1
Spatial Query Language Group No.15 Dhruv Dhokalia Yash Khandelwal Course Relation- Chapter 11- Object and Object-Relational Databases
2
MOTIVATION Databases required for data type rich applications such as: - Spatial Databases (eg. Google Maps) - Designing Databases (eg. CAD/CAM, 3-D printing) These applications require: -Complex structures for storing data -New data types- for images, videos & other multimedia
3
RDBMS Data types Char Int Date Number Varchar ODBMS Data types Point LineString Polygon MultiPoint
4
Spatial Data Types
5
OGIS- Open Geographic Information System OPERATION TYPEOPERATION NAMEDESCRIPTION Basic functionsSpatialReference()Returns the underlined coordinate system of the geometry Boundary()Returns the boundary of the geometry Topological/Set OperatorsTouch()Returns TRUE if the boundaries of the two surfaces intersect, but the interiors DO NOT Contains()Test if the given geometry contains another geometry Cross()Returns TRUE if the interior of a surface intersects with a curve Spatial AnalysisDistance()Returns the shortest distance b/w two geometries Intersection()Returns the geometric intersection of the two geometries
6
Spatial Query Example CREATE TABLE Country( Name Varchar(30), Continent Varchar(30), Population Integer, GDP Number, Shape Polygon); CREATE TABLE River( Name Varchar(30), Origin Varchar(30), Length Number, Shape LineString);
7
Spatial Query Example(cont.) Find the names of all the countries that are neighbors of USA in the country table. SELECT C1.Name AS “neighbors of USA” FROM Country C1, C2 WHERE Touch (C1.Shape, C2.Shape)= 1 AND C2.Name= “USA”;
8
Spatial Query Example(cont.) List the length of all the rivers in each of the countries they pass through SELECT R.Name, C.Name, Length(intersection(R.Shape, C.Shape)) AS Length FROM River R, Country C WHERE Cross (R.Shape, C.Shape)=1;
9
References Spatial Databases- A TOUR By Shashi Shekhar; Sanjay Chawla Fundamentals of Database Systems By Elmasri & Navathe; 6 th Edition About 3-D Printing http://www.3ders.org/3d-printing-basics.html Latest on 3-D printing http://www.cnn.com/2013/11/08/tech/innovation/3d- printed-metal-gun/index.html?hpt=te_r1
10
THANK YOU
11
Object Relation SQL Point CREATE TYPE Point AS OBJECT( x NUMBER, y NUMBER, MEMBER FUNCTION Distance(P2 IN Point) RETURN NUMBER, PRAGMA RESTRICT_REFERENCES(Distance, WNDS)); Eg. CREATE TABLE City( Name Varchar(30), Country Varchar(35), Shape Point ); Insert into City values(‘Minneapolis’, ‘USA’, Point(44.9, 93.26));
12
Object Relation SQL LineString CREATE TYPE LineType AS VARRAY(500) of Point CREATE TYPE LineString AS Object( Num_of_Points Int, Geometry LineType, Member Function Length(Self In) Return number, PRAGMA RESTRICT_REFERENCES(Length, WNDS)); CREATE TABLE River( Name Varchar(30), Origin Varchar(30), Length Number, Shape LineString); Insert into river (‘Mississippi’, ‘USA’, 6000, LineString(3,LineType(Point(1,1), Point(2,2), Point(3,4));
13
Object Relation SQL Polygon CREATE TYPE PolyType AS VARRAY(500) of Point CREATE TYPE Polygon AS Object( Num_of_Points Int, Geometry PolyType, Member Function Area(SELF IN) Return number, PRAGMA RESTRICT_REFERENCES(Length, WNDS)); CREATE TABLE Country( Name Varchar(30), Continent Varchar(30), Population Integer, GDP Number, Shape Polygon); Insert into Country(‘Mexico’, ‘NM’, 694.3, 69.36, Polygon(23, PolyType(Point(1,1).....Pomit(1,1)));
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.