Presentation is loading. Please wait.

Presentation is loading. Please wait.

Web Interfaces and Data Portals John Porter Department of Environmental Sciences University of Virginia.

Similar presentations


Presentation on theme: "Web Interfaces and Data Portals John Porter Department of Environmental Sciences University of Virginia."— Presentation transcript:

1 Web Interfaces and Data Portals John Porter Department of Environmental Sciences University of Virginia

2 Roadmap l Goals for web data access l The web interface "tool box" l Putting the pieces together l Content management systems l Exercises

3 Goals for Ecological Databases l Easy to use – no specialized training required l Able to locate/discover data l Able to produce data in desired forms »Data files »Graphs and Maps »Specialized formats l Users can understand and use data

4 Circa 1994- The World Wide Web l Availability nearly universal »access rapidly increasing l Easy to use – point and click l Difficult to update source documents »Need to edit static text documents

5 Circa 1994 - Databases l Difficult and specialized interfaces l Powerful capabilities »Query »Update »Output Suitable for “about 10%” of ecological data management problems (Gorentz, pers. comm.)

6 Now! Web + Database New Power! l ubiquitous l easy to use l easy to query and update

7 Examples l An early use, in the Internet Movie Database (http://www.imdb.com) links movies with actors and vis versahttp://www.imdb.com »Search for a movie »Get a list of actors »Click on actor’s name to get list of movies they were in

8 Retrieve customized data via a web form linked to a database

9 The Web Portal Toolkit l We have all seen (and used) web pages that were linked to databases l But, HOW IS IT DONE? »Actually there are MANY ways to link databases and web pages using a wide variety of tools

10 Piece #1 Web Forms A Simple Form Simple input of a string Input a sentence:

11 Tools: Stand-alone Computer Languages l Visual Basic »PC’s only l C & C++ »powerful (but with power comes responsibility) l Pattern Extraction and Regular expression Language – PERL »Strong search and parsing capabilities l JAVA – object oriented l Many more (Python, etc.)

12 Tools: Computer Languages you can Insert in a Web Page l Active Server Pages – ASP »Works primarily with Microsoft products »Insert Microsoft Visual Basic into web pages l PHP »open source »Works on a wide number of platforms l Specialized languages associated with specific products (e.g., LITE)

13 Tools: Languages that Run on your Browser l Active X »Microsoft Internet Explorer only l JAVAscript »Lightweight programs l JAVA »Full-featured object-oriented programs

14 Tools: Relational Databases l Commercial Databases »Oracle »Microsoft SQL Server l Open Source Databases »MySQL »SQLite (lightweight, limited functions) l All provide: »Structured Query Language (SQL) » Application Programming Interfaces (APIs) to interact with computer languages

15 Putting the Pieces Together l Web forms Interface »Web authoring tools like DREAMWEAVER can automate linking web forms to databases l Computer Programs »Stored & run on Web Server »Stored in web page & run on Web Server »Stored on Web Server & run on Server »Stored in web page & run on Client l Database

16 Client-Server Architecture WWW Browser WWW Server JAVA Internet HTML file WWW Server Software CGI-BIN Scripts WWW Client

17 CGI or SCRIPTS l Apache and others »If you see /cgi-bin/ in a web address, it is running a program stored in the cgi-bin directory of the server »CGI stands for “Common Gateway Interface” »it defines the ways to communicate information between the server and the client l Microsoft IIS »Uses the “scripts” directory on the server to store programs

18 Client-Server Architecture WWW Browser WWW Server Internet HTML file WWW Server Software WWW Client Basic configuration for serving static documents

19 Adding a Database WWW Browser WWW Server Internet HTML file WWW Server Software CGI-BIN Scripts WWW Client Database

20 Database Programs in HTML Documents l Usually webmasters do NOT allow users to add programs to the cgi-bin directory »Dangerous – programs run on the server so only trusted programs should be in cgi-bin l So, instead a general CGI program (such as PHP) is used to read specific database programs that are integrated into a web page

21 Adding a Database WWW Browser WWW Server Internet HTML file WWW Server Software CGI-BIN Scripts WWW Client Database

22 Example Program l This example program uses PHP to talk to a MYSQL relational database l The details of each step will differ between databases and languages, but will share many similarities l Here we insert information from a web form into a database and retrieve an observation number for later use.

23 /* Connecting, selecting database */ /* Connecting, selecting database */ $link = mysql_connect("data.vcrlter.virginia.edu", “myID") $link = mysql_connect("data.vcrlter.virginia.edu", “myID") or die("Could not connect"); or die("Could not connect"); mysql_select_db("www") or die("Could not select database"); mysql_select_db("www") or die("Could not select database"); /* Performing SQL query */ /* Performing SQL query */ $query = "insert into waiver (date_req,station,name,isVert,healthtype) values('". date("Y-m-d"). ','$_REQUEST[station]', ‘$_REQUEST[fullname]','Y', $_REQUEST[health])"; $result = mysql_query($query) or die("Unable to log waiver creation, Query failed"); $result = mysql_query($query) or die("Unable to log waiver creation, Query failed"); $query = "select max(waiver_num) as waiver_num from waiver"; $result = mysql_query($query) or die("Unable to get waiver number, Query failed"); extract(mysql_fetch_assoc($result)); mysql_close($link); mysql_close($link); Openconnection Set up insert Store result as PHP variable Selectdatabase Run Insert Query Set up query Set up query Run Query

24 DON’T PANIC! By now, you may be swamped with new information, so keep in mind: »There are good tutorials or books to walk you through the intricacies of SQL, PHP, etc. »Example programs can frequently be adapted for your use »Some tools for creating database-enabled web pages can automate many of the basic tasks (e.g., Dreamweaver has basic web form and database interfaces)

25 Web Portals Made Easy –Content Management Systems l Content Management Systems (CMS) »Store ALL the web content in a database (not just data and metadata) »Provide pre-written “modules” containing –Web form-based interfaces –Associated database programs »These modules are designed to be easy to use by even novice webmasters to provide specific functions on a web page l Examples are PostNuke, SlashDot, OpenCMS, WIKI

26 A sample web site developed using POSTNUKE

27 Administration Page for PostNuke Web Site

28

29 Content Management Systems l Advantages »Easy to configure and use »Allow input from users (subject to login) »Many pre-existing modules l Disadvantages »Existing modules may not meet your needs »May be difficult to extract content or transition to other systems

30 System Requirements for CMS l To use a CMS, you will need »A Relational Database (e.g., Oracle, MySQL) »A computer language (JAVA, PHP etc.) »A web server l For example, PostNuke, by default, requires PHP and a MySQL database

31 Web Services l For some applications your “user” is not a person, it’s a program on another computer »E.g., Provide data to run a model or graphical package, without human intervention l Web pages work fine for people, but are hard for programs to interpret. For this reason Web Services have developed

32 Features of Web Services A Web Service provides the following functions: l It “advertises” its methods (it tells you what it can do for you) l Once you select a method to invoke, the Web Service does the required processing (often accessing a database) l It returns the result as a structured eXtensible Markup Language (XML) document, suitable for use with many types of software

33 Web Services l Web services tools and techniques are still undergoing rapid development and evolution. Here are some tools and standards related to that development: l SOAP – Simple Object Access Protocol »A “envelope” for packaging requests and receiving results l WSDL – Web Services Description Language »A language for describing web services and their methods

34 Useful References & Tutorials l PHP – http://www.php.nethttp://www.php.net l MySQL – http://mysql.comhttp://mysql.com l HTML Forms, Web Services (SOAP, WSDL), SQL, XML - http://www.w3schools.com/html/ http://www.w3schools.com/html/ l SQL – http://sqlcourse.comhttp://sqlcourse.com l Dreamweaver – http://www.macromedia.com http://www.macromedia.com

35 Exercises l Learn Structured Query Language at: http://www.sqlcourse.com http://www.sqlcourse.com l Learn to Administer a real PostNuke web site at: http://mareo.org/~jhp7e/ESA04


Download ppt "Web Interfaces and Data Portals John Porter Department of Environmental Sciences University of Virginia."

Similar presentations


Ads by Google