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-discussion] DataMaster - mapping columns to class members

Paul Smith paulsmith7777777 at yahoo.com
Wed Mar 26 12:02:05 PDT 2008


Csongor Nyulas <csongor.nyulas <at> stanford.edu> writes:

> 
> Dear Paul,
> 
> There is no direct way to create instances of your arbitrary classes in 
> the ontology from your DB tables,
> because there is no way to specify the mappings between the data source 
> elements and ontology elements. Although
> we may build something that facilitate the ontology database mapping, 
> this will eventually happen in the
> distant future when we will need this functionality in our project.
> 
> Until then, there are a few tricky ways to achieve what you need. 
> Depending on at which end of the import
> (DB or ontology) you have liberty of making (temporary) changes, you can 
> try:
> a) the solution proposed by Jonathan
> 
> b) in case you can't change your DB but can make changes in your ontology:
>     - import the structure of the database in a temporary ontology, in 
> order to check the names of the classes
> and properties. Pay attention also to the generated namespaces
>     - rename the classes and properties in your ontology to exactly 
> match (including the namespaces) the structure
> in the temporary ontology
>     - import the instances in your ontology using DataMaster
>     - rename the classes/properties in your ontology to their original names
> This solution is good if you do not have too many tables, and you do not 
> have to repeatedly import from the database
> 
> c) in case neither a) or b) is convenient import the instances in your 
> ontology with DataMaster and use the
> ProtegeScriptTab, or SQWRL rules to create corresponding instances in 
> your original ontology structure.
> 
> I hope this was helpful,
> Csongor
> 
> Paul Smith wrote:
> > Thanks,
> >
> > perhaps I am not yet fully acquainted with DataMaster Plugin. The problem 
is 
> > that when I import instances from a MySQL table into a Protégé class X , 
it 
> > creates a new subclass Y, named after the table,  and fill it with the 
> > instances. How to import instances directly in class X then?? but what is 
> > worse, class Y has an entire new set of attributes, named after the table 
> > columns, whereas I wanted the attributes of X be filled. In other words I 
need 
> > to map the table columns to the attributes of class X. How to do this?? 
Please 
> > relief my struggle…
> >
> > ..Paul
> >
> >

Thank you.

I am applying your solution b) trying to modify temporarily the ontology. But 
there is a problem:
When the database is imported with DataMaster, the newly created slots are 
named after the table column names with a damn prefix “db:”.  For example if 
in the table there is a column “city”, in the ontology will be created a 
slot “db:city”. I seems cannot either avoid that prefix “db:” nor changing the 
old ontology  to prepare a slot “db:city” since protégé does not allows me to 
rename entities ( either slots or features) by placing that prefix. What can I 
do to get rid of that “db:” ?? 
It is a critical problem, because I have to handle tens of thousand of 
instances, I cannot think to edit them one by one.

Paul








More information about the protege-discussion mailing list