Figure 1–3 Family Tree for RDF Example (see Monday October, 10 link - Oracle Semantic Tutorial examples on 1-28 and 1-29)Oracle Semantic Tutorial examples.

Slides:



Advertisements
Similar presentations
Introduction to JDBC Standard framework for dealing with tabular and generally, relational data SQL (Structured Query Language) is standardized language.
Advertisements

Basic JDBC Celsina Bignoli What is JDBC Industry standard for database- connectivity between the Java language and a wide range of.
Database programming in Java An introduction to Java Database Connectivity (JDBC)
Servlets. A form The HTML source Chapter 1 Please enter your name and password then press start Name: Password: In Netbeans you can graphically create.
Introduction to XML CS348 Information System Guest Lecture Hazem Elmeleegy.
15-Jun-15 JDBC. JDBC is a Sun trademark It is often taken to stand for Java Database Connectivity Java is very standardized, but there are many versions.
1 JDBC: Part I Attribution These slides are based on three primary sources: –Sun JDBC Tutorial URL: jdbc/TOC.htmlhttp://java.sun.com/docs/books/tutorial/
Advanced Java Programming – Eran Toch Methodologies in Information System Development Tutorial: Advanced Java Programming and Database connection Eran.
Three-Tier Architecture Oracle DB Server Apache Tomcat App Server Microsoft Internet Explorer HTML Tuples HTTP Requests JDBC Requests Java Server Pages.
CIS 270—App Dev II Big Java Chapter 22 Relational Databases.
1 CSC 440 Database Management Systems JDBC This presentation uses slides and lecture notes available from
Helena Pomezná, ciz034 St. skupina: L392 FEI, VŠB-TUO Ak. rok. 2002/2003 Download:
CS178 Database Management “JDBC”. What is JDBC ? JDBC stands for “Java DataBase Connectivity” The standard interface for communication between a Java.
Views, Indexes and JDBC/JSP tutorial Professor: Dr. Shu-Ching Chen TA: Haiman Tian 1.
 2004 Keith Vander Linden. All Rights Reserved. Calvin CollegeDepartment of Computer Science(1/25) Database Programming with JDBC Keith Vander Linden.
Georgia Institute of Technology Making Text for the Web part 5 Barb Ericson Georgia Institute of Technology March 2006.
MySQL, Java, and JDBC CSE 3330 Southern Methodist University.
JDBC Tutorial MIE456 - Information Systems Infrastructure II Vinod Muthusamy November 4, 2004.
JAVA Database Access. JDBC The Java Database Connectivity (JDBC) API is the industry standard for database- independent connectivity between the Java.
VICTORIA UNIVERSITY OF WELLINGTON Te Whare Wananga o te Upoko o te Ika a Maui COMP 302 Database Systems Java Data Base Connectivity Lecturer Dr Pavle Mogin.
1 Introducing Eclipse DTP for Ingres An Introduction GIUA Juni 2007 J. Peel Ingres Corp.
Object-Oriented Software How does it differ from procedural? How is it similar to procedural? Why has it become so popular? Does it replace or supplement.
Servlets Database Access. Agenda:  Setup Java Environment  Install Database  Install Database Drivers  Create Table and add records  Accessing a.
JDBC Java and Databases, including Postgress. JDBC l Developed by Industry leaders l Three main goals: –JDBC should be an SQL-level API –JDBC should capitalize.
 What software components are required?  How do I install the Oracle JDBC driver?  How do I connect to the database?  What form is the data in and.
JDBC  The JDBC (Java Database Connectivity) API helps a Java program to access a database in a standard way  JDBC is a specification that tells the.
Index and JDBC/JSP tutorial Professor: Dr. Shu-Ching Chen TA: Hsin-Yu Ha.
Sadegh Aliakbary. Copyright ©2014 JAVACUP.IRJAVACUP.IR All rights reserved. Redistribution of JAVACUP contents is not prohibited if JAVACUP.
JSP program that interacts with HTML form & Access Data Base.
Accessing Database using JDBC. JDBC Objectives Gain basic knowledge of Java JDBC Become familiar with the basics of interacting with a database using.
JDBC – Java Database Concentricity
Copyright  Oracle Corporation, All rights reserved. 6 Accessing a Database Using the JDBC API.
JDBC. A Basic MySQL Tutorial MySQL is an open source database management software that helps users store, organize, and retrieve data. It is a very powerful.
Chapter 25 Databases. Chapter Scope Database concepts Tables and queries SQL statements Managing data in a database Java Foundations, 3rd Edition, Lewis/DePasquale/Chase25.
Copyright  Oracle Corporation, All rights reserved. 7 Accessing a Database Using SQLJ.
Java Database Connectivity. Java and the database Database is used to store data. It is also known as persistent storage as the data is stored and can.
JDBC - Connection The programming involved to establish a JDBC connection is fairly simple. Here are these simple four steps − Import JDBC Packages: Add.
JDBC Database Programming in Java Prepared by., Mrs.S.Amudha AP/SWE.
JDBC. Java.sql.package The java.sql package contains various interfaces and classes used by the JDBC API. This collection of interfaces and classes enable.
EXAMPLE I An application showing JDBC access to Cloudscape.
16 Java Database Connectivity. 2 Understand the JDBC Understand the steps of the JDBC: 1.) Importing packages 2.) Opening a connection to a database 3.)
Logics for Data and Knowledge Representation Web Ontology Language (OWL) -- Exercises Feroz Farazi.
JDBC and SQLJ CIS 612 Spring JDBC JDBC is an API that enables database access from Java programs JDBC for DB access provides ◦ Portability across.
Tasks Needed for MissionMapEditor Martin Q. Zhao September 18, 2010.
CSI 3125, Preliminaries, page 1 JDBC. CSI 3125, Preliminaries, page 2 JDBC JDBC stands for Java Database Connectivity, which is a standard Java API (application.
Access Databases from Java Programs via JDBC Tessema M. Mengistu Department of Computer Science Southern Illinois University Carbondale
Basics of JDBC.
Dr. Philip Cannata 1 RDF. Dr. Philip Cannata 2 10 Java (Object Oriented) ASP RDF (Horn Clause Deduction, Semantic Web) Relation Jython in Java This Course.
Database Programming With Java & JDBC Reading: DD Ch. 18, pp al/jdbc/index.html, or anything covering JDBC.
Umair Javed©2005 Enterprise Application Development Java Database Connectivity (JDBC) JDBC1.
JDBC I IS Why do we have databases?
Using Oracle JDBC How to Run JDBC on Your Account Communication Mechanism Using Metadata Building a Database Auto Commit v.s Atomic Transaction.
JSP/Database Connectivity Instructor: Dr. M. Anwar Hossain.
Java and database. 3 Relational Databases A relational Database consists of a set of simple rectangular tables or relations The column headings are.
JDBC. What is JDBC JDBC is an acronym for –Java Data Base Connectivity. It allows java program to connect to any database.
MySQL root 암호 $ mysqladmin -u root -p password new-password $ mysql -u root mysql mysql> update user set password = password('new-password') where user.
Java Access to RDB Relational databases (RDBs) dominate today, due to:
Lec - 14.
JDBC 15-Apr-18.
JDBC 21-Aug-18.
HW#4 Making Simple BBS Using JDBC
“This presentation is for informational purposes only and may not be incorporated into a contract or agreement.”
JDBC(Java Database Connectivity
Introduction to Server-Side Web Development using JSP and Databases
JDBC 15-Nov-18.
Super Market Management
Logics for Data and Knowledge Representation
JDBC API.
JDBC Example.
Presentation transcript:

Figure 1–3 Family Tree for RDF Example (see Monday October, 10 link - Oracle Semantic Tutorial examples on 1-28 and 1-29)Oracle Semantic Tutorial examples on 1-28 and 1-29

RDF Triple Store - rts Entity or Subject Attribute or Predicate Value or Object JohnSpouseJanice SpouseJohn SammySpouseSuzie SpouseSammy MattSpouseMartha SpouseMatt JohnGenderMale JaniceGenderFemale SammyGenderMale SuzieGenderFemale MattGenderMale MarthaGenderFemale CathyGenderFemale JackGenderMale TomGenderMale CindyGenderFemale JohnFatherOfSuzie JohnFatherOfMatt JaniceMotherOfSuzie JaniceMotherOfMatt CathySisterOfJack BrotherOfCathy... Unnormalized Relational Table - person PersonSpouseGenderFatherOfMotherOfSisterOfBrotherOf JohnJaniceMaleSuzie JohnJaniceMaleMatt JaniceJohnFemaleSuzie JaniceJohnFemaleMatt SammySuzieMaleCathy SammySuzieMaleJack SuzieSammyFemaleCathy SuzieSammyFemaleTom MattMarthaMaleTom MarthaMattFemaleTom CathyJackFemaleJack CathyMaleCathy TomCindyMaleCindy TomFemaleTom

RDF Triple Store - rts Entity or Subject Attribute or Predicate Value or Object JohnSpouseJanice SpouseJohn SammySpouseSuzie SpouseSammy MattSpouseMartha SpouseMatt JohnGenderMale JaniceGenderFemale SammyGenderMale SuzieGenderFemale MattGenderMale MarthaGenderFemale CathyGenderFemale JackGenderMale TomGenderMale CindyGenderFemale JohnFatherOfSuzie JohnFatherOfMatt JaniceMotherOfSuzie JaniceMotherOfMatt CathySisterOfJack BrotherOfCathy... Unnormalized Relational Table - person PersonSpouseGenderFatherOfMotherOfSisterOfBrotherOf JohnJaniceMaleSuzie JohnJaniceMaleMatt JaniceJohnFemaleSuzie JaniceJohnFemaleMatt SammySuzieMaleCathy SammySuzieMaleJack SuzieSammyFemaleCathy SuzieSammyFemaleTom MattMarthaMaleTom MarthaMattFemaleTom CathyJackFemaleJack CathyMaleCathy TomCindyMaleCindy TomFemaleTom select Person from person where BrotherOf = ‘Cathy’ select x from rts where ?x BrotherOf ‘Cathy’

-- Create the table to hold data for the model. CREATE TABLE family_rdf_data (id NUMBER, triple SDO_RDF_TRIPLE_S); -- Create the model. execute SEM_APIS.create_rdf_model('family_cs345_XXX', 'family_rdf_data', 'triple'); -- John is the father of Suzie. INSERT INTO family_rdf_data VALUES (1, SDO_RDF_TRIPLE_S('family_cs345_XXX', ' ' ' INSERT INTO family_rdf_data VALUES (14, SDO_RDF_TRIPLE_S('family_cs345_XXX', ' ' ' Figure 1–3 Family Tree for RDF Sample (see Monday October, 10 link - Family Tree RDF Example for Full Details)

-- Person is a class. INSERT INTO family_rdf_data VALUES (17, SDO_RDF_TRIPLE_S('family_cs345_XXX', ' ' ' -- Male is a subclass of Person. INSERT INTO family_rdf_data VALUES (18, SDO_RDF_TRIPLE_S('family_cs345_XXX', ' ' ' -- Female is a subclass of Person. INSERT INTO family_rdf_data VALUES (19, SDO_RDF_TRIPLE_S('family_cs345_XXX', ' ' ' -- siblingOf is a property. INSERT INTO family_rdf_data VALUES (20, SDO_RDF_TRIPLE_S('family_cs345_XXX', ' ' ' -- parentOf is a property. INSERT INTO family_rdf_data VALUES (21, SDO_RDF_TRIPLE_S('family_cs345_XXX', ' ' ' -- brotherOf is a subproperty of siblingOf. INSERT INTO family_rdf_data VALUES (22, SDO_RDF_TRIPLE_S('family_cs345_XXX', ' ' ' -- sisterOf is a subproperty of siblingOf. INSERT INTO family_rdf_data VALUES (23, SDO_RDF_TRIPLE_S('family_cs345_XXX', ' ' ' -- A brother is male. INSERT INTO family_rdf_data VALUES (24, SDO_RDF_TRIPLE_S('family_cs345_XXX', ' ' ' -- A sister is female. INSERT INTO family_rdf_data VALUES (25, SDO_RDF_TRIPLE_S('family_cs345_XXX', ' ' ' -- fatherOf is a subproperty of parentOf. INSERT INTO family_rdf_data VALUES (26, SDO_RDF_TRIPLE_S('family_cs345_XXX', ' ' ' -- motherOf is a subproperty of parentOf. INSERT INTO family_rdf_data VALUES (27, SDO_RDF_TRIPLE_S('family_cs345_XXX', ' ' ' -- A father is male. INSERT INTO family_rdf_data VALUES (28, SDO_RDF_TRIPLE_S('family_cs345_XXX', ' ' ' -- A mother is female. INSERT INTO family_rdf_data VALUES (29, SDO_RDF_TRIPLE_S('family_cs345_XXX', ' ' '

-- Select all males from the family model, without inferencing. SELECT m FROM TABLE(SEM_MATCH( '(?m rdf:type :Male)', SEM_Models('family_cs345_XXX'), null, SEM_ALIASES(SEM_ALIAS('',' null)); -- Select all males from the family model, with RDFS inferencing. SELECT m FROM TABLE(SEM_MATCH( '(?m rdf:type :Male)', SEM_Models('family_cs345_XXX'), SDO_RDF_Rulebases('RDFS'), SEM_ALIASES(SEM_ALIAS('',' null)); -- RDFS inferencing in the family model BEGIN SEM_APIS.CREATE_RULES_INDEX( 'rdfs_rix_family_cs345_XXX', SEM_Models('family_cs345_XXX'), SEM_Rulebases('RDFS')); END; / RDF Inferencing

-- General inferencing in the family model EXECUTE SEM_APIS.CREATE_RULEBASE('family_rb_cs345_XXX'); INSERT INTO mdsys.semr_family_rb_cs345_XXX VALUES( 'grandparent_rule', '(?x :parentOf ?y) (?y :parentOf ?z)', NULL, '(?x :grandParentOf ?z)', SEM_ALIASES(SEM_ALIAS('',' COMMIT; -- Select all grandfathers and their grandchildren from the family model, -- without inferencing. (With no inferencing, no results are returned.) SELECT x grandfather, y grandchild FROM TABLE(SEM_MATCH( '(?x :grandParentOf ?y) (?x rdf:type :Male)', SEM_Models('family_cs345_XXX'), null, SEM_ALIASES(SEM_ALIAS('',' null)); -- Select all grandfathers and their grandchildren from the family model. -- Use inferencing from both the RDFS and family_rb rulebases. SELECT x grandfather, y grandchild FROM TABLE(SEM_MATCH( '(?x :grandParentOf ?y) (?x rdf:type :Male)', SEM_Models('family_cs345_XXX'), SEM_Rulebases('RDFS','family_rb_cs345_XXX'), SEM_ALIASES(SEM_ALIAS('',' null)) RDF Inferencing

import java.sql.Connection; import java.sql.Statement; import java.sql.DriverManager; import java.sql.SQLException; import java.sql.*; public class MainClass { public static Connection getConnection() throws ClassNotFoundException, SQLException { String driver = "oracle.jdbc.driver.OracleDriver"; String url = String username = "________________________"; String password = "________________________"; Class.forName(driver); Connection conn = DriverManager.getConnection(url, username, password); return conn; } public static void main(String args[]) { Connection conn = null; Statement stmt = null; CallableStatement callStmt = null; try { conn = getConnection(); stmt = conn.createStatement(); // Uncomment the following line if the family_rdf_data table already exists AND IF you want to drop the table and start over. // stmt.executeUpdate("DROP TABLE family_rdf_data"); stmt.executeUpdate("CREATE TABLE family_rdf_data (id NUMBER, triple SDO_RDF_TRIPLE_S)"); System.out.println("Created RDF Table"); // The following commented out lines don't appear to be necessary even though they are in the tutorial. // callStmt = conn.prepareCall(" begin SEM_APIS.drop_rdf_model('family'); end;"); // callStmt.execute(); // callStmt = conn.prepareCall(" begin SEM_APIS.create_rdf_model('family', 'family_rdf_data', 'triple'); end;"); // callStmt.execute(); // System.out.println("Create RDF Model"); stmt.executeUpdate("INSERT INTO family_rdf_data VALUES (1,SDO_RDF_TRIPLE_S('family',' System.out.println("Inserted"); } catch (ClassNotFoundException e) { System.out.println("error: failed to load Oracle driver."); e.printStackTrace(); } catch (SQLException e) { System.out.println("error: failed to create a connection object."); e.printStackTrace(); } catch (Exception e) { System.out.println("other error:"); e.printStackTrace(); } finally { try { stmt.close(); conn.close(); } catch (Exception e) { } Get an Oracle Account (One per Project Group, You Can Share It)