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] import (non-interractive) my OWL into RDBMS

Tony C edufanatic at googlemail.com
Wed Mar 18 14:04:23 PDT 2009


Hi Tania,

Please see my class below. I tried it that way.

Tried compiling it against Protege 3.4 jars.

The compiler indicates that none of the classes defined on the link you sent
exist.

Help please.

Tony

//---------------------------------------------------------------------
// Runnable Java class that imports /tmp/pizza/pizza.owl into MySQL RDBMS
//---------------------------------------------------------------------

import java.util.*;
import edu.stanford.smi.protege.model.*;
import edu.stanford.smi.protege.util.*;
import edu.stanford.smi.protege.exception.OntologyLoadException;
import edu.stanford.smi.protege.model.KnowledgeBaseFactory;
import
edu.stanford.smi.protegex.owl.database.creator.OwlDatabaseFromFileCreator;

public class Test extends runnable
{

private Test();

{
 super();
}

private final static String driver = "com.mysql.jdbc.Driver";
private final static String url = "jdbc:mysql://localhost/protege";
private final static String table = "newtableTest";
private final static String user = "root";
private final static String password = "";
//private final static String uri = "file:/tmp/pizza/pizza.owl";

  @SuppressWarnings("unchecked")
  private static OWLModel convertToDatabaseProject(OWLModel fileModel)
throws Exception {
  System.out.println("In Convert to Database Project");
  List errors = new ArrayList();
  Project fileProject = fileModel.getProject();
  OWLDatabaseKnowledgeBaseFactory factory = new
OWLDatabaseKnowledgeBaseFactory();
  PropertyList sources =
PropertyList.create(fileProject.getInternalProjectKnowledgeBase());

  DatabaseKnowledgeBaseFactory.setSources(sources, driver, url, table, user,
password);
  factory.saveKnowledgeBase(fileModel, sources, errors);

  displayErrors(errors); //forget this and it will be a mystery when things
go wrong
  if (!errors.isEmpty()) {
  return null;
  }

  //Following lines are optional.
  //Use them if you want to have a pprj generated for the DB project (you
usually want this)
  //If not, you can always create a new project from existing sources in the
Protege editor

  Project dbProject = Project.createNewProject(factory, errors);
  DatabaseKnowledgeBaseFactory.setSources(dbProject.getSources(), driver,
url, table, user, password);

  dbProject.createDomainKnowledgeBase(factory, errors, true);
  dbProject.setProjectURI(URIUtilities.createURI(dbProjectFile));
  dbProject.save(errors);

  displayErrors(errors); //forget this and it will be a mystery when things
go wrong
  return (OWLModel) dbProject.getKnowledgeBase();
  }

private static void main()
{
 String URL="myUrl";
 OWLModel convertToDatabaseProject;

}

}

//---------------------
// Runnable Java END END
//---------------------

------------------------------

Message: 4
Date: Mon, 16 Mar 2009 16:13:45 -0700
From: Tania Tudorache <tudorache at stanford.edu>
Subject: Re: [protege-owl] Protege 3 java classes
To: User support for the Protege-OWL editor
       <protege-owl at lists.stanford.edu>
Message-ID: <49BEDD29.2040207 at stanford.edu>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed

Tony,

I suppose you are asking how to convert an OWL file to the OWL database
backend. There are two ways to do that, which are documented on the wiki:

http://protegewiki.stanford.edu/index.php/ConvertingToDatabaseProject

Tania

Tony C wrote:
>
> hi
>
> Does anyone know what Protege 3 java classes are called
> programatically for importing an OWL file to MySQL?
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> protege-owl mailing list
> protege-owl at lists.stanford.edu
> https://mailman.stanford.edu/mailman/listinfo/protege-owl
>
> Instructions for unsubscribing:
http://protege.stanford.edu/doc/faq.html#01a.03
>



------------------------------

Message: 5
Date: Mon, 16 Mar 2009 16:15:42 -0700
From: Tania Tudorache <tudorache at stanford.edu>
Subject: Re: [protege-owl] import (non-interractive) my OWL into RDBMS
To: User support for the Protege-OWL editor
       <protege-owl at lists.stanford.edu>
Message-ID: <49BEDD9E.2080700 at stanford.edu>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed

Tony,

Please see my reply to your other post.

Tania

Tony C wrote:
> Hi,
>
> I'm working on a project to import my OWL into RDBMS then make it
> accessible via different SQL commands to get the desired outputs; my
> intension is to
>
> 1. load/import my owl file to Mysql with "command line" running as a
> UNIX/LINUX script in the backend,
> 2. extract the data from the table into various tables (from the LISP
> to something easier).
>
> The protege RDBMS is explained here
> http://protege.stanford.edu/doc/design/jdbc_backend.html
>
> I'm quite happy to import using the same method used by Protege
> although I'm not quite sure what faces/slots etc represent in my
> ontology. The imported data makes no sense for me at this point until
> i can achieve task on point 1 above.
>
> What I did:
>
> Recently I imported my OWL file to MySQL database using Protege
> (interructively). It all went into one table which is fine by me
>
> What I would like to do:
>
> Now I'm trying to do the same operation (load/import my owl file to
> Mysql) in non interractive mode; a Linux/Unix shell script that does
> the job without GUI clicks.
>
> I'm pretty sure this is possible but I don't know the essencial java
> classes required to make that happen. Can someone help?
>
> Regards,
>
> Tony.
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> protege-owl mailing list
> protege-owl at lists.stanford.edu
> https://mailman.stanford.edu/mailman/listinfo/protege-owl
>
> Instructions for unsubscribing:
http://protege.stanford.edu/doc/faq.html#01a.03
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.stanford.edu/pipermail/protege-owl/attachments/20090319/bf287eaf/attachment.html>


More information about the protege-owl mailing list