Relation IDs mismatch - Mapping OWL to Oracle DB with Ontop

54 views
Skip to first unread message

David Großmann

unread,
Jun 12, 2021, 9:07:25 AM6/12/21
to ontop4obda
As a Part of my little App I try to map Data between my Ontology and an Oracle DB with ontop. But my first mapping is not accepted by the reasoner and it's not clear why. 

As my first attempt I use the following target:  

    :KIS/P_PVPAT_PATIENT/{PPVPAT_PATNR} a :Patient .   

and the following source:  

    select * from P_PVPAT_PATIENT

Here KIS is the schema, p_pvpat_patient the table and ppvpat_patnr the key.


Caused by: it.unibz.inf.ontop.exception.InvalidMappingSourceQueriesException:  
Error: Relation IDs mismatch: P_PVPAT_PATIENT v "KIS"."P_PVPAT_PATIENT" P_PVPAT_PATIENT 
Problem location: source query of triplesMap 
[id: MAP_PATIENT
target atoms: triple(s,p,o) with  
source query: select * from P_PVPAT_PATIENT]


David Großmann

unread,
Jun 12, 2021, 10:44:10 AM6/12/21
to ontop4obda
Okay so I tried a lot and it was simple. I just did not use the schema in my SQL. But with the schema in my SQL the reasoner is fine.

But im not done yet, I found the next error:

When executing a sparql query:

SELECT DISTINCT ?patient {
  ?patient a :Patient.
}


 I get a java.lang.IllegalArgumentException: Not a valid (absolute) IRI: kis/P_PVPAT_PATIENT/9300/P2000001.

roman.ko...@gmail.com

unread,
Jun 12, 2021, 10:58:36 AM6/12/21
to ontop4obda
Hi David

Indeed, your SQL queries should contain schemas for tables (if the tables are not in the default schema for the user in the JDBC connection string).

I am slightly confused by what you wrote in the first post - why do you write "Here KIS is the schema"? KIS in the example you gave is just part of the IRI, which is formed by concatenating the default prefix (:), the string "KIS/P_PVPAT_PATIENT/" and a value from the PPVPAT_PATNR column in your table. Now, by the looks of the second error message, you have no default prefix, and so, cannot use : in your IRIs - that is why the generated string, kis/P_PVPAT_PATIENT/9300/P2000001, is not an IRI. Try defining the default prefix (or, alternatively, write the IRI template without any prefixes). To learn more about IRIs, read https://www.w3.org/TR/turtle/#sec-iri.

Best
Roman

David Großmann

unread,
Jun 14, 2021, 4:08:31 PM6/14/21
to ontop4obda
Hello Roman,

your are absolutely right, when I retyped my target I missed the colon and did not recognize it. 

Thanks!

Reply all
Reply to author
Forward
0 new messages