Referencing class from imported ontology

532 views
Skip to first unread message

Vinicius Sobral

unread,
Oct 23, 2013, 5:36:00 PM10/23/13
to ontop...@googlegroups.com
Hi, I have some questions regarding mapping in Ontop, and I apologize if this information is somewhere else. I just couldn't find it..

First, how exactly should I define a prefix to be used in a map? The documentation says:

Prefixes can be used when writing a URI templates. A prefix must be enclosed between the symbols '&' and ';' and it will be replaced by the prefix definition when the system initializes.

 But I understand this is old syntax, right? What about in the new one? I tried to include a "PREFIX p: <http://www.example.org/la#>" but got an error.

Second, supposing I can define a prefix, the mappings would look something like "p1:{code} a p2:Class", is it possible anyway, or should the object always reference a Class with the default prefix (the ":")?

Finally, about the imported ontologies, is it possible to include a Class from an imported ontology in the mappings? I'm trying to reproduce the second of Ontop's examples this way, but couldn't do it so far. It happens that when I put ":Author" as the object in the mapping it says the URI is unknown by the ontology (since Author is from an imported ontology, with different URI from the current ontology). When I put <http://meraka/moss/exampleBooks.owl#Author> I also get an unknown URI error. I would like to do something like:

PREFIX books: <http://meraka/moss/exampleBooks.owl#>
:{wr_code} a books:Author .
 
My intention is to separate the Class' file from the instance's file. Is it possible?

Regards,
Vinicius 

Mariano Rodriguez Muro

unread,
Oct 23, 2013, 5:48:34 PM10/23/13
to Vinicius Sobral, ontop...@googlegroups.com
Hi Vinicius, 

The information is not proper on the website. Sorry for the trouble. Here goes a quick explanation of how
to work with prefixes in protege and the ontop plugin


First define the prefixes you need in the Active ontology tab as shown in the picture

To avoid issues with imported ontologies and the default prefix ":" avoid using it, and define prefixes for each of the 
ontologies you need. Use those in the mappings instead of the default prefix.

The correct syntax for prefixes is as your said, no special symbols, just the URI as you need it. Example,

p1:{code} a p2:Class
SELECT code FROM t1

The classes and properties in the mapping do not need to use the default prefix, you can use any (as in the example).
If that doesn't work,then its a bug and we need to fix it but it should work (use the latest version 1.9).



Note, all this info is about prefixes in the protege plugin. If you work directly with the .obda file, then you just need
to define the prefixes in the .obda file itself in the preamble.


Cheers,
Mariano





--
You received this message because you are subscribed to the Google Groups "ontop4obda" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ontop4obda+...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

 
Mariano Rodriguez Muro                
http://mariano.rodriguez-muro.com/
KRDB Research Center                  
Faculty of Computer Science           
Free University of Bozen-Bolzano (FUB)
Piazza Domenicani 3,                  
I-39100 Bozen-Bolzano BZ, Italy       

======================== PGP ========================
To send me encrypted email use my PGP key found at:



signature.asc

Vinicius Sobral

unread,
Oct 24, 2013, 12:07:52 PM10/24/13
to Mariano Rodriguez Muro, ontop...@googlegroups.com
Mariano,

I did as you said and defined the prefixes in protege, including the default from my current ontology:Imagem inline 1

As we can see, the class is from an imported ontology and I am using the URI that protege is showing when I pass the mouse over the class (maybe I am missing something here, is this really the URI that I should use?)
Imagem inline 2

But when I try to map I still got the same error, saying the URI is unknown:
Imagem inline 3

If I create an Author class in the current ontology and replace the 'books' prefix in the mapping by 'default' it works just fine. I am using Ontop 1.9. Is it possible that defining directly in the .odba file it will work? I am going to try it right now.

Regards,
Vinicius Sobral
Mestrando em Informática - UFES
Celular: (27) 9291-7489


2013/10/23 Mariano Rodriguez Muro <marian...@gmail.com>
prefixes.png
error.png
Screen_Shot_2013-10-23_at_5.44.04_PM.png
classuri.png

Martín Rezk

unread,
Oct 27, 2013, 9:14:36 PM10/27/13
to Vinicius Sobral, Mariano Rodriguez Muro, ontop...@googlegroups.com
Hi Vinicius,
                  Which version of protege are you using? 4.2 or 4.3?  It should be 4.3. I am trying to reproduce your error, but when I define a prefix it works for me. Could you send us your owl/obda files?

Best

Martin Rezk.-

KRDB Research Center                  
Faculty of Computer Science    
classuri.png
prefixes.png
Screen_Shot_2013-10-23_at_5.44.04_PM.png
error.png

Vinicius Sobral

unread,
Oct 29, 2013, 1:41:00 PM10/29/13
to Martín Rezk, Mariano Rodriguez Muro, ontop...@googlegroups.com
Martin,

I am using version 4.3 of Protege. Inexplicably it worked when I tried today. I am guessing that by the the time I add the prefixes Protege does not register it properly, so it take me to save, close and open the file again for the prefixes to work. Working directly with the .odba file does not bring this problem.

My problem now is the DB connection, since I am not managing to run the SPARQL queries. It pops an error saying that maybe my DB is not supported, which is an error I was expecting since I was trying to use Virtuoso.

I just thought that a JDBC compliant DB would work anyway, but it seems to have more variables involved.

Anyway, thanks for your help!

Regards,
Vinicius Sobral
Mestrando em Informática - UFES
Celular: (27) 9291-7489


2013/10/27 Martín Rezk <marti...@gmail.com>
error.png
Screen_Shot_2013-10-23_at_5.44.04_PM.png
prefixes.png
classuri.png

Mariano Rodriguez Muro

unread,
Oct 29, 2013, 2:04:26 PM10/29/13
to Vinicius Sobral, Martín Rezk, ontop...@googlegroups.com
About Vinicius,

Please double check that you use v1.9 of ontop, we removed the restriction we had on 
non-supported DBs, ontop shouldn't complain about the db not being supported.

Note, if the DB doesn't use standard SQL99 things could still fail due to syntax issues,
but at least it should get to that point.

Let us know how it goes please



On Oct 29, 2013, at 1:41 PM, Vinicius Sobral <vmso...@gmail.com> wrote:

Martin,

I am using version 4.3 of Protege. Inexplicably it worked when I tried today. I am guessing that by the the time I add the prefixes Protege does not register it properly, so it take me to save, close and open the file again for the prefixes to work. Working directly with the .odba file does not bring this problem.

My problem now is the DB connection, since I am not managing to run the SPARQL queries. It pops an error saying that maybe my DB is not supported, which is an error I was expecting since I was trying to use Virtuoso.

I just thought that a JDBC compliant DB would work anyway, but it seems to have more variables involved.

Anyway, thanks for your help!

Regards,
Vinicius Sobral
Mestrando em Informática - UFES
Celular: (27) 9291-7489


2013/10/27 Martín Rezk <marti...@gmail.com>
Hi Vinicius,
                  Which version of protege are you using? 4.2 or 4.3?  It should be 4.3. I am trying to reproduce your error, but when I define a prefix it works for me. Could you send us your owl/obda files?

Best

Martin Rezk.-

KRDB Research Center                  
Faculty of Computer Science    
On Thu, Oct 24, 2013 at 1:07 PM, Vinicius Sobral <vmso...@gmail.com> wrote:
Mariano,

I did as you said and defined the prefixes in protege, including the default from my current ontology:<prefixes.png>

As we can see, the class is from an imported ontology and I am using the URI that protege is showing when I pass the mouse over the class (maybe I am missing something here, is this really the URI that I should use?)
<classuri.png>

But when I try to map I still got the same error, saying the URI is unknown:
<error.png>

If I create an Author class in the current ontology and replace the 'books' prefix in the mapping by 'default' it works just fine. I am using Ontop 1.9. Is it possible that defining directly in the .odba file it will work? I am going to try it right now.

Regards,
Vinicius Sobral
Mestrando em Informática - UFES
Celular: (27) 9291-7489
2013/10/23 Mariano Rodriguez Muro <marian...@gmail.com>
Hi Vinicius, 

The information is not proper on the website. Sorry for the trouble. Here goes a quick explanation of how
to work with prefixes in protege and the ontop plugin


First define the prefixes you need in the Active ontology tab as shown in the picture

<Screen_Shot_2013-10-23_at_5.44.04_PM.png>
signature.asc

Martín Rezk

unread,
Oct 29, 2013, 2:06:49 PM10/29/13
to Mariano Rodriguez Muro, Vinicius Sobral, ontop...@googlegroups.com
Vinicius,
Try to get the SQL rewriting of the SPARQL query. Right
click on the "ontop Sparql" window. If you get the query, try to
execute it on Virtuoso directly, and see how it goes. Let us know what
happens please.

Best,

Martin.-

Vinicius Sobral

unread,
Oct 29, 2013, 2:46:38 PM10/29/13
to Martín Rezk, Mariano Rodriguez Muro, ontop...@googlegroups.com
I am not managing to get the SQL rewriting because of an error. It is the same error that I get if I hit the 'Execute' button.

Just so you know, at the Mappings tab it all works fine. As I configure the connection I get "Connection is OK" and I can query the database and see the data when creating the mappings.

Now I have attached the error and my .obda file if it is of any help.


Abraços,
Vinicius Sobral
Mestrando em Informática - UFES
Celular: (27) 9291-7489


2013/10/29 Martín Rezk <marti...@gmail.com>
error.txt
books.obda
Reply all
Reply to author
Forward
0 new messages