Search Mailing List Archives


Limit search to: Subject & Body Subject Author
Sort by: Reverse Sort
Limit to: All This Week Last Week This Month Last Month
Select Date Range     through    

[protege-owl] MySql JDBC Driver and Database problem

Congmin min marlonmin at gmail.com
Tue Sep 5 14:18:36 PDT 2006


Thanks, I got it.

On 9/5/06, Schmitz, Jeffrey A <Jeffrey.A.Schmitz at boeing.com> wrote:
>
>  Just a quick note on the below snippet (because I've spent the day
> debugging it), the FIRST time you run code to setup and use the JENA
> database model, you must use:
>
> maker.createModel("MyPizzaClassModel");
> After the database tables have been created in MySQL you will need to use:
>
> maker.getModel("MyPizzaClassModel");
> Jeff
>
>
>  ------------------------------
> *From:* Schmitz, Jeffrey A
> *Sent:* Tuesday, September 05, 2006 3:02 PM
>
> *To:* User support for the Protege-OWL editor
> *Subject:* Re: [protege-owl] MySql JDBC Driver and Database problem
>
>  You would have to covert the database back into the file based protege
> format first I think, going the other way of the example I snippet in the
> previous message.  Should be a simple utility to write, but I haven't tried
> it.
>
> btw, here's the definition of a few of the constants and variables used in
> the snippet:
>
>  public static final String inputClassFilename = "pizza.owl";
>  public static final String pizzaInstanceFilename = "pizzaInstance.owl";
>  public static final String pizzaNamespaceURI = "
> http://www.owl-ontologies.com/pizza.owl#";
>     public static final String pizzaDataURI = "
> http://www.owl-ontologies.com/pizzaInst.owl#";
>     public static final String amPizzaTypeURI = pizzaNamespaceURI +
> "AmericanHot";
>     public static final String hasToppingURI = pizzaNamespaceURI +
> "hasTopping";
>     public static final String isToppingURI = pizzaNamespaceURI +
> "isToppingOf";
>     public static final String typeURI = "
> http://www.w3.org/1999/02/22-rdf-syntax-ns#type";
>     public static final String caperTopTypeURI = pizzaNamespaceURI +
> "CaperTopping";
>     public static Model pizzaClassDBModel;
>     public static Model pizzaModel;
>
> Jeff
>
>  ------------------------------
> *From:* Congmin min [mailto:marlonmin at gmail.com]
> *Sent:* Tuesday, September 05, 2006 2:58 PM
> *To:* User support for the Protege-OWL editor
> *Subject:* Re: [protege-owl] MySql JDBC Driver and Database problem
>
> Jeff: after you got the Jena database model, can you look at it in Protege
> or somewhere? because I want to use protege as a visualization tool. I am
> developing a plugin for protege owl for visualizing various relations more
> than ISA, so I still have to use Protege as the platform.
>
> On 9/5/06, Congmin min <marlonmin at gmail.com > wrote:
> >
> > Thank you, Jeff:
> > I will look into your solution.
> >
> > Protege owl seems very inmature.
> >
> >
> > On 9/5/06, Schmitz, Jeffrey A < Jeffrey.A.Schmitz at boeing.com> wrote:
> > >
> > >  No, I haven't seen that one.  My database was pretty small.  Also,
> > > I've kind of punted on the Protege database for now and am using the Jena DB
> > > backend with MySQL which seems to work pretty well.  I'm using Jastor for
> > > generating and api to use the database instead of the Protege code
> > > generation tool.  Again, Jastor seems to be both easier and a little more
> > > stable than the Protege stuff.
> > >
> > > To get the protege ontology into the Jena/MySQL database I simply read
> > > in the Protege owl file into a memory based model and then add that model to
> > > my Jena database model:
> > >
> > >   IDBConnection conn = connectToDB(M_DB_URI, M_DB_USER, M_DB_PASSWD,
> > > M_DB, M_DBDRIVER_CLASS);
> > > //   create a model maker with the given connection parameters
> > >   ModelMaker maker = ModelFactory.createModelRDBMaker(conn);
> > > //   Create a named model
> > >   pizzaClassDBModel = maker.getModel("MyPizzaClassModel");
> > >
> > >   if (loadClasses) {
> > >    try {
> > >         pizzaClassIn = new FileInputStream("pizza.owl");
> > >                //Create the class database from the Protege OWL File
> > > based model.
> > >         pizzaClassOWLFileModel =
> > > ProtegeOWL.createJenaOWLModelFromInputStream(pizzaClassIn);
> > >         pizzaClassOntModel = pizzaClassOWLFileModel.getOntModel();
> > >          pizzaClassDBModel.add(pizzaClassOntModel);
> > >       } catch(Exception e) {
> > >     try {
> > >       FileOutputStream fileOut = new FileOutputStream(errFile);
> > >
> > >       err = new PrintStream(fileOut);
> > >       e.printStackTrace(err);
> > >       err.print("for input file: " + inputClassFilename + "\n");
> > >     } catch(Exception ex) {}
> > >          }
> > >
> > >
> > >   }
> > >
> > > Jeff
> > >
> > >  ------------------------------
> > >  *From:* Congmin min [mailto: marlonmin at gmail.com]
> > > *Sent:* Tuesday, September 05, 2006 2:15 PM
> > >
> > > *To:* User support for the Protege-OWL editor
> > > *Subject:* Re: [protege-owl] MySql JDBC Driver and Database problem
> > >
> > >  Hi, Jeff:
> > >   Last week I talked to you and now I can connect to mysql database.
> > > Thanks,
> > >
> > > But I have another problem, I don't know if you had a similar problem.
> > >
> > >
> > > I need to create a new project using exiting owl file to build a
> > > database ontology, because my ontology in file format is so big that it
> > > can't be loaded into protege and then be converted. I need to directly
> > > create  an ontology with database backend, but there is an exception:
> > > Did you find this before?
> > >
> > > java.lang.IndexOutOfBoundsException: Index: 0
> > >     at java.util.Collections$EmptyList.get(Collections.java:2923)
> > >     at
> > > edu.stanford.smi.protegex.owl.model.triplestore.impl.AbstractTripleStoreModel.setHomeTripleStore(Unknown
> > > Source)
> > >     at
> > > edu.stanford.smi.protegex.owl.model.triplestore.impl.AddRDFTypePropertyHandler.handleAdd(Unknown
> > > Source)
> > >     at
> > > edu.stanford.smi.protegex.owl.model.triplestore.impl.AbstractTripleStore.add(Unknown
> > > Source)
> > >     at
> > > edu.stanford.smi.protegex.owl.jena.parser.ProtegeOWLParser$MyStatementHandler.statement(Unknown
> > > Source)
> > >     at com.hp.hpl.jena.rdf.arp.ARPResource.tripleRes(ARPResource.java
> > > :185)
> > >     at com.hp.hpl.jena.rdf.arp.ARPResource.triple(ARPResource.java
> > > :170)
> > >     at com.hp.hpl.jena.rdf.arp.ARPResource.setPredObject(
> > > ARPResource.java:147)
> > >     at com.hp.hpl.jena.rdf.arp.ARPResource.setType(ARPResource.java
> > > :142)
> > >     at com.hp.hpl.jena.rdf.arp.RDFParser.typedNode(RDFParser.java:961)
> > >     at com.hp.hpl.jena.rdf.arp.RDFParser.description(RDFParser.java
> > > :433)
> > >     at com.hp.hpl.jena.rdf.arp.RDFParser.obj(RDFParser.java:346)
> > >     at com.hp.hpl.jena.rdf.arp.RDFParser.rdf(RDFParser.java:326)
> > >     at com.hp.hpl.jena.rdf.arp.RDFParser.rdfFileSub(RDFParser.java
> > > :107)
> > >     at com.hp.hpl.jena.rdf.arp.RDFParser.rdfFile(RDFParser.java:99)
> > >     at com.hp.hpl.jena.rdf.arp.SingleThreadedParser.parse(
> > > SingleThreadedParser.java:146)
> > >     at com.hp.hpl.jena.rdf.arp.ARP.load(ARP.java:136)
> > >     at
> > > edu.stanford.smi.protegex.owl.jena.parser.ProtegeOWLParser$1.invokeARP(Unknown
> > > Source)
> > >     at
> > > edu.stanford.smi.protegex.owl.jena.parser.ProtegeOWLParser.loadTriples(Unknown
> > > Source)
> > >     at edu.stanford.smi.protegex.owl.jena.parser.ProtegeOWLParser.run(Unknown
> > > Source)
> > >     at edu.stanford.smi.protegex.owl.jena.parser.ProtegeOWLParser.run(Unknown
> > > Source)
> > >     at edu.stanford.smi.protegex.owl.jena.parser.ProtegeOWLParser.run(Unknown
> > > Source)
> > >     at
> > > edu.stanford.smi.protegex.owl.database.CreateOWLDatabaseFromFileProjectPlugin.buildNewProject(Unknown
> > > Source)
> > >     at
> > > edu.stanford.smi.protege.plugin.AbstractCreateProjectPlugin.createProject(Unknown
> > > Source)
> > >     at edu.stanford.smi.protege.plugin.CreateProjectWizard.onFinish(Unknown
> > > Source)
> > >     at edu.stanford.smi.protege.util.Wizard$1.actionPerformed(Unknown
> > > Source)
> > >     at javax.swing.AbstractButton.fireActionPerformed(
> > > AbstractButton.java:1834)
> > >     at javax.swing.AbstractButton$Handler.actionPerformed(
> > > AbstractButton.java:2152)
> > >     at javax.swing.DefaultButtonModel.fireActionPerformed(
> > > DefaultButtonModel.java:420)
> > >     at javax.swing.DefaultButtonModel.setPressed(
> > > DefaultButtonModel.java:258)
> > >     at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(
> > > BasicButtonListener.java:234)
> > >     at java.awt.Component.processMouseEvent(Component.java:5463)
> > >     at javax.swing.JComponent.processMouseEvent(JComponent.java:3052)
> > >     at java.awt.Component.processEvent(Component.java:5228)
> > >     at java.awt.Container.processEvent(Container.java:1961)
> > >     at java.awt.Component.dispatchEventImpl(Component.java:3931)
> > >     at java.awt.Container.dispatchEventImpl(Container.java:2019)
> > >     at java.awt.Component.dispatchEvent(Component.java:3779)
> > >     at java.awt.LightweightDispatcher.retargetMouseEvent(
> > > Container.java:4203)
> > >     at java.awt.LightweightDispatcher.processMouseEvent(Container.java
> > > :3883)
> > >     at java.awt.LightweightDispatcher.dispatchEvent(Container.java
> > > :3813)
> > >     at java.awt.Container.dispatchEventImpl(Container.java:2005)
> > >     at java.awt.Window.dispatchEventImpl(Window.java:1757)
> > >     at java.awt.Component.dispatchEvent(Component.java:3779)
> > >     at java.awt.EventQueue.dispatchEvent(EventQueue.java:463)
> > >     at java.awt.EventDispatchThread.pumpOneEventForHierarchy(
> > > EventDispatchThread.java:234)
> > >     at java.awt.EventDispatchThread.pumpEventsForHierarchy(
> > > EventDispatchThread.java:163)
> > >     at java.awt.EventDispatchThread.pumpEventsForHierarchy(
> > > EventDispatchThread.java:153)
> > >     at java.awt.Dialog+1.run(Dialog.java:514)
> > >     at java.awt.Dialog.show(Dialog.java:535)
> > >     at java.awt.Component.show(Component.java:1292)
> > >     at java.awt.Component.setVisible(Component.java:1247)
> > >     at edu.stanford.smi.protege.util.Wizard.execute(Unknown Source)
> > >     at
> > > edu.stanford.smi.protege.ui.ProjectManager.createNewProjectRequest(Unknown
> > > Source)
> > >     at edu.stanford.smi.protege.action.CreateProject.actionPerformed(Unknown
> > > Source)
> > >     at javax.swing.AbstractButton.fireActionPerformed(
> > > AbstractButton.java:1834)
> > >     at javax.swing.AbstractButton$Handler.actionPerformed(
> > > AbstractButton.java:2152)
> > >     at javax.swing.DefaultButtonModel.fireActionPerformed(
> > > DefaultButtonModel.java:420)
> > >     at javax.swing.DefaultButtonModel.setPressed(
> > > DefaultButtonModel.java:258)
> > >     at javax.swing.AbstractButton.doClick(AbstractButton.java:302)
> > >     at javax.swing.plaf.basic.BasicMenuItemUI.doClick(
> > > BasicMenuItemUI.java:1000)
> > >     at javax.swing.plaf.basic.BasicMenuItemUI$Handler.mouseReleased(
> > > BasicMenuItemUI.java:1041)
> > >     at java.awt.Component.processMouseEvent(Component.java:5463)
> > >     at javax.swing.JComponent.processMouseEvent(JComponent.java:3052)
> > >     at java.awt.Component.processEvent(Component.java:5228)
> > >     at java.awt.Container.processEvent(Container.java:1961)
> > >     at java.awt.Component.dispatchEventImpl(Component.java:3931)
> > >     at java.awt.Container.dispatchEventImpl(Container.java:2019)
> > >     at java.awt.Component.dispatchEvent(Component.java:3779)
> > >     at java.awt.LightweightDispatcher.retargetMouseEvent(
> > > Container.java:4203)
> > >     at java.awt.LightweightDispatcher.processMouseEvent(Container.java
> > > :3883)
> > >     at java.awt.LightweightDispatcher.dispatchEvent(Container.java
> > > :3813)
> > >     at java.awt.Container.dispatchEventImpl(Container.java:2005)
> > >     at java.awt.Window.dispatchEventImpl(Window.java:1757)
> > >     at java.awt.Component.dispatchEvent(Component.java:3779)
> > >     at java.awt.EventQueue.dispatchEvent(EventQueue.java:463)
> > >     at java.awt.EventDispatchThread.pumpOneEventForHierarchy(
> > > EventDispatchThread.java:234)
> > >     at java.awt.EventDispatchThread.pumpEventsForHierarchy(
> > > EventDispatchThread.java:163)
> > >     at java.awt.EventDispatchThread.pumpEvents(
> > > EventDispatchThread.java:157)
> > >     at java.awt.EventDispatchThread.pumpEvents(
> > > EventDispatchThread.java:149)
> > >     at java.awt.EventDispatchThread.run(EventDispatchThread.java:110)
> > >
> > >
> > >
> > > On 8/31/06, Schmitz, Jeffrey A <Jeffrey.A.Schmitz at boeing.com> wrote:
> > > >
> > > >  No, just a database named pizzas.  Protege will create its own
> > > > tables as needed.
> > > >
> > > > Did you see the message concerning the mysql database plugin (it
> > > > just came).  That's probably something you want to get before trying
> > > > anything else.
> > > >
> > > > Jeff
> > > >
> > > >
> > > >  ------------------------------
> > > >  *From:* Congmin min [mailto: marlonmin at gmail.com]
> > > > *Sent:* Thursday, August 31, 2006 3:34 PM
> > > >
> > > > *To:* User support for the Protege-OWL editor
> > > > *Subject:* Re: [protege-owl] MySql JDBC Driver and Database problem
> > > >
> > > >  I did almost the same as yours. but it still can't find the driver.
> > > > when you use
> > > > jdbc:mysql://localhost/pizzas
> > > > do you create a table named 'pizzas' in your database?
> > > >
> > > > I don't know if I should first create a database or table.
> > > >
> > > > On 8/31/06, Schmitz, Jeffrey A <Jeffrey.A.Schmitz at boeing.com> wrote:
> > > > >
> > > > >  I use:
> > > > >
> > > > >  jdbc:mysql://localhost/pizzas
> > > > >
> > > > > for the driver class itself I use
> > > > >
> > > > > com.mysql.jdbc.Driver
> > > > >
> > > > > Also, I had to copy the driver jar file to the Protege
> > > > > installation folder and rename it to driver.jar
> > > > >
> > > > > Once I created my Protege database project, I noticed that it had
> > > > > created the following two tables:
> > > > >
> > > > > protegepizzatable
> > > > > protegepizzatable_includes
> > > > >
> > > > > I should mention that, while I didn't get any errors, I never did
> > > > > get the Protege editor to work with the database project.  All of the tabs
> > > > > were just blank grey sheets.  That's when I gave up.
> > > > >
> > > > >
> > > > > Hope this helps,
> > > > > Jeff
> > > > >
> > > > >  ------------------------------
> > > > >  *From:* Congmin min [mailto: marlonmin at gmail.com]
> > > > > *Sent:* Thursday, August 31, 2006 1:09 PM
> > > > > *To:* User support for the Protege-OWL editor
> > > > > *Subject:* Re: [protege-owl] MySql JDBC Driver and Database
> > > > > problem
> > > > >
> > > > >  thanks for your message. Yes, I have an account on mySql, I log
> > > > > in mysql by:
> > > > >
> > > > > mysql -u cmar -pxyz04,
> > > > >
> > > > > then 'cmar' is my  username, and password is 'xyz04' on the form.
> > > > >
> > > > > How do you specify the Driver URI?
> > > > >
> > > > >
> > > > >
> > > > >
> > > > > On 8/31/06, Schmitz, Jeffrey A <Jeffrey.A.Schmitz at boeing.com>
> > > > > wrote:
> > > > > >
> > > > > >  I didn't use the port number when I specified the database
> > > > > > URL.  Also, did you create your MySQL accounts in MySQL?  These accounts
> > > > > > have nothing to do with your computer accounts.  For example, use the
> > > > > > following to create a PizzaMan MySQL account from the mysql command line as
> > > > > > root user:
> > > > > >
> > > > > >
> > > > > > mysql> CREATE USER PizzaMan at localhost;
> > > > > >
> > > > > > mysql> SET PASSWORD FOR PizzaMan at localhost =
> > > > > > password('pizzaPW');
> > > > > >
> > > > > > mysql> GRANT ALL PRIVILEGES ON *.* TO PizzaMan at localhost WITH
> > > > > > GRANT OPTION;
> > > > > >
> > > > > > Then specify PizzaMan as the user and pizzaPW as the password in
> > > > > > the Protege setup form.
> > > > > >
> > > > > > Jeff
> > > > > >
> > > > > >  ------------------------------
> > > > > > *From:* Congmin min [mailto:marlonmin at gmail.com]
> > > > > > *Sent:* Thursday, August 31, 2006 12:16 PM
> > > > > > *To:* protege-owl at lists.Stanford.EDU
> > > > > > *Subject:* [protege-owl] MySql JDBC Driver and Database problem
> > > > > >
> > > > > >  Hi, I also I have a database backend problem. I specify my JDBC
> > > > > > driver URI as:
> > > > > >
> > > > > > JDBC Driver URL : jdbc:mysql://localhost:3306/test_owl
> > > > > >
> > > > > > Error message:
> > > > > >
> > > > > > "The driver was found but it is not possible to create a
> > > > > > connection with the driver URL.
> > > > > > Perhaps the URL syntax is wrong or the username/password is
> > > > > > invalid.
> > > > > >
> > > > > >     No suitable driver "
> > > > > >
> > > > > > Show I first create the 'test_owl' table in mySql database? I
> > > > > > just want to convert an owl file to an owl database format.
> > > > > >
> > > > > > I highly appreciate your help for specifying the correct JDBC
> > > > > > Driver URL.
> > > > > >
> > > > > > _______________________________________________
> > > > > > protege-owl mailing list
> > > > > > protege-owl at lists.stanford.edu
> > > > > > https://mailman.stanford.edu/mailman/listinfo/protege-owl
> > > > > >
> > > > > >
> > > > > >
> > > > >
> > > > > _______________________________________________
> > > > > protege-owl mailing list
> > > > > protege-owl at lists.stanford.edu
> > > > > https://mailman.stanford.edu/mailman/listinfo/protege-owl
> > > > >
> > > > >
> > > > >
> > > >
> > > > _______________________________________________
> > > > protege-owl mailing list
> > > > protege-owl at lists.stanford.edu
> > > > https://mailman.stanford.edu/mailman/listinfo/protege-owl
> > > >
> > > >
> > > >
> > >
> > > _______________________________________________
> > > protege-owl mailing list
> > > protege-owl at lists.stanford.edu
> > > https://mailman.stanford.edu/mailman/listinfo/protege-owl
> > >
> > >
> > >
> >
>
> _______________________________________________
> protege-owl mailing list
> protege-owl at lists.stanford.edu
> https://mailman.stanford.edu/mailman/listinfo/protege-owl
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.stanford.edu/pipermail/protege-owl/attachments/20060905/0ff70dc4/attachment.html>


More information about the protege-owl mailing list