[protege-owl] from OWL to Database with protegeOWL API

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[protege-owl] from OWL to Database with protegeOWL API

Julia Dmitrieva
Hello Amelie,

I don't have the answer yet.
I have find this function:
public void
loadKnowledgeBase(edu.stanford.smi.protege.model.KnowledgeBase kb,
                               String driver,
                               String table,
                               String url,
                               String user,
                               String password,
                               Collection errors)

I try the following, but it doesn't work:

  String uri = "http://www.biopax.org/release/biopax-level2.owl";
  JenaOWLModel owlModel = ProtegeOWL.createJenaOWLModelFromURI(uri);
  Collection errors = new ArrayList();
OWLDatabaseKnowledgeBaseFactory kb = new OWLDatabaseKnowledgeBaseFactory();
// here I think we load the my owlModel knowledge base in the database
// knowledge base factory
kb.loadKnowledgeBase(owlModel, "com.mysql.jdbc.Driver", "Thesaurus",
"jdbc:mysql://localhost:3306/test", "login", "password", errors);

And the output is:

/*******************/
CONFIG: Protege 3.2 Build 300, JVM 1.5.0_06-b05, memory=1040M, Windows
2000, encoding=UTF-8, language=en, country=US
WARNING: Plugins directory not found: C:\Program
Files\eclipse3.0\workspace\OwlDataMiner\plugins --
PluginUtilities.findPluginsDirectory()
[ProtegeOWLParser] Completed triple loading after 688 ms
[TripleChangePostProcessor] Completed lists after 0 ms
[TripleChangePostProcessor] Completed anonymous classes after 15 ms
[TripleChangePostProcessor] Completed deprecated classes after 0 ms
[TripleChangePostProcessor] Completed properties after 32 ms
[TripleChangePostProcessor] Completed named classes after 0 ms
... Loading completed after 797 ms
WARNING: Unable to load knowledgebase -- java.lang.NullPointerException
     at
edu.stanford.smi.protege.storage.database.DatabaseKnowledgeBaseFactory.initializeKB(Unknown
Source)
     at
edu.stanford.smi.protege.storage.database.DatabaseKnowledgeBaseFactory.loadKnowledgeBase(Unknown
Source)
     at
edu.stanford.smi.protegex.owl.database.OWLDatabaseKnowledgeBaseFactory.loadKnowledgeBase(Unknown
Source)
     at dataMiner.OWLAPIDemoApplication.main(OWLAPIDemoApplication.java:122)

/*******************/

I have MySql database and mysql-connector-java-3.1.12 driver is at the
classpath.
I think we have to know how to load a knowledge base at
the OWLDatabaseModel, and then how to save it.
The problem is the I can not find the documentation, and
it is very diffecult to find the needed functions from
java doc of Protege.

With beste regards,
Julia

Amelie Marseille [MSc BIX] wrote:

 > Hello Julia,
 > I saw your mail from the protege mailing list. Did you get your answer?
 >
 > I am triying to do the same this as you, but with my own ontology.
Then I want to use a reasoner.
 >
 > I think you need to have a mysql database (or other) and also the
driver (a connector .jar) that you can all download from the mysql web
site. You need to add the jar to the classpath. The database URI, I
guess it is something like
 > "jdbc:mysql://"+SERVER+"/"+DBNAME+USER+PSWD
 >
 > I tried the code that you gave (with the OWLDatabaseModel
contructor), but i can't understand why, it says that this contructor
doesn't exist in the class
edu.standford.smi.protegex.owl.database.OWLDatabaseModel.
 >
 > Do you have a hint ?
 >
 >
--
Julia Dmitrieva

LIACS Office:  124
Phone:  +31 (0)71 – 5275777
E-Mail:  [hidden email]

Member of:  Imaging
Scientific Personnel

-------------------------------------------------------------------------
To unsubscribe go to http://protege.stanford.edu/community/subscribe.html