On Fri, 2012-01-06 at 16:04 +0530, Ashwini Balu wrote: > Hi Ankit, > > Its a common error: remember that there is no protocol called D in the > following uris > String sUri = "D://albums/vc-db-1.rdf"; > String sUri2 = "D://albums/ankitverma.rdf"; > Rather change them to String sURI="file://D:/albums..."
It think that should be three slashes, i.e. "file:///D:/albums..." which may be why the error persisted. Dave > > Ashwini. > > -----Original Message----- > From: Ankit Verma [mailto:[email protected]] > Sent: 06 January 2012 16:01 > To: [email protected] > Subject: Persisting rdf model to mysql database > > Hi all, > > I am trying to persist a rdf file into mysql database using > following code > > package test; > > import com.hp.hpl.jena.db.DBConnection; > import com.hp.hpl.jena.db.IDBConnection; > import com.hp.hpl.jena.db.ModelRDB; > > public class Test extends Object { > public static void main(String args[]) { > // Pass two RDF documents, connection string, > String sUri = "D://albums/vc-db-1.rdf"; > String sUri2 = "D://albums/ankitverma.rdf"; > // As before ... > String M_DB_URL = "jdbc:mysql://localhost:3306/test"; > String M_DB_USER = "root"; > String M_DB_PASSWD = ""; > String M_DB = "MySQL"; > String M_DBDRIVER_CLASS = "com.mysql.jdbc.Driver"; > > try{ > // load the the driver class > Class.forName(M_DBDRIVER_CLASS); > > > // create a database connection > IDBConnection conn = new DBConnection(M_DB_URL, M_DB_USER, > M_DB_PASSWD, M_DB); > // Create and read first model > > ModelRDB model1 = ModelRDB.createModel(conn, "one"); > model1.read(sUri); > > // Create and read second model > ModelRDB model2 = ModelRDB.createModel(conn, "two"); > model2.read(sUri2); > } catch (Exception e) { > System.out.println("Failed: " + e); > } > } > } > > > But facing the error > > Failed: com.hp.hpl.jena.shared.JenaException: > java.net.MalformedURLException: unknown protocol: d > > Please suggest if anything is missing > > Thanks and Regards > Ankit Verma > > > ________________________________ > > Attend Impetus Webinar on 'Building Your Big Data Analytics Strategy in > 2012' ; Jan 18 (10:00am PT). > > Click http://www.impetus.com to know more. Follow us on > www.twitter.com/impetuscalling > > > NOTE: This message may contain information that is confidential, > proprietary, privileged or otherwise protected by law. The message is > intended solely for the named addressee. If received in error, please > destroy and notify the sender. Any use of this email is prohibited when > received in error. Impetus does not represent, warrant and/or guarantee, > that the integrity of this communication has been maintained nor that the > communication is free of errors, virus, interception or interference. > >
